Experiencing 404 errors when sending messages to users in Microsoft Teams. Manifest includes both team and personal scopes. Messages fail for some users even though they are visible through the REST API. Seeking assistance from Microsoft Support, willing to share more details via private email.
MS Teams bot receiving 404 when sending user message
We have a production app that can message channels and users.
We have both the team and personal scopes set in our manifest.
The typical installation path is for a team admin to install the app/bot in a team. After doing so, our bot will periodically send messages to users.
However, we've detected a large swath of these messages result in a 404 error, while others do not.
I have a number of examples of users who we can not reach, although we can use the REST API to see them in the team.
I'd be happy to share more details in a private email with Microsoft Support.
Thank you.
Microsoft Teams Development
-
ChetanSharmamsft 1,026 Reputation points • Microsoft Vendor
2024-01-04T15:50:36.42+00:00 Hello @random-engineer - Could you please share the error logs and other details, so that we can further investigate the issue?
-
random-engineer 25 Reputation points
2024-01-04T16:35:43.29+00:00 @ChetanSharmamsft here's the request and response.
Notice the error message of "Conversation not found".
We're first using the REST API to create a conversation with the user (aka a chat). This returns a conversation ID that we use with the REST API to send a message to the user.
{ "status": 404, "headers": { "content-length": "77", "content-type": "application/json; charset=utf-8", "server": "Microsoft-HTTPAPI/2.0", "ms-cv": "tD0WdzH/tkqsUqMi+wMFKg.0", "date": "Thu, 04 Jan 2024 16:07:46 GMT" }, "body": { "error": { "code": "ConversationNotFound", "message": "Conversation not found." } }, "request": { "method": "post", "url": "https://smba.trafficmanager.net/amer/v3/conversations/a:1_8RPV84qUsGqTm2lrpcanV44nwiI-HZmtQgtOAR8PPboex19-rIC50m1R_m1tZD3I0TRXrkCGchne_Ol5IpOStlnHOuFI4Mxlx-o9POvAESMOyKMx04mdOnzww-Ace2i/activities", "url_path": "/amer/v3/conversations/a:1_8RPV84qUsGqTm2lrpcanV44nwiI-HZmtQgtOAR8PPboex19-rIC50m1R_m1tZD3I0TRXrkCGchne_Ol5IpOStlnHOuFI4Mxlx-o9POvAESMOyKMx04mdOnzww-Ace2i/activities", "params": null, "headers": { "User-Agent": "Faraday v2.7.11", "Content-Type": "application/json", "Authorization": "Bearer REDACTED" }, "body": { "type": "message", "text": "hello" } } }
Furthermore, I can use the REST API to list the conversation members and this returns the user I'm expecting to chat with.
{ "members": [ { "id": "29:1nTWzREI0DTT9ATC7FAaC1SGWks07ariD0mlYgpaqSeeaLvqytAJFTBtglfwjFvCXLAh6fH1b4ARVCWfT4UA6VA", "aadObjectId": "caf63324-4951-4e42-b37d-6ea66dbc3f1d", "name": "REDACTED", "givenName": "REDACTED", "surname": "REDACTED", "email": "REDACTED", "userPrincipalName": "REDACTED", "tenantId": "xxxxx-xxxx-xxxx-xxxx-171058dec37b", "userRole": "user" } ], "totalCount": 2 }
So it does appear the conversation exists. And given that the
totalCount
is 2, I'm guessing the other member is our bot.Please note that we were able to send messages to this user in the past.
Not sure why I'd get a 404 when trying to send a message.
Let me know if you need more information.
-
random-engineer 25 Reputation points
2024-01-08T15:47:56.5233333+00:00 Looks like if I call the REST API create conversation endpoint again I am able to send messages as normal. The conversation ID remains the same so I'm not sure why this needs to be done. The docs suggest we should be able to reuse this ID but it seems we cannot because it'll potentially and unexpectedly 404.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-01-16T08:03:03.22+00:00 Apologies for the delay in responding. We checked this at our end, and we are able to Create conversation and Send message to user using Rest API.
Could you please let us know if you are not able to send message to only few users?
-
random-engineer 25 Reputation points
2024-01-16T13:55:47.32+00:00 @Meghana-MSFT do we have to run the call to create a conversation before every attempt to send a message? I thought we could cache the conversation ID and use it to send messages in the future. This appears to not be the case because after some period of time we'll suddenly start getting 404s on sending a message. The error says the conversation is not found - even though we can query for it. The only way to recover is to make the call to create a conversation again which returns the same conversation ID.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-01-17T08:02:53.4+00:00 You do not have to create conversation again as it returns the same conversation ID. And we are able to send messages to the conversation we created 2 days back. We will check internally and get back to you.
-
random-engineer 25 Reputation points
2024-01-17T14:37:12.87+00:00 Meghana-MSFT we are in fact getting 404s at times when re-using existing conversation IDs. Not sure what might be causing it but it's something I've been able to reproduce. We're now forced to call the create conversation endpoint every time we send a chat message to ensure delivery. I've tried troubleshooting on my end by using a Teams app to delete my chat with our bot, but even then our bot can still send messages. So I would inquire as to what scenario would a conversation be considered "not found" and why would creating a new conversation return the same ID.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-02-09T04:46:58.24+00:00 @random-engineer @william peter @Freser Marko - Could you please share the latest logs for this issue? Engineering team is looking into the bug we raised but needs recent logs for further investigation.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-02-15T06:57:32.11+00:00 @random-engineer, @william peter, @freser Marko - Could you please share the latest logs for this issue? Engineering team is looking into the bug we raised but needs recent logs for further investigation.
-
Freser Marko 0 Reputation points
2024-02-15T12:32:52.9866667+00:00 -
random-engineer 25 Reputation points
2024-02-15T17:59:32.7266667+00:00 @Meghana-MSFT I don't have any recent examples because our app is now calling create conversation before sending a message. My original comment has an error log that I've also pasted below:
{ "status": 404, "headers": { "content-length": "77", "content-type": "application/json; charset=utf-8", "server": "Microsoft-HTTPAPI/2.0", "ms-cv": "tD0WdzH/tkqsUqMi+wMFKg.0", "date": "Thu, 04 Jan 2024 16:07:46 GMT" }, "body": { "error": { "code": "ConversationNotFound", "message": "Conversation not found." } }, "request": { "method": "post", "url": "https://smba.trafficmanager.net/amer/v3/conversations/a:1_8RPV84qUsGqTm2lrpcanV44nwiI-HZmtQgtOAR8PPboex19-rIC50m1R_m1tZD3I0TRXrkCGchne_Ol5IpOStlnHOuFI4Mxlx-o9POvAESMOyKMx04mdOnzww-Ace2i/activities", "url_path": "/amer/v3/conversations/a:1_8RPV84qUsGqTm2lrpcanV44nwiI-HZmtQgtOAR8PPboex19-rIC50m1R_m1tZD3I0TRXrkCGchne_Ol5IpOStlnHOuFI4Mxlx-o9POvAESMOyKMx04mdOnzww-Ace2i/activities", "params": null, "headers": { "User-Agent": "Faraday v2.7.11", "Content-Type": "application/json", "Authorization": "Bearer REDACTED" }, "body": { "type": "message", "text": "hello" } } }
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-02-20T08:07:20.36+00:00 @freser Marko -We shared the logs with engineering team.
@random-engineer - logs have a 28 days retention period. Hence the logs shared by you are expired.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-04-17T07:02:38.4566667+00:00 @freser Marko , random-engineer - Could you please share below details?
- Perform the test again
- If you still get 404, share these information: Bot id Timestamp MS-CV header in the response if possible
If you do not wish to share your botid on forum, you can share above details on email with us microsoftteamsdev@microsoft.com.
-
Jessica Reichert 0 Reputation points
2024-04-18T13:01:55.7133333+00:00 I am having the same issues. Random 404 errors saying a conversation isn't found after I just created one. Any solutions?
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-04-25T14:12:48.0033333+00:00 Could you please share below details?
- Perform the test again
- If you still get 404, share these information: Bot id Timestamp MS-CV header in the response if possible
If you do not wish to share your botid on forum, you can share above details on email with us microsoftteamsdev@microsoft.com.
-
Jessica Reichert 0 Reputation points
2024-04-25T14:19:43.19+00:00 I am using a standard out-of-the-box logic app connector to ms teams to create the chat and then posting an adaptive card to that chat. I don't receive constant errors, it's intermittent failures.
-
Apollo services 1 Reputation point
2024-05-09T11:05:14.26+00:00 - We're facing similar intermittent 404 errors. For now we have made temporary fix to retry again after creating conversation.
- This fix again throws BadRequest sometime when creating conversation.
- Once this issue is fixed we can remove our temporary fix.
Sign in to comment
1 answer
Sort by: Most helpful
-
William Peter 5 Reputation points
2024-01-17T04:31:23.1466667+00:00 -
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-01-17T10:40:29.21+00:00 Are you also facing same issue like above? Returns 404s on sending a message. The error says the conversation is not found - even though they can query for it. The only way to recover is to make the call to create a conversation again which returns the same conversation ID.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-01-17T10:41:13.16+00:00 Could you please let us know if you are also facing same issue as above? It returns 404s on sending a message. The error says the conversation is not found - even though they can query for it. The only way to recover is to make the call to create a conversation again which returns the same conversation ID.
-
Freser Marko 0 Reputation points
2024-01-19T09:24:12.6833333+00:00 We are also having the same issue, for random users cc 15.000 (at least we didn't noticed any common points with them) we are receiving 404 when sending messages with "Company Communicator" https://github.com/OfficeDev/microsoft-teams-apps-company-communicator The conversation id is allways the same, if we reuse it (so the create conversation isn't called), than sometimes 404 jumps out.
-
Meghana-MSFT 3,786 Reputation points • Microsoft Vendor
2024-02-08T11:27:31.41+00:00 We raised a bug for this issue, we will keep you posted on the updates. Thank you.
Sign in to comment -