I am developing a chatbot using Amazon lex. It is going to be integrated with facebook messenger in a facebook page. When a user opens the bot for the first time, it says nothing. It listens to user intents. I would like the bot to initiate a conversation and provide the user with a few options(configured in a mysql database in the backend). What is the best way to do this?
There is a get_started event which you can subscribe to with FB Messenger
See the Docs
When triggered, hit your db to get whatever response is appropriate based on the context you have from the event, and anything in your DB.
Related
I integrated a Watson Assistant to my Website. To access the assistant, a user needs to log in. Now in my frontend, I know who my user is. When the user goes to the page with the watson assistant, I want to store some information of the conversation my user had with the chatbot. In my frontend I create the chatbot by including a provided script link.
When retrieving all Logs of the chatbot, I get all the conversations with conversation_ids and user_ids generated by IBM.
How do I map those IBM-generated ids to my application user-ids?
Can I somehow pass my application user_id to watson when opening the chatbot, so I can use Webhooks to post the conversation_id and my application user_id to the backend and save it there?
Or is there another way to do that? What are best practices on how to do that?
Or do I have to start conversations in a programmatic way, like described here?
The best way to send the user id to Watson Assistant is by using https://web-chat.global.assistant.watson.cloud.ibm.com/docs.html?to=api-instance-methods#updateuserid
You can then use pre or post message webhook to send to your backend your conversation_id and the user_id.
The user_id you have set via the above method will appear in context.global.system.user_id.
More info can be found at: https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-web-chat-develop-userid
So I created a ChatBot with Messenger API and I get the messages that has been sent to the Facebook Pages. I also get the unread_messages which is from "unread_count" but I couldn't find how to update the unread_count for each conversation. There is no answer for that in the docs.
It doesn't go away when i send message from my chat. It only goes 0 when I manually login to https://business.facebook.com/ and click the chat.
There is a "sender_action" parameter which has "mark_seen" indicator but it is only for visual seen. It doesn't do anything on the unread_count.
Do I have to handle this on my backend or Facebook API has the solution?
I have developed FB messenger bot using Microsoft bot framework. The bot is ready and approved by FB.
Now I am working on the hybrid part so human(web panel user) can take over chat and do conversation.
Now Issue is, I don't now which permissions need to read and show bot conversation in my web panel.
Also, it will be great if you can suggest that should I need to save conversation in DB to show in web panel or Is it possible that I can make a direct get request to FB API and show.
Thanks.
For FB Permission: pages_messaging
Development:
Show message: From our database.
Reply message: Using botframework
I have set up a welcome message to my chat bot on Facebook Messenger platform. Now I want to know when the user sends it's first ever message and handle this special case (typically by getting some more info about the user and storing it for future use and not query facebook graph API on every message).
Is there a special event when the user clicks the "Get started" CTA on messenger ? Any other easy way (except storing some data identifying the user myself) ?
This seems to be solved now with the latest additions from facebook:
https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button
So you can just enter the specific payload for the "Get Started button" and act accordingly.
I'm trying the recent released Facebook Messenger Platform and so far so good. Everything worked well and I was able to create a echo bot.
But I'm wondering how I could identify this user that started chatting in my page. For example, when a user started chatting I get a PID user (page specific user id).
Making the follow request to Facebook Graph API:
GET https://graph.facebook.com/v2.6/{PAGE_SPECIFIC_USER_ID}
I discovered that I can just ask for the following fields: first_name,last_name and profile_pic.
So my question is, how could I discover if this user is a current customer of my business page? Is there another way of querying more information (like e-mail and real facebook user id)?
Facebook has updated the messenger platform API (2016-07-01) and introduced a new feature called Account Linking. This can be used to identify a user who has created an account on your website via Facebook Login and you can link the two accounts. Facebook login has its own set of permissions which can be used to get a lot more information via Facebook graph API. You can find the complete list here.
Currently, there's no way to do this. The best way would be to prompt the user to enter their information in chat or give them a link to a mobile login page or some other way of linking their account to the chat.
Messenger Platform 2.0 introduce "ID Matching API" ,that will solve the problem.
https://developers.facebook.com/docs/messenger-platform/connecting-accounts
you can retreive a user information like below using fbmq library https://github.com/conbus/fbmq
# this method will occur when a message received from user
#page.handle_message
def message_handler(event):
user_profile = page.get_user_profile(event.sender_id)
print(user_profile) #first_name, last_name, profile_pic, gender ...