ErrorItemNotFound for Sent Items message notification - microsoft-graph-api

We have created a subscription for all mailbox folders as
users/email#email.email/messages?$filter=isDraft eq false
When creating a subscription the Prefer header is specified: IdType = "ImmutableId".
The problem is that for all folders via the webhook we successfully receive a notification with an immutable ID and get by this ID email using Graph messages API, but in the case of emails sent from Outlook, the webhook first receives the ID, which triggers an error on Message get:
Status Code: NotFound Microsoft.Graph.ServiceException: Code: ErrorItemNotFound Message: The specified object was not found in the store., Item not found.
After this, the second webhook associated with the Sent Items folder arrives. I don't know what the first webhook is related to, possibly the Outbox folder. How can this be overcome?

Related

Twilio API get DateSent from StatusCallback URL?

I am using Twilio and I want to get the DateSent parameter of a message. When the message is initially sent it has null values for both DateCreated and DateSent. So I pass a StatusCallback URL to receive any status updates on that message. However, I am able to get only the new statuses the message gets such as sent, or delivered and not the new date as an event. In the docs I couldn't find anything about this either (https://www.twilio.com/docs/sms/send-messages#monitor-the-status-of-your-message). What is the way to get this information without continuously polling the API?
The date created is included as part of the response from the API. If you find that is not the case can you please post example code.
When the sms is actually sent you can pull the message resource using the api or sdk via the sid https://www.twilio.com/docs/sms/api/message-resource#fetch-a-message-resource

Is there any functionality through which I can get the url of a reply message in msteams's Team whose conversation is initiated by user

There's a scenario in which I want to get the url of reply message in a msteams's team whose conversation is initiated by user. With graph api, I'm getting the original message but not the reply id of that message due to which I can't get the replies of that original message. I am getting the replies of message when the conversation is initiated by a Bot in a team but not when the conversation is initiated by user. Is there any way possible throgh which I can also get the reply message of the original message when conversation gets initiated by a user ?.I am using this /teams/{teamId}/channels/{channelId}/messages graph api to get messages and this /teams/${teamId}/channels/${channelId}/messages/${messageid}/replies/{replyToId} graph api to get the reply of any message.

Graph API for Outlook message restore

I had taken backup of my mail box using below rest API
GET https://graph.microsoft.com/v1.0/me/messages
But from My side this email msg deleted and i want to restore it again .
How i can do it using Rest API.
I tried with
POST https://graph.microsoft.com/v1.0/me/messages
and body with message.
but the message added as a draft not actual message.
Please help.
That is correct, when you create an email it will always save as draft unless it has been sent.
Try find the returned message id from the message creation POST, then issue a secondary POST to send it:
POST https://graph.microsoft.com/v1.0/me/messages/{id}/send
Ref: message: send

How to re-send a failed SMS with Zenvia in Rails?

I'm using Rails with Zenvia API to send Text Messages to my users.
But if a message fails to send, how could I send the same message without creating a new message ID? Is there a method to it?
Today when I try to send again the same message, it returns "Message with same ID already sent".
Turns out Zenvia API does not have a way to resend messages with same ID. At least not within 24 hours.
The solution I found was to create a token that would serve as a "fake" ID and passed it to the API. If the message for any reason fails to send, I create a new token and send it again.

Getting MessageID of outgoing message on TwiML reply to incomming message

I am trying to build a local database storing Twilio SMS message events. There would be two tables: A Messages table with message info (To,From,Body,etc.), and a StatusRecords table containing status events (Status,ErrorCode,ErrorMessage, etc.). Both tables would be keyed on the MessageID.
I can get the MessageID and message info when I send a message (as a client) using the REST API in the returned response. That's fine.
I have a java servlet running that is called with status updates when Twilio updates the message delivery status. I then update the status in my database using the MessageID as the key. That's fine as well.
I have another servlet running that receives reply messages. I pick up the reply MessageID and add this to the database. This servlet also replies to the incomming message in the http GET response parameter using the TwilML API.
The problem is: How do I get the MessageID of the reply to the incomming message? The reply takes place as a result of a response to the http GET. I don't think I will hear from Twilio again after responding.
I assume that Twilio will update the status on the reply message as it is delivered or not delivered--and I will receive this update in my status update servlet. I could probably try to match the phone number of the status update to get the reply MessageID but this seems sort of crude.
Is there a more elegant way to do this?
Twilio evangelist here.
The <Message> verb takes an action parameter which lets you specify a URL for Twilio to request once it processes the Message noun. This request will include the Message SID.
If you wanted to associate the SID of the incoming message with the one sent by Twilio, you could pass the incoming message SID as part of the URL you set for the action parameter:
http://example.com/message?id=XXXXXXXXXX
Hope that helps.

Resources