Integration with Twilio

I am facing a problem in integrating my app with twilio. My environment is 3 docker containers for rasa-NLU, Rasa-CORE and rasa-core-sdk and a 4th one for ngrok. They are all on the same network.

When I type in a text in the phone I get in my ngrok server:

POST /webhooks/twilio/webhook 200 OK

and my rasa_core

172.29.0.5 - - [2018-11-24 22:36:00] “POST /webhooks/twilio/webhook HTTP/1.1” 200 124 0.046605

But my custom action in rasa_core_sdk is not activated.

When I post from the command line then everything works as expected

rasa_nlu_1 | 2018-11-24 22:53:19+0000 [-] “172.29.0.2” - - [24/Nov/2018:22:53:18 +0000] “GET /parse?model=&project=current&q=in+Moscow HTTP/1.1” 200 609 “-” “python-requests/2.20.0”

action_server_1 | DEBUG:rasa_core_sdk.executor:Received request to run ‘action_weather’

action_server_1 | DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): api.apixu.com:80

action_server_1 | DEBUG:urllib3.connectionpool:http://api.apixu.com:80 “GET /v1/current.json?key=xxxxxx&q=moscow HTTP/1.1” 200 395

action_server_1 | DEBUG:rasa_core_sdk.executor:Successfully ran ‘action_weather’

In Twilio debugger I see a warning Warning - 12200. The other details in Twilio are: Message TextShow Raw

Msg “Content is not allowed in prolog.”
line “1”
sourceComponent “14100”
parserMessage “Content is not allowed in prolog.”
ErrorCode “12200”
EmailNotification “false”
cols “1”
LogLevel “WARN”

Response

Headers

X-Cache MISS from Twilio-Cache X-Cache-Lookup MISS from Twilio-Cache:3128 Content-Length 9 Date Sat, 24 Nov 2018 22:36:00 GMT Content-Type text/html; charset=utf-8

BodyShow Raw

In London

What could be the problem? Thanks

What happens if you send a CURL request with a twilio like payload to the /webhooks/twilio/webhook endpoint of the rasa core container?

I made is CURL request and this was the response

curl --request POST --url http://localhost:5005/webhooks/twilio/webhook --header ‘content-type: application/json’ --data ‘{“message”: “hello”}’

404 Not Found

Not Found

The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Strangely the “Hello” message gets me the right response when I send a text from the phone.

I have not made a CURL request for action-server response e.g. “What is the weather in London?”, since the basic CURL is itself not working.

Maybe I am making a simple mistake in the CURL request.

Another point, when I see the debugger in Twilio, it seems the header Content-Type is text/html; charset=utf-8 and not application/json

Was this ever resolved? If so, do you have any code on GitHub regarding Rasa / Twilio integration? I’m trying to learn how to integrate them and am not finding much in the way of documentation from the recent blog post from Rasa on the issue.

even I am facing the same issue now.

When I type in a text in the WhatsApp I get in my ngrok server and my and my rasa_core too,

but I am not getting the response back to WhatsApp.

What could be the problem?

Thanks in advance