I have a BotFramework v4 deployed in Azure using the virtual agent template and have been trying to POST to the endpoint to have a message sent to users in Teams but the response received is a 400 Bad Request. We can perform a POST using Postman with the same information and it will post without issue. The Bot is deployed using C# while the software we are using requires node to perform the fetch/https request.
Local testing of the code is below with some information redacted. Tried using HTTPS request as well and got the same results of 400 Bad Request
Update
We got an HTTPS request working in local testing but once published to Azure and sending the POST to the Azure url, we get a 200 response but the POST is not going to the MS Teams conversation as expected. Application insights shows no errors.
Update 2
Using live metrics found that when sending the POST to the bot this is the error received:
System.ArgumentNullException: Value cannot be null. (Parameter 'clientSecret')
at Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential..ctor(String clientId, String clientSecret)
at Microsoft.Bot.Connector.Authentication.MicrosoftAppCredentials.b__14_0()
I'm currently building a website with Vue.JS as my static frontend and writing a separate backend API hosted in the cloud using Node and Express.
Currently, I want to integrate payments with a payment provider called Swish. The way this API works is that a payment request is issued from the client with a Callback URL that Swish calls when the payment Errors or is Paid. This URL will be a post request to my API. I want to know how the "Create Payment Request" can asynchronously wait for the post request to be issued by my payment provider so that it returns when Swish (payment provider) is done processing the payment and I can then update the status of the payment in Vue to the user.
I haven't managed to solve this without polling yet. A simple solution would be to have the Post request that Swish visits update some state in my SQL database and have the "Create Payment Request" wake up every 10 seconds or so to check if the database has been changed. Is there a way to do this without polling? Could I somehow emit some event to wake up a sleeping Express endpoint from another Express endpoint? Or could I pass to the callback URL some webhook or something so that the Swish callback can directly notify my Vue frontend when it's called?
For timescales, it takes a maximum of 3 minutes for Swish to call the callback URL.
I think Websockets should work for your problem. As you already said you should persist the state of the payment in your database. When the Swish app calls your callback url you send an websocket request with the new state and needed information. The state is needed when the websocket connection is recreated due errors in the communication.
Some links which may be usefull:
websockets/ws
nathantsoi/vue-native-websocket
sockjs/sockjs-client
stomp-js/stompjs
I am sending request in amazon using GetReport API.
As per amazon document we can send only 15 request per minute.
How can get from amazon how many number of requests are pending ?
Amazon is providing any API to get this details ?
We are following below amazon document.
http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReport.html
There is a separate page describing how request quotas (and therefore throttling) work: http://docs.developer.amazonservices.com/en_US/dev_guide/DG_Throttling.html
This issue has been posted many times before but I haven't found a solution yet. I've contacted Instagram Developer support but a week later I've still had no luck or a response form them so hoping someone here can help me out. My app has been approved by Instagram for basic permissions.
Doing a Form POST to https://api.instagram.com/v1/subscriptions/ with all the relevant data (callback_url, object=user, aspect=media, verify_token, client_secret, client_id) to create a subscription for Instagram User Subscriptions yields the error: APISubscriptionError - Unable to reach callback URL
The callback URL I'm using has logging on it to log all requests which works
when accessed directly via a browser. Using the logs I can see Instagram isn't even reached my callback URL.
The callback URL is accessible publicly over the internet and the domain is being used in production.
The callback URL implements both GET and POST methods (even PUT just in case).
Worked a few weeks ago using a UAT URL.
The callback URL still returns the 'Unable to reach callback URL' with http or https.
I've changed IP addresses, used a VPN and run the post script form different locations.
Tried different parts eg domain.com/instagram/subscriptions or
domain.com/instagramsubscriptions
-Tried a different sub domain and different URL.
Have deleted all subscriptions using the DELETE request
Any help or suggestions would be greatly appreciated.
The application is as follows:
First of all, I`m using a node.js app with the express.js framework as web server. On the front-end, when the user sends a payment via a POST form, the express.js routes this task via 'app.post' and calls an external API for payment. This API request should ideally return the URL for which the user should be redirected for payment. Then, the express.js should redirect the user via the 'app.post' response variable (res):
res.redirect(307, url);
Since this payment API request takes some time and since I am using Heroku, the API request times out and an error is returned. To solve this, I know I would need to set a worker on an worker Heroku add-on (according to https://stackoverflow.com/a/11438381/2859410), such as IronWorker. However, I am having trouble to understand what would be the proper mechanism to communicate the URL returned by the external API request made in the worker back to the node.js app.
To make things clearer:
- The user submits the payment form.
- The node.js app processes the POST data and calls a worker ("enqueues" a task on a worker).
- The worker requests an external payment API, which returns an URL.
- The worker should communicate this URL back to the node.js app.
- The node.js app should receive this URL and redirect the user.
Yet, these operations have to be non-blocking.
I can think of 2 alternatives for the communication:
Alternative 1 - When the front-end user requests a payment via POST, the node.js app calls the specific worker (also via POST), with the payment data as the payload. The worker process the data, requests the payment API and gets the payment URL. Meanwhile, the node.js performs a polling of the worker status and, when receives the "completed" status, redirects the user.
Fallacy: The difficulty here for me is to perform constant polling in a asynchronous manner. Since I need to redirect the user to the payment URL, I would need to have the URL inside the "app.post('/form', function(req,res) {" method, such that I can the response ("res") to redirect the user.
For this, I took a look at async.whilst(test, fn, callback), but I don`t know how could I use a test function that is synchronous. My immediate idea would be a test function that issues a status request and a callback function that redirects the user. However, this test function is an asynchronous operation (for example using 'request' module).
Alternative 2 - The worker also receives the payment data as payload, process the data, requests the payment API and gets the payment URL. When it finishes, it communicates the URL back to the node.js app via an HTTP request.
Fallacy: How would I tie the URL communicated back to the node.js app to the user that requested the payment? In my understanding, the HTTP request with the payment URL would have an independent route than the form POST route. In another words, this way I would not be able to have the payment URL inside the "app.post('/orderform', function(req,res) {" method, and, therefore, would not be able to use response variable ("res") to redirect the user.
Tha node.js app would be structured as follows:
app.post('/order', function(req, res) {
// user data on req.body
// process data and request payment API
// Wait until URL is communicated to the endpoint belo '/url'
// receive URL from the other endpoint and redirect user
}
app.post('/url', function(req, res) {
// receive payment URL on req.body
// communicate the URL to the '/order/ endpoint
}
What would be recommended in this case?
Thanks in advance.
I would suggest using a service like pubnub for this (http://www.pubnub.com/) . When you get a request from the user add to the queue to process it and create and return a token to identify this work request. Send that token back to the client. Use that token as the pubnub channel to listen on. When the worker finishes, send a message to that same token to let the client know that the work is done.
I'd suggest to use something in between these two alternatives.
You receive request from user and queue worker to process it.
You start polling some internal storage (e.g. database) for the results of request.
When worker need to store result, it calls back your app (different endpoint) which stores data in the local storage (that place where polling operation looks for it).
When data is available, you'll be able to redirect users.