Uber API Reporting: Reference between Report Request and Report Success Notification - api

We want to generate Uber Eats reports for multiple customers. Since everything is running on one system, the webhook notification for report generation will all arrive on the same local API.
Now wondering if there is a relation between the webhook notification and the original report request?
The reason is that we would like to check the signature of the notification and for this we need the appropriate client secret. Also we want to mark the original report request as completed.
So we need to be able to associate the notification to the right client or at least to the report request.
Is it possible that the workflow id we receive with the report request is included in the notification?
Or is the job_id what I'm looking for? In the notification example this is not so clear to me.
Do you have other ideas here?

Related

WhatsApp cloud API sending old message inbound notification multiple time on my webhook

I'm new in using WhatsApp cloud API, I've set up one webhook with my WhatsApp cloud API.but the problem is that after some time it sends an inbound notification of an old message again to my webhook.
If a notification isn't delivered for any reason or if the webhook request returns a HTTP status code other than 200, we retry delivery. We continue retrying delivery with increasing delays up to a certain timeout (typically 24 hours, though this may vary), or until the delivery succeeds.
Whatsapp webhooks documentation
I will share my experience and maybe it can help some of you.
I was returning the status code 200 from my server. But Whatsapp Api Cloud still returned 15 notifications per message.
the problem was that in the past, maybe one month before. I had actived webhook messages notifications, but I didn't respond with the status 200. meanwhile I was building the sending messages backend logic. so , there were thousands of webhooks no responded with the Status code 200. So my facebook app went crazy, and when I decided to respond with the status code 200. it didn't work.
the solution was to create another facebook app. and the webhooks worked well.
Had the same problem, tried to delete the app but didn't work, I was still receiving old messages from the old app.
TLDR; don't use the same test number with more than one Facebook App.
Even creating a new app, Phone Number ID and Account ID were still the same, my speculation is that the webhooks payloads are tied more to the test phone number rather than the Facebook App.
For this reason, if you have another application with the same test number and a not working webhook, it keeps sending the same messages to both webhooks.
Within the POST defined in your Webhook, you should always return HTTP Status 200, check that this happens even within your Promises
Webhooks for WhatsApp Business Accounts

REST API design for endpoint with notification

I am creating an API endpoint which takes a customer order, create the order and send email notification. At our current design once we successfully create the order, we send a success notification 201 to client and then make a call for our internal email api. Upon getting success notification from us the client app shows users a message to check his/her email.
I don't feel comfortable with this design because if for some reason the email sending method failed there are no way for client to understand this. On the other hand if we wait for to successfully the send the email and then send client app success notification it takes longer times.
So what is the right approach for overcoming this problem?
I think your design works. Why would the client care if the mail service is not working? If the order passes all validations on the server and is persisted I would treat that as a successful state and return 201 Created.
When the client gets 201 Created, then do what you say; give the user a message about checking their mail, but tell them that they should have some patience. Something like:
Your order was submitted. Please check your mail. If you haven't got a mail in 24 hours please contact us, "or whatever other solution here".
You have no control on what time the mail will arrive at the users mail box anyway since mail sending is not a synchronous process.
Remember: Seperate your conserns.
202 Accepted would usually be the most appropriate response for a request which requires further processing. In your case, however, this might not be right because the email is not fundamental to the resource creation.
201 Created is perfectly acceptable for you because the order has actually been created. However, as the spec says, you should return a Location header with the URI of the created resource and an entity describing how to access the resource. That should get around your issue with a mail service failure - the client can still access their order and, to be honest, e-mail is not guaranteed delivery so I'm hoping that the email isn't an absolutely required part of your business process.

How to push something to user in a rest API?

