Microsoft Graph notification timeout and number of retries - microsoft-graph-api

we are using Microsoft Graph notification to monitor certain resource changes such as group creation/deletion, etc.
In the MS doc it says "Send a 202 - Accepted status code in your response to Microsoft Graph. If Microsoft Graph doesn't receive a 2xx class code, it will retry the notification a number of times."
We'd want to have a better understanding on how this works, such as what are the timeout values (how long does Graph wait before it re-sends the notification?), and how many times it retries (is it a guaranteed delivery?), etc. Can anybody help shed some light on this?

Related

Is there a Twilio outbound SMS magic number that hits a timeout value?

I'm testing some flows that use outbound SMS via Twilio and have been really pleased and impressed by the magic numbers provided e.g. https://www.twilio.com/docs/iam/test-credentials
However, I'm interested to see how our application responds if there's some issue sending an SMS to a number where it essentially hits a timeout value. I haven't found a magic number such as this or know of a way to recreate the scenario, can anyone help me here?
Even if you were using a real auth credentials and real phone number (instead of magic number), I suspect Twilio just queues the request on their side and responds with a HTTP 201, so you'll always get a very fast response from Twilio, but it doesn't necessarily mean the message has been sent to a carrier and delivered to a device.
If you're using Twilio messaging services, you can subscribe to delivery status callbacks to get the status of a SMS e.g. sending, sent, delivered, failed, etc - see here. Note: I don't know if you'd receive callbacks with magic numbers - I suspect not... either way you can provision a Twilio phone number pretty cheaply to test e.g. in Australia (where I'm from) I can purchase a AU phone number for $6 per month and I can release the phone number when ever I want to stop getting billed for it...
If you just want your app to timeout on invocation of the Twilio API you can do something like the following (in .NET core) to force timeout a request in a specified amount of time (1 second in example below):
using var tokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000));
response = await twilioHttpClient.PostAsJsonAsync($"2010-04-01/Accounts/{accountSID}/Messages.json", request, jsonSerializerOptions, tokenSource.Token);
If timeout is exceeded, an exception will be thrown that you can handle. Note: there's various networking tools that can be used to block or limit outbound requests, which you can use to test timeout scenarios.

Increase Twilio Total Timeout from 15000ms - SMS

When an API call is made after receiving an SMS via Twilio, I occasionally get the error below -
Error: Total timeout is triggered. Configured tt is 15000ms and we attempted 1 time(s)
The API call occasionally takes longer than 15 seconds to return a response (this is due to having to process the SMS etc.). How can I configure the total timeout to say 25000ms?
It is possible to override the timeout settings for a webhook. However, the maximum total time (tt) for webhooks is 15 seconds and you cannot increase it beyond there.
If you find your service cannot respond within that time, you might want to hand off the processing of the SMS to a job and respond to the webhook quicker. If you then intend to reply to the SMS, you can do so using the REST API message resource instead of TwiML.

Delay in change notification for channel messages in Microsoft Teams

We implemented the change notifications subscription for channel messages as per the Microsoft Teams guidelines. We received the messages within 1 minute until 12-July-2021. Now we see a latency of about 2 - 15 minutes for sometimes notably on PST day time.
According to this link (https://learn.microsoft.com/en-us/graph/webhooks#latency) channel messages will be notified within 1 minute.
Could you please let us know what is causing this delay serving the request ?
We would also like to know if there is policy or priority on serving the notifications based on tenant type.
Thanks in advance.

Too Many Requests in sending Bulk Messages using Twilio Message Service

I am getting the error below when I send bulk messages using Twilio Message Service.
[HTTP 429] Unable to create record: Too Many Requests
I have around 50 numbers in the sender pool in this Message Service.
And I am trying to send about 5K messages at once, some delays are Okay,
But the messages couldn't be sent due to this error,
Thanks in advance,
Twilio developer evangelist here.
A 429 error means that you are exceeding the number of concurrent connections to the Twilio API. By default, this is 100, though it can vary depending on your account.
To counteract this, you should aim to make less than 100 concurrent requests to the API and implement retries with an exponential back off to allow for your other requests to finish.
There is more information on the 429 error here including further links for implementing the above strategies.

What happens with Microsoft Graph webhooks if the receiver is down?

The documentation for Microsoft Graph webhooks is not clear on the durability of events. If a client creates a subscription and then subsequently goes down (say, for maintenance), what happens to events that occur while the client is unavailable? Are they queued and retried by the Microsoft Graph until the client comes back online, or are they lost? If they are queued, for how long?
Graph Webhook will try to send the events a number of times within 4 hours window. If the client does not come back online after 4 hours, then these events will be deleted.

Resources