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?
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 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've deployed a node.js chatbot (built using Microsoft Botbuilder package) as an Azure web app. As seen in the attached image, the conversation in channel emulator(same with web chat) goes on smoothly until there's a db call. The part were the intent handler tries to do db call, the bot responds with the default error text(I didn't understand. Please try again.).
Interestingly, if I type in something random( like a Hello) in response followed by the query again, the bot goes ahead with the db call. This scenario is shown in the attached screenshot.
Strangely, the issue doesn't happen when I work on the bot locally or deploy it outside Azure (say AWS).
My question is how do I figure out what exactly is going wrong here ? I have been going through the logs in the Diagnostic Console(Kudu) of my Azure web app, but no pointers in any of the logs. Any help is appreciated!
edit: Got it fixed by following the steps from this link
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
I have slackbox running locally, have created a Spotify dev application and have successfully authenticated slackbox. It says I am logged in at http://localhost:5000/. All of my variables have been set, including the slack token, in an .env file via dotenv.
All seems well there.
On the slack side, I have created a slash command mapped to /spotify that POSTs to http://localhost:5000/store. The slash command shows up in my command description list when typing.
When I attempt to use it though, I get an access denied message in chat, I'm assuming due to cross-domain issues:
ERROR: The requested URL could not be retrieved Access Denied.
According to their docs - https://github.com/benchmarkstudios/slackbox - running this locally should work. I also run a Hubot bot locally and it integrates fine with the same slack room.
Any help is appreciated!
https://sprint.ly/blog/5-steps-to-a-slack-integration/
Slack’s outgoing slash command requests need to be sent to a public facing url, which is a problem if we want to receive these messages to our local development server.
How do we solve this?
One way is with the use of a secure tunnel which acts as a public HTTPS URL for our local development server. Problem solved!
Who provides this service?
ForwardHQ provide the best user experience, including a browser extension for setting up a local tunnel in one click. They have a free 7 day trial.
My preferred option is ngrok. It’s free for one concurrent tunnel client, with no time restriction. Woop! Its a little harder to use but it does the job.