Last year, I was able to use ngrok to debug a webhook on api.ai (now called DialogFlow) by rerouting a public URL to a port on localhost.
Now, it simply won't work. I get the message "Error: Failed to parse webhook JSON response: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $."
The ngrok session shows "301 Moved Permanently" when DialogFlow executes the webhook, but the app is never reached.
Dialogflow treats responses besides a "200 ok" as a possible error. Using ngrok still works, but you should point directly to the URL of the webhook rather than the URL of something that will redirect to the webhook.
Related
I'm able to verify the webhook using glitch from the getting started:
https://glitch.com/edit/?fbclid=IwAR2YTjZuGGM9Hi6T_v1eZh_nV6_HY3RYn_8lll4gY1REa_bJy6ZAuq6tkKQ#!/whatsapp-cloud-api-echo-bot
my local server (in a subdomain with https enabled) has the same behavior as glitch and show "WEBHOOK_VERIFIED" on the log for the request:
/webhook?hub.mode=subscribe&hub.verify_token=xpto123&hub.challenge=123
but when try to verify my local server the request from meta does not reach the server.
chrome showing that the connection to the server is secured
After more tests I found that my local server was been blocked by the ISP, understood it after test with another connection.
I made my own server and had tried ngrok and other programs to run it from local host with https redirect but whatsapp doesn't allow the use of those programs.
In the end, my error was that the URL HAS to end in /webhook or else, it won't even send the request. Then it'll send a GET request and you have to return the hub.challenge query param after making sure that the provided token from them is the one you set up. This is my code using NodeJS
if(req.query['hub.verify_token'] === process.env.VERIFY_TOKEN) return res.status(200).send(req.query['hub.challenge'])
I tried to make LINE bot based on this site:
https://www.casleyconsulting.co.jp/blog/engineer/3028/
I got an error when I push verify button.
The webhook returned an HTTP status code other than 200.(503 Service Unavailable)
Confirm that your bot server returns status code 200 in response to the HTTP POST request sent from the LINE Platform. For more information, see Response in the Messaging API Reference.
I αm not sure how to fix this problem.
First of all, what link did you put on the Line Developers website? You might have forgotten the /callback at the end...
Else, have you tried to send a message without verifying?
And the last question: did you write that command?
heroku git:remote -a {HEROKU_APP_NAME}
If you didn't try it before your git add . command.
I have run my bot locally (success)
I have set ngrok (success)
I have tested the remote url (success)
I have added Direct Line webchat to my local running site (success)
I have set up Direct Line and used this secret in my webchat (success)
However, I still get the old bot response (hosted on Azure)
So I have gone to the bot framework website --> my bot --> settings --> Messaging endpoint and set the URL as my ngrok address
It seems to be saved, but I get a strange popup saying
CorrelationID : SHUjnuhs=
Or some other random shortcode.
Seems to be an error from API/botmanager and response to an error 500
Just wondered if there is something else I am missing here in order to get direct line speaking to my locally running bot
Usually, that error means that the messaging endpoint has a space at the beginning and so it's not being saved (that's why you are seeing the old message). Reload the page, and before saving make sure there is no space at the begiining of the url.
I am trying to get a shopify webhook to fill my customer class in parse.com, however something must go wrong. I don't know how to verify the parse response since Shopify sends this webhook out from it's ruby backend. I used requestbin to catch the webhook and I replicated a post request using postman to my parse url and everything works fine. Does anyone know how to debug requests like these? Is there a console in Parse where I can see all the incoming requests and the responses Parse.com sent back?
Try using Runscope for debugging webhooks. Full guide here: https://www.runscope.com/provider-guide/troubleshooting-webhooks - this is more than just a request bin. It's a full transparent proxy that will, like a bin, record the webhook notification, but will also pass it along to the intended destination (your webhook receiver) and record that response as well.
My push client sends the URI to my web service, by using the URI, from my web service, I am able to send toast notification to my app installed on Emulator. But if I use the device URI and try to send a message to the device from web service, I get 404 as response. Can anyone tell me What the issue could be ?
Assuming you aren't having any problems receiving and storing the URL your physical device sends to your service, and that you are sending messages to this URL, the only thing I can think of is something I noticed during testing. On occasion, if a malformed message is sent to the URL, it appears to go into a faulted state and any subsequent message (even if well-formed) sent to the service returns a 404.
I don't know if this is expected behaviour or a bug - I resolved it by fixing the malformed messages I was trying to send, and refreshing the channel from the device.