What Callback URL should be for integration with FB messenger?

Hi,

I have installed Rasa X on Google Cloud Compute Engine using docker. I have configured SSL certificates and assigned domain name. So now I have URL like this https://domain_name.com/ When I open it in UI, everything is working (including custom actions). However, it doesn’t work, if I specify the same URL in Webhooks Callback URL for integration with Facebook Messenger.

I have the error:

* The URL couldn't be validated. Response does not match challenge, expected value="1903563423", received="\u003C!doctype html>\u003Chtml..."

I could see in docker logs:

rasa-x_1           | [2019-08-06 17:40:27 +0000] - (sanic.access)[INFO][172.19.0.9:59052]: GET http://domain_name.com/webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=729904826&hub.verify_token=token 200 3082
nginx_1            | 66.220.149.18 - - [06/Aug/2019:17:40:27 +0000] "GET /webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=729904826&hub.verify_token=token HTTP/1.1" 200 1542 "-" "facebookplatform/1.0 (+http://developers.facebook.com)"
nginx_1            | 2019/08/06 17:40:27 [info] 9#0: *191 client 66.220.149.18 closed keepalive connection

Hi @TatianaParshina ! sounds like it’s all set up correctly.

  1. can you please double check that if you do curl https://my-domain-name.com you don’t get any ssl errors?
  2. do you have the verify token etc set in your credentials.yml ? Facebook Messenger

Hi @amn41 , thank you for your reply!

  1. I have checked curl https://domainname.com and got a response.txt (3.0 KB) without SSL error. If I change the domain name to IP address, then I get the SSL error The URL couldn't be validated. Callback verification failed with the following errors: curl_errno = 51; curl_error = SSL: no alternative certificate subject name matches target hostname
  2. Yes, I have verify token, secret, page access in credentials.yml in /etc/rasa/ directory. Credentials were validated from my local machine and connection with FB messenger was done successfully.

Is there another way how to check logs? I use only docker-compose logs -f.

what happens if you run curl http://domain_name.com/webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=729904826&hub.verify_token=token on your local machine ?

I ran the provided command on my local machine.I got the same response (9.3 KB)

In addition, if I run curl http://www.domainname.com/conversations/default/predict -d ‘{“text”:“hi”}’, then it also returns html result, not json

I think you need to add /api to the url, so curl http://www.domainname.com/api/conversations/default/predict -d '{“text”:“hi”}'

@amn41 thank you for your reply! Actually the issue that I can’t connect Rasa X that is installed in Google Cloud in docker with Facebook messenger. Error:

> "The URL couldn't be validated. Response does not match challenge, expected value="251251277", received="\u003C!doctype html>\u003Cht...""

I can see in logs 200 response status:

> nginx_1            | 66.220.149.6 - - [05/Sep/2019:10:56:18 +0000] "GET /webhooks/facebook/webhook?h
> ub.mode=subscribe&hub.challenge=251251277&hub.verify_token=token HTTP/1.1" 200 1537 "-" "facebookplatform/1.0 (+http://developers.facebook.com)"

I use https domain name. I have verify token , secret, page access in credentials.yml in /etc/rasa/ directory. Credentials were validated from my local machine and connection with FB messenger was done successfully.

hi @TatianaParshina - the issue is definitely with the URL - seems like there’s no SSL issue. If Rasa X is returning HTML, what happens when you visit the challenge url in the browser? Did you iniclude the /api part in the url?

I had the same issue and i solved it using ngrok

Hi @amn41, can you please tell me how to integrate rasa chat-bot to skype?

Thanks!

hi @amn41, yes, I don’t have SSL issue.

  1. If I open URL https://doman_name.com/webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=1234402894&hub.verify_token=Token
    in the browser, then the page redirected to the main page https://doman_name.com/conversations
  2. I am not sure why I need /api part in Facebook integration. But I have tried to open https://doman_name.com/api/webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=1234402894&hub.verify_token=Token
    Reply: Not found.

My credentials.yml file in the directory etc/rasa/ has:

facebook:
  verify: "Token"
  secret: "xxxx"
  page-access-token: "xxxx"
  
 rasa:
  url: ${RASA_X_HOST}/api

My endpoints.yml file in the directory etc/rasa/ has:

action_endpoint:
	url: "http://app:5055/webhook"
	token: ""

Hi @TatianaParshina - sorry the correct thing to add to the url is /core , so it should be:

domain-name.com/core/webhooks/facebook/webhook

we really need to improve the documentation there, sorry about that!

@amn41 thank you a lot! It works now!

Correct working URL:

https://domain-name.com/core/webhooks/facebook/webhook

Hi @TatianaParshina ianaParshina

At rasa: url: ${RASA_X_HOST}/api

Did you use the external IP/api or kept as ${RASA_X_HOST}/api?

Thanks

@amn41, i have deployed my bot over GCP using Docker

i have added domain name and ssl

now i am using

https://domain-name.tk/core/webhooks/facebook/webhook

as my callback url. but i am getting an

Error

The Callback URL or Verify Token couldn’t be validated. Please verify the provided information or try again later.

i have tried these command but nothing works

CMD [ “run”,“-m”,“/app/models”,“–credentials”,“/app/backend/credentials.yml”,“–enable-api”,“–endpoints”,“/app/backend/endpoints.yml”,“–enable-api”,“–cors”,“*”,“–debug”]

CMD [ “run”,“-m”,“/app/models”,“–credentials”,“/app/backend/credentials.yml”,“–enable-api”,“–cors”,“*”,“–debug” ]

CMD [ “run”,“-m”,“/app/models”,“–enable-api”,“–cors”,“*”,“–debug” ]

can you help me.

hi @Paras ! since this was causing some confusion, we removed the requirement to add /core to the url , so just https://domain-name.tk/webhooks/facebook/webhook should work

@amn41 this https://domain-name.tk/webhooks/facebook/webhook is also not working

i have deployed my bot over gcp using docker

do i need to expose any port, if yes then how?

i am getting this on gcp console

nginx            | 173.252.107.120 - - [26/Aug/2020:12:00:48 +0000] "GET /webhooks/facebook/webhook?hub.mode=subscribe&hub.challenge=570110704&hub.verify_token=Token HTTP/1.1" 4
04 164 "-" "facebookplatform/1.0 (+http://developers.facebook.com)"

do you also get a 404 if you curl that endpoint from inside your gcp instance?

yes, Page not found