I was trying to set up a prod and dev environments for my bot app with Twilio channels tied to an Azure Bot when I started getting this error on my prod env.
Error: POST to 'https://sms.botframework.com/v3/conversations/..../' failed: [400] Bad Request
Steps taken:
The code is exactly the same between my prod and dev envs
Verified that the configuration parameters are the same among the two.
Checked that Twilio isn't getting any errors.
Routed calls locally to my dev box and looked at the address the msg is being sent.. looks fine.
Next
Will look into what the actual request.. hopefully it will help me figure it out.
Turned out the error was that when wiring up things on Twilio, I missed to correctly point the prod TwiMl App correctly to the right number. This can be done in Phone Numbers > Manage Numbers > Active Numbers
After that you should head to Portal.Azure.com and delete the Twilio channel to then add it again.
That fixed it for me. Cheers! :)
Related
I am trying to setup a WhatsApp bot using voiceflow, based on the tutorial found here. I've set this up before and everything has worked fine, but now I can't seem to configure the webhook.
The steps I'm performing are as follows:
Clone the repo here
Checked ngrok is installed (version 3.0.7), and its location (/usr/local/bin/ngrok)
Created a .env file at the root with the VERIFY_TOKEN, PORT, and WHATSAPP_TOKEN
Started the app from root with npm start
Started ngrok with ngrok http 8000 (the same port as specified in my .env)
Checked the resulting address works in the browser
According to the documentation, I then configure the webhook by adding "/webhook" to the end of the URL, and adding the same VERIFY_TOKEN as specified in my .env file. This, however, gives me the following error:
The callback URL or verify token couldn't be validated.
Please verify the provided information or try again later.
I've had a look around at similar questions here, but could not find what was wrong. I have also spoken to others who encountered similar issues over the last few weeks. This process was working up until recently (Nov 2022).
The error msg: The callback URL or verify token couldn't be validated. Please verify the provided information or try again later. usually means you are not returning a 200 response to the webhook origin. I would make sure your code is returning a 200 to whatsapp.
As an alternative, try to set the webhook on glitch as explained here:
https://developers.facebook.com/docs/whatsapp/sample-app-endpoints#cloud-api-sample-app-endpoint
so that you can check if your meta account is valid.
From what I have found it seems that feature is now behind a paywall. It worked fine a few months ago on the free tier of ngrok. So you will need to upgrade your ngrok subscription for WhatsApp to start validating. You can read about it here. Try using Cloudflare tunnel.
I'm trying to debug a bot locally on Bot Framework Emulator.
I've installed ngrok and I made it start with the emulator itself (using the settings provided by the framefork).
The bot starts correctly using npm start, so I've putted the URL on Bot Framework Emulator and I checked the debug mode.
As it starts the emulation stops here and looking at the ngrok traffic inspector I got this.
I've already tried to restart the framework, the bot itself and check if ngrok was already running (I couldn't find any clue about this), so any advice would be useful, thanks in advance!
I used to create a teams conversation bot in c#, and when I test it in local environment, I need to use ngrok to expose my service to the internet so that the bot service I created in azure portal can listen.
I used this command ngrok http -host-header=rewrite 3978, then I can get a 'https' url that is the same as localhost:3978 and set this url+'/api/messages' as 'Messaging endpoint'.
By the way, I need to set appId and app secret in appSetting.json with the value of my azure ad application created when creating 'bot channel registration'. I remembered that if I used error appId, ngrok will get 404 error.
=====================UPDATE=========================
As I really can't understand the error, pls compared your actions with mine and provide more details if needed.
I installed Bot Framework Emulator and test it locally. First I installed it, and I followed the tutorial to make the configuration. I used c# as I metioned above, so when my bot program running locally, it will show me the successful website with a url like 'http://localhost:3978/', so I open a bot in emulator like below, then click 'Connect', pls note here, I never did any other configurations such as set environment variable, all actions are included in the screenshot:
After these steps, I can reach it. By the way, if I didn't enter appid and secret, I will get an error 'Unauthorized', if I used wrong id and secret, an 'incorrect' error will appear.
You are using nodejs to compose a bot, so maybe the appId and secret can be found in .env?
I am following this guide to build NodejS bot using Gupshup whatsapp https://www.gupshup.io/developer/docs/bot-platform/guide/gupshup-bot-library-for-node
I am running the code and getting the ngrok URL:
But when following steps are given, I get an error as below:
Not sure what is wrong here. Please let me know how can I solve this issue?
Sometimes ngrok service can be not reachable (for any reason).
First - make sure you can open ngrok link in the browser or by curl and make sure it reaches your server api.
Also if your backend check incoming requests for specific app key in header, you should also add it to url params, due to you have no way to manage GupShup api caller.
for the first time setting callback you need to return a 200 status.
res.status(200).send('ok');
Use this as first line for first time for setting callback and after call back is set you can comment this out. And save and relauch your code (make sure address of your hosted code is same don't restart ngrok :P) is same
I have created a basic C# bot in Azure and have been doing some tests with it. I am able to debug locally and test that the bot works and responds normally, However, Web Chat does not seem to work (either the "test in web chat" within Azure or the embed code provided under "Channels" menu. The bot does not respond and the following can be seen in the browser's console:
botchat.js:20 WebSocket connection to 'wss://webchat.botframework.com/v3/directline/conversations/b00803da186843c08e057a03f1af26d3/stream?watermark=5&t=PdrKaTBDGps.dAA.YgAwADAAOAAwADMAZABhADEAOAA2ADgANAAzAGMAMAA4AGUAMAA1ADcAYQAwADMAZgAxAGEAZgAyADYAZAAzAA.PWqO6rz50wE.O0xFG-RkTZ0.306EPN7-0X_MGGfBUujpWoKN8Xm942hqpn_BVxbRe_M'
failed: Error during WebSocket handshake: Unexpected response code: 400
(anonymous) # botchat.js:20
This happens with any chat bot created in Azure even without any code changes but only when in my company environment, which is behind a proxy. I am almost certain that this is somehow the cause of the problem, but I have no clue why nor how I might approach the proxy team to report the problem nor what I may need to ask them to unblock.
The Question: Am I right to assume that this is a proxy problem or should I investigate something else and, if this is indeed a proxy issue, what do I need to do/ask to unblock to solve it?
Any help is highly appreciated!
This is definitely a Proxy issue, You can talk to your admin team and get these links removed from their firewall settings so you can get access. We do get this issue's in our company we do the same as i have suggested.\
Happy coding!!!
I am working towards a chatbot,with wit.ai and facebook messanger as the interface for it,The integrating process went error less and the curl -H gave
{success:true},but the bot does not respond if messaged,I looked all over it,may i know is it because of heroku for which this behaviour is seen,or the deployment platform does not matter at all,what can be the area or part that i may be missing out?
List of things i have already done:
1 create a story over wit.ai
2 a simple nodejs server code printing ("this is a bot").
3 after properly executing,wrote the whole bot.
4 deployed it to heroku
5 in Facebook Developer section,created apps for messanger.
6 setup webhook,after creating a verify_token,it shows "complete"
7 generate page token and put verify_token and page_access_token in heroku dashboard's "config vars"
8 subscribe the page
9 trigger it using curl and chat with the bot;**
*error: bot does not respond in the page
url/webhook -> bad request*
Can anyone give me some suggestions regarding this
I find it highly unlikely that there is a heroku problem. Did you try chatting with the bot without using witai? Also type heroku logs on terminal to see if there are some errors in your application. I used heroku to deploy my chatbot, and it works really well since you can find all the errors in the logs. I am not well versed with witai, but since it is just calling the bot, heroku shouldn't be the one causing the error