Forum Discussion
GuillaumeStD
Sep 28, 2022Copper Contributor
MessageId undefined when creating a message
Hi,
I just found a weird behavior that I believe to be a bug.
When using the Connector API, I can create a message with this kind of Axios config :
{
method: "POST",
headers: { Authorization: botBearerToken },
url: `${connectorApiBaseURI}/v3/conversations/${conversationId}/activities`,
data: {
type: "message",
text: "random text message",
inputHint: "acceptingInput",
},
}
I can retrieve the activity/message id I just created in the response body.
But if I add some attachments to the message, the message with its attachments is properly created in Teams but the id in the response body is undefined. This is a plague for my app, as the message Id is mandatory to update the message afterwards when necessary.
Here is the Axios config in this case :
{
method: "POST",
headers: { Authorization: botBearerToken },
url: `${connectorApiBaseURI}/v3/conversations/${conversationId}/activities`,
data: {
type: "message",
text: "random text message",
inputHint: "acceptingInput",
attachmentLayout: "list",
attachments: [...],
},
}
My request is to have the message/activity Id in the response body reliably when the message/activity creation succeeds.
- Meghana-MSFT
Microsoft
we are checking this issue, we will get back to you.- GuillaumeStDCopper Contributorany update ?
- Meghana-MSFT
Microsoft
GuillaumeStD - We tried sending message with an attachment using graph explorer and through a bot. In both the cases we can see below in the response.
Response for a bot
{ "attachments": [ { "contentType": "application/vnd.microsoft.teams.file.download.info", "content": { "downloadUrl": "https://m365x654992-my.sharepoint.com/personal/admin_m365x654992_onmicrosoft_com/_layouts/15/download.aspx?UniqueId=94520df7-36a1-4b58-b5ce-074ded665c4c&Translate=false&tempauth=eyJ0eXAiOiJKV1QiLCJhbGciOiJub25lIn0.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvbTM2NXg2NTQ5OTItbXkuc2hhcmVwb2ludC5jb21AMzZhNzA4ZWYtNzAwZC00ZDYwLTlkZTAtMGE1ZjdiNzY5M2RmIiwiaXNzIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwIiwibmJmIjoiMTY2NDkwNjU0MiIsImV4cCI6IjE2NjQ5MTAxNDIiLCJlbmRwb2ludHVybCI6Ik8wUW0rZW1XcWkzMHgyU2VUcEdvUGpsVHgySU5vbmxBajJtSS9Cc29rNTA9IiwiZW5kcG9pbnR1cmxMZW5ndGgiOiIxNjgiLCJpc2xvb3BiYWNrIjoiVHJ1ZSIsImNpZCI6Ik1EUTFNekE1TXpFdE1EQmxZaTAwT0Rjd0xXSXlaRFF0WWpCaE4yRXpNelEzTXpRMyIsInZlciI6Imhhc2hlZHByb29mdG9rZW4iLCJzaXRlaWQiOiJabVJtTm1Wak5qWXRPVEl6WWkwME4yVTBMVGt6WlRBdE5qUm1ZekF3WVdVeE1qWmoiLCJhcHBfZGlzcGxheW5hbWUiOiJNaWNyb3NvZnQgVGVhbXMgU2VydmljZXMiLCJnaXZlbl9uYW1lIjoiTU9EIiwiZmFtaWx5X25hbWUiOiJBZG1pbmlzdHJhdG9yIiwiYXBwaWQiOiJjYzE1ZmQ1Ny0yYzZjLTQxMTctYTg4Yy04M2IxZDU2YjRiYmUiLCJ0aWQiOiIzNmE3MDhlZi03MDBkLTRkNjAtOWRlMC0wYTVmN2I3NjkzZGYiLCJ1cG4iOiJhZG1pbkBtMzY1eDY1NDk5Mi5vbm1pY3Jvc29mdC5jb20iLCJwdWlkIjoiMTAwMzIwMDExQUE2RjI1QyIsImNhY2hla2V5IjoiMGguZnxtZW1iZXJzaGlwfDEwMDMyMDAxMWFhNmYyNWNAbGl2ZS5jb20iLCJzY3AiOiJncm91cC53cml0ZSBhbGxzaXRlcy53cml0ZSBhbGxwcm9maWxlcy53cml0ZSIsInR0IjoiMiIsInVzZVBlcnNpc3RlbnRDb29raWUiOm51bGwsImlwYWRkciI6IjIwLjE5MC4xNTUuMzYifQ.L1g3MzhqVlNpeUgrazVISlRpVTZsZFFFblZwUWxGZ3VGeWhhbmRTdlF5OD0&ApiVersion=2.0", "uniqueId": "94520df7-36a1-4b58-b5ce-074ded665c4c", "fileType": "png" }, "contentUrl": "https://m365x654992-my.sharepoint.com/personal/admin_m365x654992_onmicrosoft_com/Documents/Microsoft Teams Chat Files/signin.PNG", "name": "signin.PNG" }, { "contentType": "text/html", "content": "" } ], "type": "message", "timestamp": "2022-10-04T18:02:25.4863209Z", "localTimestamp": "2022-10-04T23:32:25.4863209+05:30", "id": "1664906545384", "channelId": "msteams", "serviceUrl": "https://smba.trafficmanager.net/amer/", "from": { "id": "29:1QT50AaMqBsYzEGE5xVhu92Gt-jdb_x2lKt0hrduDCLdBM8wljPfJqvjGNPsU15bPg8i_psUiCGZr-8MVsZ0xQg", "name": "MOD Administrator", "aadObjectId": "4ebcc4d0-291b-4154-a85f-a89cd77aefa8" }, "conversation": { "conversationType": "personal", "tenantId": "36a708ef-700d-4d60-9de0-0a5f7b7693df", "id": "a:1YY_gZHYmENg-dpmwpbAkI240ELNnoF_xKLtRo03Vt917Ym5g5wppjuRSQve0xiD7pqqY9OIsG8ogBXMYUFgNJbLdJgPCMYLDG7tnUTQzGrtbUrW7188iBgp8Uay4Y_oZ" }, "recipient": { "id": "28:7ad956d2-7b3c-4769-8792-3236a0618da4", "name": "appssonpm" }, "entities": [ { "locale": "en-US", "country": "US", "platform": "Web", "timezone": "Asia/Calcutta", "type": "clientInfo" } ], "channelData": { "tenant": { "id": "36a708ef-700d-4d60-9de0-0a5f7b7693df" } }, "locale": "en-US", "localTimezone": "Asia/Calcutta" }
Response while sending attachment using Graph -
{ "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams('27dd5b6f-0048-4338-acfd-5852b944b714')/channels('19%3A76a3f036b7bf4e6d9641c45347da23a1%40thread.tacv2')/messages/$entity", "id": "1664904065325", "replyToId": null, "etag": "1664904065325", "messageType": "message", "createdDateTime": "2022-10-04T17:21:05.325Z", "lastModifiedDateTime": "2022-10-04T17:21:05.325Z", "lastEditedDateTime": null, "deletedDateTime": null, "subject": null, "summary": null, "chatId": null, "importance": "normal", "locale": "en-us", "webUrl": "https://teams.microsoft.com/l/message/19%3A76a3f036b7bf4e6d9641c45347da23a1%40thread.tacv2/1664904065325?groupId=27dd5b6f-0048-4338-acfd-5852b944b714&tenantId=36a708ef-700d-4d60-9de0-0a5f7b7693df&createdTime=1664904065325&parentMessageId=1664904065325", "policyViolation": null, "eventDetail": null, "from": { "application": null, "device": null, "user": { "id": "4ebcc4d0-291b-4154-a85f-a89cd77aefa8", "displayName": "MOD Administrator", "userIdentityType": "aadUser" } }, "body": { "contentType": "html", "content": "Here's the latest budget. <attachment id=\"7bd0609d-0ca7-41f2-aed9-2f2cbae6cae2\"></attachment>" }, "channelIdentity": { "teamId": "27dd5b6f-0048-4338-acfd-5852b944b714", "channelId": "19:76a3f036b7bf4e6d9641c45347da23a1@thread.tacv2" }, "attachments": [ { "id": "7bd0609d-0ca7-41f2-aed9-2f2cbae6cae2", "contentType": "reference", "contentUrl": "https://m365x654992-my.sharepoint.com/personal/admin_m365x654992_onmicrosoft_com/_layouts/15/Doc.aspx?sourcedoc=%7B7BD0609D-0CA7-41F2-AED9-2F2CBAE6CAE2%7D&file=Document2.docx", "content": null, "name": "Document2.docx", "thumbnailUrl": null } ], "mentions": [], "reactions": [] }