I'm trying to update the content of a received mail message that already exists in my inbox folder using the graph API. For some reason, the message is updated, but then immediately (a few seconds later), the message is reverted back to the original content.
Sometimes when this happens, I see some label on top of the message:
"This is the most recent version, but you made changes to another copy.."
Do you have any idea why?
I'm sending a PATCH request to /v1.0/users/<user-id>/messages/<message-id>
The sample request body is:
{
"body": {
"contentType": "HTML",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\ntest\r\n</body>\r\n</html>\r\n"
}
}
You can only update draft messages. From the documentation:
Property
Type
Description
body
ItemBody
The body of the message. Updatable only if isDraft = true.
In other words, you cannot PATCH received messages or those that have already been sent.
Related
I use botframework api to send message to users.
the message contains attachment.
So I send the activity like this
{
"attachments": [{
"contentType": "application/vnd.microsoft.teams.card.file.info",
"contentUrl": "https://contoso.sharepoint.com/personal/johnadams_contoso_com/Documents/Applications/file_example.txt",
"name": "file_example.txt",
"content": {
"uniqueId": "1150D938-8870-4044-9F2C-5BBDEBA70C8C",
"fileType": "txt",
}
}]
}
And I send bot message to user like this
And I want to generate sharelink by clicking this button
But I got a error that told me I can's generate sharelink
Does anyone knows the reason?
This issue is confirmed by the original post that it's caused by incorrect uniqueID. The uniqueID is not the itemID in one drive.
For more information about different IDs for botframework, please refer to document here: https://learn.microsoft.com/en-us/previous-versions/azure/bot-service/bot-service-resources-identifiers-guide?view=azure-bot-service-3.0
Auto Remediation not happening. Error :- message not present in User's mailbox .
Scenario:
While working on microsoft graph explorer and sending mail with attachment the outlook is not able to auto remediate the message and while checking the url on graph explorer i am not getting any value associated with it and also i am getting the error like the message is not there in the user mailbox.
The Attachment name which I am using are double byte Chinese characters (发送邮.xml)
Instead of this if I am using attachment name like this (for e.g 送邮.xml) then it is working as expected and the mail is successfully getting remediated.
Is there any bit size limit of attachment names in graph explorer because of which it is not taking that attachment name(发送邮.xml) whereas it is working fine with (送邮.xml)
Please help me with this.
I have tried giving the payload this way and used the same name that didn't work for you. But I was able to success send mail using Graph Explorer.
"attachments": [
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "发送邮.xml",
"contentType": "text/plain",
"contentBytes": "SGVsbG8gV29ybGQh"
}
]
I'm trying to implement following:
python script sends message to slack with button and payload,
user clicks on button in the slack message,
button sends POST with payload to Request URL (aws api)
Currently button doesn't send POST.
I forge message with following python script
slack_token = 'xoxp-1111-111-111-qqqqqq'
sc = slack.WebClient(slack_token)
sc.chat_postMessage(
channel="QQQQQ",
blocks=[
{
"type": "actions",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "send post"
}
}
]
}
]
)
I added https://here.aws.api.amazonaws.com/default/lambda as "Request url" in the "Interactive Components" and "Event Subscriptions" of my slack app.
When I send message to bot POST request is sent to aws api.
When I click button POST request is not sent.
Tried with both tokens xoxp- and xoxb-
The problem is:
slack generates http request in strange way. Instead of json, it puts "blocks" into following structure:
{ ...... 'body': (byte[])\"payload=%7B%22type%22%3A%22block_actions%2 ...}
after decoding it is equal to:
{...payload={"type": "block_actions",...}
That isn't readable like json.
AWS API rejected these slack requests.
AWS cloudwatch helps to investigate problem.
To avoid this is necessary to enable "Use Lambda Proxy integration" option during method adding.
I am hitting the Outlook Office 365 API through Postman. I tried to create a draft reply message using this URL:
POST https://outlook.office.com/api/v2.0/me/messages/{message_id}/createreply
The body contained:
body: {
"Comment": "Sounds great! See you tomorrow."
}
but I got the following error:
{
"error": {
"code": "RequestBodyRead",
"message": "The parameter 'Comment' in the request payload is not a valid parameter for the operation 'CreateReply'."
}
}
I have used this call based on the documentation.
This issue also exists for create a draft reply all message and create a draft forward message.
This is because you're placing comment within the body, it should stand on it's own. From this documentation:
POST https://outlook.office.com/api/beta/me/messages/AAMkADA1MTAAAAqldOAAA=/createreply
Content-Type: application/json
{
"Comment": "Fanny, Randi, would you name the group if the project is approved, please?"
}
Note that it is {"comment": "string"} and not body:{"comment": "string"}.
I'm using slacks events API and have setup a subscription to the reactions_added event. Now when a reaction is added to a message, slack will send me a post body with all the details of the dispatched event as described here.
The problem I'm having is that I want to get the details, specifically the text of the message that my users have reacted to so I can parse/store etc that specific message. I assumed the message would return with some type of UUID that I could then respond to the callback and get the text, however I'm find it difficult to get the specific message.
The only endpoint I see available is the channels.history, which doesn't seem to give me the granularity I'm looking for.
So the tl;dr is: How do I look up a via slacks API, a messages text sent from the events API? Give the information I have the event_ts, channel and message ts I thought would be enough. I'm using the ruby slack-api gem FWIW.
You can indeed use the method channels.history (https://api.slack.com/methods/channels.history) to retrieve message from a public channel . The reaction_added dispatched event includes the channel ID and timestamp of the original message (in the item) and the combination of channelId + timestamp should be unique.
Be careful that you use the correct timestamp though. You need to use item.ts not event_ts
Full example dispatched event from the docs:
{
"token": "z26uFbvR1xHJEdHE1OQiO6t8",
"team_id": "T061EG9RZ",
"api_app_id": "A0FFV41KK",
"event": {
"type": "reaction_added",
"user": "U061F1EUR",
"item": {
"type": "message",
"channel": "C061EG9SL",
"ts": "1464196127.000002"
},
"reaction": "slightly_smiling_face"
},
"event_ts": "1465244570.336841",
"type": "event_callback",
"authed_users": [
"U061F7AUR"
]}
So calling channels.history with these values set should work:
latest = item.ts value
oldest = item.ts value
inclusive = 1
channel = item.channel value
If you want to get messages from a private channel you need to use groups.history.
https://api.slack.com/methods/channels.history