Not able to verify callback on Gupshup WhatsApp APIs - node.js

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

Related

Error when setting up webhook with Ngrok/WhatsApp

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.

IBM Watson Assistant: Access issues when using ngrok for webhook URL

Good morning everyone. I am developing an application that uses the watson assistant webhook by sending some parameters to a server, which analyzes the parameters and based on these sends a response to the application and to watson itself.
Well, it turns out that I was using ngrok to do this test by placing the parameters in watson, until a few days ago I couldn't (or it doesn't exactly let me) make the request.
Error
Cannot create property 'transactionId' on string ' Access Denied Access Denied You don't have permission to access "http://us-south.assistant.watson.cloud.ibm.com/rest/v2/skills/ on this server. Reference '
I have tried other applications that allow me to do the same work as ngrok, but I am new to this and it is very complicated. LOCALTUNNEL solved my problem temporarily, but later it didn't work anymore. I also tried with portmap.io, serveo, pagekite, smee.io among others and I still can't perform my requests.
I would really appreciate any help with my problem. Thank you very much.

Snaplogic REST POST Snap: Failing with SSL error

I am trying to post a simple json to our backend api through REST POST snap. Everything was working. And then we changed the url to a new url and I updated the url in the snap.
But now request is simply not reaching our new api server.
In fact, the snaplogic pipeline also completes successfully, with all snaps turning green. Only when I click on the properties of pipeline, I get to know that REST POST snap has failed, with attached screenshot error.
Please note that we are able to reach the new api server via postman or any other rest client. Nothing has changed at all except for the url.
Can you please help me understand, what exactly is going wrong and where? How to debug this?
Just for everyone's reference, I was able to find out the root cause.
Reason was that the api url was not accessible to snaplogic pod running in our enterprise because of Zscaler firewall.
The confusing part here was the error message returned which says "SSL issue, connection was reset". So if you see issue saying "Connection was reset", assume that snaplogic is unable to access the url as the first problem. Only after making sure, it is not the case, go and look for what exactly the error says.

A third party application may be attempting to make unauthorized access to your account - Ameritrade

I was trying to do some simple authorization for ameritrade's developer platform. I was attempting.
According to the platform, the Endpoint I need to access is is:
https://auth.tdameritrade.com/auth?response_type=code&redirect_uri={uri}&client_id={client_id}}%40AMER.OAUTHAP
https://developer.tdameritrade.com/content/simple-auth-local-apps
When looking at the client_id, for the dev application, I was noticing that they may actually be referencing the Applications, Consumer Key instead? So i did just that, but when attempting to query the information, it returns: A third-party application may be attempting to make unauthorized access to your account. The reason why i think it is the consumer key, is listed at: https://developer.tdameritrade.com/content/getting-started
So I ended up doing something like:
from urllib.parse import urlencode, quote_plus
url = "https://auth.tdameritrade.com/auth?response_type=code&redirect_uri={uri}&client_id={client_id}}%40AMER.OAUTHAP".format(
uri=urlencode("http://localhost", quote_via=quote_plus),
client_id="JHBDFGJH45OOUDFHGJKSDBNG" #Sample
)
I dont think this is because I am currently in a different country currently, I think that something else is wrong here.
It doesnt follow through with it, but instead returns a 400 error with that information. Im not sure whats wrong though.
This happens when you copied the callback URI incorrectly. Imagine if this were a client application, and TD detected that the application is trying to send the user to a different URL than the app is configured with. If they send the callback request to that application, it will receive the token and gain full control over your account.
Have you double and triple checked that you're copying the callback URL correctly, protocol name, ports, and trailing slashes and everything? Also, consider using an API library instead of writing your own. You can find documentation about this specific error here.
I had this issue and I solved it using simply using http://127.0.0.1 on the call back URI of the App.
I then used below URL and it worked as expected.
https://auth.tdameritrade.com/auth?response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1&client_id={MyConsumerKey}%40AMER.OAUTHAP
Just in case anyone is still having this problem, make sure the callback URI is spelled EXACTLY the same as you specified when creating the app. I was having this problem because I set the callback on the TD developer website to "https://localhost/" and used "https://localhost" in the URL instead (missing the slash at the end). As soon as I added the slash at the end, it worked.
I found out that the issue is caused by the way the callback URL is set. It have to be exactly the same as the callback URL you have typed in at the apps details on the TD developer API page. I tried several permutations and indeed to get the authorization to work both have to be the same. eg. https or http.. end with '/' or does not, it matters. There is also no need to URL encode it.

Slackbox - the requested URL could not be retrieved - access denied

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.

Resources