We already have a system in place that uses Restful APIs in order to send let's say SMS. All of our clients are using our server to send their requests to Rest API so we drop connections except our server IP to handle authentication.
Now policy has been changed. We want to expose our APIs to the outside world. We now want to be able to push to user under specific circumstances. Let's say that I want to send a delivery report to the user when SMS has been delivered. Or when something has been scheduled for a specific time, when that time arrives user get notified.
How to handle these notifs? Has anyone used the same or similar approach?
Assuming you can reach your clients back via HTTP. The model to do this is to use callbacks. When someone posts a scheduled job on your server, they should also post a callback URI where your server can notify when the job is complete.
Sample below:
https://schedulingSevrer.com/runSchedule?callback=http://clientserver.com/reportStatusHere
So when the job is done your callback will be like
http://clientserver.com/reportStatusHere?jobId=12345&status=complete
Or if your clients are mobile apps on Andorid you can use the Google Push notifications.

MailChimp/Mandrill webhook for message created/scheduled

Is it possible to get MailChimp or Mandrill to notify a webhook URL whenever a message is either created for a list, or scheduled to be sent, along with the list and message IDs?
I have a client that wants to intercept messages from his campaign, add special data from his server, then send the resulting template through his connected Mandrill account. I'm trying to figure out how to implement the first step in this process.
Although I know this is old someone may stumble into this thread, have you checked out the webhook information?
http://help.mandrill.com/entries/58303976-Message-Event-Webhook-format
It has an easy way to implement it inside the account. You just setup a URL to intercept and parse the incoming data. I recommend first saving the data then using a scheduled task to parse the job separately so you don't lose data (although mandrill will try 100x).
If the unique id is not enough for you with your events, and you are concerned about specific campaigns you can tag the emails upon send and they will have the tagged information with the incoming event.

Twilio How to collect incoming SMS messages using .net efficiently

I created an application in VB.net that ties into a scheduling software. It keeps our employees up to date by sending them SMS updates. Employees can reply back to us. Sending messages works great. The application uses the Rest API to connect to Twilio. I can also get a list of incoming messages but I can't seem to get it in a way that works well for me.
Currently my application checks if there are new messages every 5 minutes. The application gets the messages list (with filter DateSent>=today) and then loops through the messages and copies the new ones into our scheduling database.
Is it possible to do a more efficient data pull for new SMS messages using VB.net only? Can I include a time filter in addition to current filter DateSent>=today to limit the result set? Any suggestions? (I don't do web coding unfortunately) Thanks.
Twilio evangelist here.
The best way to do this is just to use Twilios web hook to let Twilio proactively tell you each time its received a message. Whats a web hook you ask? Great question.
A webhook is simply an HTTP request that Twilio will make as soon as it received an inbound SMS messages to your Twilio phone number. You normally tell Twilio to make this HTTP request to a URL that you've created and published to a public website, which you can set up easily by using something like ASP.NET. In this scenario you can think of Twilio like a web browser that is making a request to a web application that you have created.
You can tell Twilio what URL it should request by opening the Numbers tab in your Twilio dashboard, and then locating and clicking the phone number you want to configure:
Now you set the URL you want Twilio to request in the Message Request URL field and click Save:
Now when Twilio requests this URL its going to pass a bunch of parameters with its request that you can use in your application logic. You can also do things like return TwiML back to Twilio in response to its HTTP request that tell it to do things like send an SMS right back to the person who just sent one to you.
If you're looking for a bit more of a step by step, the Quickstarts on our website are pretty easy to follow and will walk you through both sending an receiving text messages. The samples are in C# but are pretty straight forward so converting to VB.NET should be easy.
Hope that helps.
I am doing something similar with VB.Net and Twilio. My solution was to put up an Azure web site and an Azure SQL Database (the two can talk to each other). I set up my Twlio to call an .ashx asp.net web page on my Azure web site. Inside of that web page I have code that reads the incoming text message and saves it to my Azure SQL Database.
Works great, but my problem is the Azure database is in "the cloud" and my app\database that sends the original SMS is on mylocal network. Not sure how to cross that divide... (I should add that my local app can read the Azure SQL database, but seems ugly to have to call out to the Azure to get data. Would have preferred to have just saved it in my local db to begin with.)
Probably not a very helpful post, but maybe give you some architectural ideas. If you want to see my .ashx page just let me know.