How to make buttons work on a messenger chatbot? - facebook-messenger

We are developing a Facebook Messenger chatbot but we are having issues integrating our chatbot with Facebook Messenger.
When, during a chat, the user sends a text message our webhook receives the data and does all the processing accordingly.
But when we send the user a menu with buttons and the user clicks the buttons instead of typing a message our webhook doesn’t receive the payload ar any other data that we were supposed to receive.
When the user starts a conversation with our chatbot we send them the following message:
{
"recipient":{
"id":"2492007720844646"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text”:”What do you prefer?”,
"buttons":[
{
"type":"postback",
"title”:”Blue",
"payload":"{'function':{'name':'color_blue'}}"
},
{
"type":"postback",
"title”:”Red”,
"payload":"color_red"
}
]
}
}
}
}
If the user clicks the button titled “Blue” our webhook doesn’t receive the payload “color blue”. On the other hand, if the user types the message “color blue” our webhook receives it without any problem.
If I try to simulate the problem using my own Facebook user, which is the app administrator, when I click the button the webhook receives the payload “color blue” without any problem but when any other user tries the same thing then our webhook won’t receive the payload. I suspect it is a problem with my app’s permission but I’ve already added to the app all permissions I think it needs.
Click here to see an image with an example of what we are trying to do
Note that the options on the left are provided automatically by the bot and the user just need to click on those options to keep the conversation going. There is no need for the user to type anything. Our problem is that when the user clicks on the options in the left we don't receive that message and therefore we can't do anything.
I couldn’t find any documentation related to this kind of behavior, can someone help me, please?
Any help will be very welcomed.
Thanks and please let me know if you need any further information.

Related

does watson assistant know if there is null response from user?

I have created a chatbot in Watson assistant and I need a condition where if there the user goes silent for 10 seconds I continue the conversation. is there a way for Watson to know if there is no response (null response)?
Also, does Watson know if the user clicked on a link? is clicking on a link considered a response in Watson?
Watson Assistant does not know if a user hasn't sent back a response,
you can do one of the following:
if you are using WA web chat channel, use the events provided to control the flow. You can set a timer via pre:recieve and reset it if the user did send a message via pre:send.
if there is a timeout send a message via send operation.
Alternatively, if you plan on supporting more than just a web chat channel (e.g. facebook, phone, whatsapp, etc.), you are better off implementing the same logic in a Post Message webhook and . Essentially, make your code keep a timer in the Post message and if a user send a reply, turn the timer off in a Pre Message webhook

React confirm email with request from API

I'm stuck with a problem.
Any user that create an account get an email (sent from backend) with a link confirmation.
When the user click that link, it send a request type:
{
"confirm_link": "/auth/confirm/id/emailtype/****token****"
}
My problem is: How do I check in my front if the user has clicked so I can be able to display a simple react toast like 'Your account as been verified' ?
Thank you !
Once the email confirmation request is completed you can use websockets to send a message from server to client notifying that account is verified.you can display your toast

How to enable/disable chatbot from Facebook Messenger

I have successfully built a chatbot rasa app to connect with Facebook Messenger. The bot is responsible for replying user's message instead of the admin page. I want something more flexible. Users can enable/disable chatbot. When users disabled chatbot they will chat with the admin page instead (The bot will not listen until it is turned on again)
Is there a way to do this?
To pause the conversation with the bot, if the user asks to be handed off to a human, you can write a rule that executes a custom action when that intent is triggered, which returns a ConversationPaused event. That way the bot stops listening to the user, and a person from your admin page can reply. There is a ConversationResumed event in that link which you can use to resume the conversation with the bot again.

Messenger ref parameter is not passed to dialogflow

I'm trying to connect messenger bot and dialogflow.
The idea is - when you click on the button, service is redirecting you to the me link
(example: http://m.me/2010070995927131?ref=initial_message_with_param)
then dialoglflow receives initial_message_with_param as message and fullfilment can generate the response.
Sending messages works at all but unfortunately, ref param doesn't.
Do you have any ideas why ref param is ignored on Dialogflow side?
Been few months, but i just came across here.
Under the "Edit Page Subscription Fields" in Messaging > Webhook in Facebook developers, you need to enable messaging_referrals to receive referral payload calls.

Last Message Sent by User Messenger Bot

I'm working with Facebook Messenger Bots and I need a way to make an HTTP Request for the last message sent by the user. All I can find is that Messenger Bots send a web hook with the information but, I specifically need to be able to manually check for the last message sent by the user. Any input would be helpful. Thank you.

Resources