Hello, I have write the dictionary to show the sender action in fb messenger but it is not showing. I am attaching the code
—This is how i have wrote it
Thankyou so much in advance for the help
Hello, I have write the dictionary to show the sender action in fb messenger but it is not showing. I am attaching the code
—This is how i have wrote it
Thankyou so much in advance for the help
Have you tried adding the recipient ID inside your JSON like in the image below?
I believe you can get it with tracker.sender_id
Please, let me know if this works for you because I’m facing a similar problem.
Same issue
I finally found a solution for this. You will have to edit facebook.py file (located here). Go to line 150 where send function is defined and add this:
import requests
body = {
"recipient": {
"id": recipient_id
},
"sender_action": "typing_on"
}
headers = {'content-type': 'application/json'}
requests.post(url=url, data=json.dumps(body), headers=headers)
The url variable should be
https://graph.facebook.com/v5.0/me/messages?access_token=<PAGE_ACCESS_TOKEN>
with your page access token.
I am having issue with the access page token {“error”:{“message”:“Invalid OAuth access token.”,“type”:“OAuthException”,“code”:190,“fbtrace_id”:“AhSrP_dam-WADDe7GjG5w9B”}
I am getting this, can you help me in this matter ? @stavr
Are you sure you are entering the correct token for your page? You can find details here on how to generate a token for your page. If that’s not the case, then make sure you are replacing the <PAGE_ACCESS_TOKEN> part of the url only with your page token.
e.g:
https://graph.facebook.com/v5.0/me/messages?access_token=YOUR_TOKEN_HERE
“recipient”: { “id”: recipient_id }
→ the recipient id is the app id right? as in image below:
No, the recipient_id is the id of the user that send you the message you’re about to respond.
This code should be written inside the send function which is on line 150 of the facebook.py file. Sorry if I wasn’t clear on that before.
{“error”:{“message”:"(#100) Parameter error: You cannot send messages to this id",“type”:“OAuthException”,“code”:100,“fbtrace_id”:“ACGJkxp3R1E9wylwjhgfzvx”}}
This message is coming now
Where do i find this url in my project? rasa/core/channels/facebook.py
@stavr Do you know how to get PSID that will act like a recipient id
You can find this url by opening a terminal and typing pip show rasa
. This command will show you where rasa is installed in your system.
Can you please paste a screenshot from the changes you made to facebook.py file? Make sure you don’t include your page access token though.
facebook.py should be located in:
C:\programdata\...\site-packages\rasa\core\channels\facebook.py
If you find it there (hopefully) you should open it and change it like this:
This method is located inside class MessengerBot
. Your’s might be in different lines due to some changes I’ve made in my file.
Are you called the method to call the access_page_token or just adding the hard code value of access_page_token in the url variable
This is how i have added the sender option but it still not showing any sender option.
I use page access token hardcoded in the url.
The only difference I see in your url against mine is that you use v2.6
while I use v5.0
Can you try with v5.0 and see if it makes any difference?
Yes, brother it worked Thankyou so much. I need to ask that if you have worked on handover protocol?
Glad I could help you @jehanzaib12! I haven’t used handover protocol in my chatbot yet.
@stavros do you know how do i save the receipient id from rasa.core.channels.facebook, actually i want to use it in my rasa class or function>