I made a controller in laravel for WhatsApp webhook authentication, run it locally and use ngrok to connect it with WhatsApp webhook, it won't connect, it said "The Callback url or verify token could not be validated", but when I deploy it on heroku it working normally.
Is there any special config so I can connect it locally using ngrok ? or is there any alternative solution?
Went through the same issue and it seems that WhatsApp Cloud API considers NgRok malicious, and won't accept it as a callback webhook endpoint.
You need to follow the steps provided in ngrok documentation,
https://ngrok.com/docs/integrations/whatsapp/webhooks,
I am not sure which step you are missing or have a problem with, but as per the error "The Callback url or verify token could not be validated", your deployed code for webhook is not valid as per the provided guideline in WhatsApp webhook docs.
Make sure you have set the same verification code in the code and webhook verification when you configure!
According to the ngrok docs, you need to have a pro or enterprise license for validation to work. A free alternate solution for anyone that may need it (at least at the time of writing) is Cloudflare tunnel. Just read the docs or you can watch this video(CLI version) or video(dashboard version) to help you set it up. You will need to have a domain though.
Related
I'm having a pretty basic problem - trying to upgrade my botkit app from 0.7.x -> 4.x.
I've used yo botkit to generate a new v4 bot, according to these instructions. Now that I try to configure the bot with slack I can't verify the events api the same way I did with the v0.7 bot.
When I go to slacks events api url and try to verify a request url, my node app is responding with a 404 not found error.
Looking at the code, it seems that the endpoint for /slack/receive which slack is trying to access is indeed removed from the code.
This prevents my bot from listening to messages and responding to them.
When I was configuring the bot in v0.7.x, I just cloned this repo and followed these instructions, but when I try to follow these instructions with the starter provided for v4.x the guide fails and I can't find a more relevant one.
Any idea what I'm missing here?
The url has changed in v4 - it is now /api/messages
I just started to work with Google API's (Calendar and Gmail for now). I already got both examples working on both my Frontend (React) and my Backend (Java - Spring).
I have the following doubt, If I want to enable users to be able to send email's using the oficial API not javax.mail should that be done on the Backend or it can be done on Frontend? Since the official documentation only shows examples on Java and Python.
If the answer is on Backend how will users be able to authenticate via OAuth2 If they are "not supposed" to see server-side information.
Thanks
Ok for does looking for an answer. I found the following guide...
https://developers.google.com/identity/sign-in/web/server-side-flow#step_1_create_a_client_id_and_client_secret
Basically you can get a client-side one time access code which is send to server-side where it can get a long-live access_token in order to have offline access once correct authentication has happened.
I am trying to register my Bot at https://dev.botframework.com
However, when I put https://localhost:44338/api/messages in the
Messaging endpoint field I get an error - Endpoint URL has an invalid
value. My bot is running locally on https://localhost:44338.
Also is there any way I can create my own web client which can
communicate with my Bot.
Is Bot Registration mandatory for it to be deployed in production.
It looks like you're trying to register your bot with your local instance whereas you need to use a deployed (production) instance.
Publish your bot to Azure and use the URL you get from that. In Visual Studio you can right click your project and select "Publish"- just follow the instructions from there.
You can make your own client, yes. You can use your browser or anything else to make HTTP requests to your production bot.
You need to register your bot if you're using the bot connector.
Hope that helps.
I am working on Bot framework technology, recently Microsoft announced the new version (V3) of bot.
I was already developed bots using old version, now I am trying to upgrade my bots to newer version.
For that everything working fine but after published my bot into azure, then by using the publish URL I am trying to test in bot framework channel emulator (3.0.0.54) it gives always "500, internal server error".
But when I added skype channel to my bot then it will working fine.
Only the problem is when I am testing in bot framework channel emulator with Published URL of my bot application, then only I got the error as "Internal server error".
I think there may be problem with latest version bot framework channel emulator
Please download the file from https://ngrok.com/download
Unzip the file and use command prompt to run the below command
ngrok http -host-header=rewrite 9000
screenshot
As seen in screenshot copy Forwarding URL with https and paste it in Emulator url
Emulator port should be in 9000 and emulator Url should contain ngrok forwarding Https URL
Note :ngrok should be in running state .if your getting same 500 error while trying next time please start from step 1.
For more reference .https//docs.botframework.com/en-us/tools/bot-framework-emulator/#navtitle
I discovered that a single public method apart from Post in Controller makes Bot Framework throw 500 InternalServerError. Simply keep only private and public Post method in your Controller and that should fix it.
Druing the debugging, you just dont disable the appid and password, rather make them blank and rebuild the same , you will be able to debug via emulator
Keep like given below
Dont just disable the BotId,AppID, Password rather make them blank like given below
<add key="BotId" value="" />
<add key="MicrosoftAppId" value="" />
<add key="MicrosoftAppPassword" value="" />
ngrok solution did not work for me. I just commented the botAuthentication and then it worked for me locally.
//[BotAuthentication]
public class MessagesController : ApiController
{
They just released an updated version of the framework (3.0.1) that addressed a few issues introduced with 3.0.0. Try updating to 3.0.1 and see if that will solve your issue (it fixed mine).
source
You may also need to follow this tutorial and use ngrok to allow you to access your published chatbot from the emulator. There is a screenshot in that tutorial that shows the BotId being used in the emulator, its not required so you can omit it.
The developer posted an answer on this thread.
Basically you can type 'disable' to disable AppId/AppPassword
It seems that if you deploy your bot to the cloud and try to test it from the emulator it will give this error.
The emulator seemed to work in 2 cases:
1- Localhost with security disabled (remove appid and app password)
2- localhost with security enabled (add appid and app password)
both endpoints via http only because it's localhost. If you deploy to the cloud you can test it in the emulator available on the Bot Portal. Make sure the endpoint for the hosted bot is https enabled.
I followed the steps in this troubleshoot guide and it fixed it for me: https://learn.microsoft.com/en-us/bot-framework/troubleshoot-authentication-problems
I didn't understand what actually caused the problem though. What I noticed was: desktop emulator works with localhost only.
I started using Microsoft Bot Framework and followed step by step all tutorials.
I has been able to register a new bot and to deploy it working good with emulator, but except it nothing else works.
Test connection to your bot chat do not works despite I get answer from emulator and from all connected channels, that where created and registered properly I always get an Unauthorized response or something like that, anyway no response, so nothing works.
I tried with Twilio, Web Chat, Telegram (Skype auth is pending) getting always the same response.
As it seems I strictly followed the tutorials, is there something else to do or to be approved? Or just the service is still not working at 100% as too young?
Thanks
If you are using HTTP you need to disable basic auth because the connector won't send your appSecret in the clear.
The solution is to make sure you register as HTTPS, or if you need to use HTTP then disable the basic auth.
Took me a while to get it working locally too. Oddly for me it only works when those 'secret' fields are empty, as mentioned and running in debug.
Running without debugging seems to always result in a 401
Hi I was facing same problem to work bot locally in v3. I just made everything blank in web.config and it is working.
I solved the problem.
It was related to https. It's not well explained into tutorial but when you create and publish a service in Azure it is created as http://XXXXXXX.azurewebsites.net as shocased into tutorial, but it will not work as your service must run in https.
I so used https://startssl.com to create a free ssl certificate then turned on SSL into my Azure service so everything started working.
I've cleaned up the getting started with the following; hopefully it will make it clearer for the next person who uses it:
Click the “Register a Bot” button and fill out the form. Many of the fields on this form can be changed later. Use a the endpoint generated from your Azure deployment, and don’t forget that when using the Bot Application template you’ll need to extend the URL you pasted in with the path to the endpoint at /API/Messages. You should also prefix your URL with HTTPS instead of HTTP; Azure will take care of providing HTTPS support on your bot. Save your changes by hitting “Create” at the bottom of the form.
Make sure you are using HTTPS. BotFramework will not work with basic auth so tokens are not passed in the clear.
See: http://docs.botframework.com/connector/calling-api/
Make sure that you republish your bot service after registering and getting the app Id and password. If you fail to do this you will get Unauthorized. The steps are 100% clear on this and I hit this for a minute.