Facebook Messenger Platform welcome screen not showing - facebook

My bot is working and able to reply to messages, but now I'm trying to add functionality for responding to a postback from the "Get Sarted" button.
I can't get the "Get Started" button to show up, though.
This previous answer suggests deleting the conversation on desktop and opening a new one, but this doesn't work: it just creates an empty conversation, without the welcome message or "Get Started" button. The documentation linked in that answer is also no longer available.
So how do I get this view to show up, so I can create and test my response to a user clicking the "Get Started" button?

You need to set up the "Get Started" button before it shows up:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"USER_DEFINED_PAYLOAD"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"

Related

Facebook Messenger open callback

Is there any way to get callback When users open messenger ?
Currently I am developing Facebook chat bot, for existing user on Facebook page
I want to show get started button, that's why i need some callback when user open
messenger
You don't need a callback to have Get Started button. All you need for this is to register the button with your app.
To do so, you send a curl as following:
curl -X POST -H "Content-Type: application/json" -d '{ \
"get_started":{ \
"payload":"<GET_STARTED_PAYLOAD>" \
} \
}' "https://graph.facebook.com/v2.8/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>"
You may change GET_STARTED_PAYLOAD to any text you like - that is what Facebook is going to send to your webhook if the user clicks GET STARTED.
More information here and here.

facebook messenger send message api without the user initiating the chat

I have a facebook page, and a website too. I need to add a button to my website, like "SEND THIS ARTICLE ON MESSENGER". When the user clicks on it, I need to send the article data to the user on messenger.
How can I achieve that?
To achieve your goal, You must have to use SEND TO MESSENGER Button.
Ref.: https://developers.facebook.com/docs/messenger-platform/discovery/send-to-messenger-plugin/
Full process to implement:
1. Need to integrate Facebook Div in your site
2. Add Facebook script
3. Once Any User press the button than You got the webhook event from the facebook which contatin the PSID.
4. Through this PSID You can sent the messege to that id.
If you are sending message using curl than following is the code
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"id": "<PSID>"
},
"message": {
"text": "hello, world!"
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=<FB_PAGE_TOKEN>";

How to add 'Get Started' button in facebook messenger chat bot?

I tried using this
curl -X POST -H "Content-Type: application/json" -d '{ "get_started": {"payload": "qr"} }' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=myPageAccessToken"
In response I also got { "result": "success" }
But the bot does not show any button.
First, make sure that your account facebook who try to use your bot since only admins/developers/testers of the app can see it when the app is in development.
Second, if you use Android, you need to clear the Messenger data/cache under Android Settings -> Apps, this will also clear your login and you need to login again.
For further information, you could check this out:
https://stackoverflow.com/a/42662751/6874563
It was working fine, All I had to do was, deleting the existing conversion.
In my case, get started button only appears, when there's no message exists in past.

Form designer for Facebook Messenger apps?

I'm a veteran programmer, however I am new to the Facebook Messenger API. I have seen that the API does support buttons as per this code snippet from the Facebook developers web site that uses a CURL example to demonstrate the formatting code:
https://developers.facebook.com/docs/messenger-platform/send-api-reference/button-template
curl -X POST -H "Content-Type: application/json" -d '{
"recipient":{
"id":"USER_ID"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"What do you want to do next?",
"buttons":[
{
"type":"web_url",
"url":"https://petersapparel.parseapp.com",
"title":"Show Website"
},
{
"type":"postback",
"title":"Start Chatting",
"payload":"USER_DEFINED_PAYLOAD"
}
]
}
}
}
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
This looks like typical JSON to me. Is there a GUI tool that can design these layout elements, not only for buttons, but for any other Facebook Messenger form template elements that may also exist in the API? Something that uses a drag and drop or other GUI interface that then generates the necessary JSON code or fragment to represent the designed form?
If so, please leave its name or a link to it.
There is the Platform Design Kit for Sketch: https://developers.facebook.com/docs/messenger-platform/design-resources/design-kit

Facebook messenger bot Persistent Menu button

I need to have a Facebook Messenger Bot persistent menu item "Send Message" which should not trigger a postback. Instead place the cursor on the messenger textbox. Is there a way to create the menu item without having the menu item type as "postback" or "web_url"
"Send a Message" menu item appears automatically on mobile device when a persistent menu is created. Its not needed on web.
Check the code from https://developers.facebook.com/docs/messenger-platform/messenger-profile/persistent-menu
curl -X POST -H "Content-Type: application/json" -d '{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled":true,
"call_to_actions":[
{...
Change composer_input_disabled to false.