Request the details of a message in a channel. The response contains the text as well as an attachment overview. The message text can be either be formatted as HTML
or returned as plain text.
Returns the message using the following form:
{ "id": "<ID of the message>", "created": <timestamp of creation date and time>, "modified": <timestamp of modification date and time>, "userId": "<GUID of user who wrote the message>", "attachments": [ { "id": "<GUID of attachment>", "name": "<Name of attachment file>", "properties": { <Map of attachment properties> } }, ... ], "reactions": { "<Emoji short name>" : [ { "userId": "<The users GUID>", "timestamp": <Timestamp> }, ... ], ... } }
RESPONSE Fields | Value Type | Description |
---|---|---|
id | String | The GUID of the message, used for details and further operations |
created | Number | The timestamp of the creation date and time of the message |
modified | Number | The timestamp of the modification date and time of the message |
userId | String | the GUID of the user who created the message |
attachments | List | List of attachment information |
attachments.id | String | the GUID of the attachment |
attachments.name | String | the file name of the attachment |
attachments.properties | Map | A key / value map of additional properties |
reactions | Map | Map of reaction information |
reactions."<Emoji short name>" | String | The short name of a reaction as key, with a list users and timestamps who gave the reaction |
reactions.userId | String | The GUID of a user, who gave the reaction |
reactions.timestamp | Long | The timestamp, when the reaction was given by the user. |
The parameter format=html
enables you to return the message text rendered as HTML instead of plain text including raw Markdown.
# Request # Use user:password for authorization GET /api/cowork/teams/3n1ytbwme7ngfyn9g9guwwurt/channels/epmlsh7trr535mrs9z7xcfn1w/messages/00kunwmi6kgxy4j5qmft7uz0y HTTP/1.1 Accept: */* Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u # Response HTTP/1.1 200 OK Content-Type: application/json { "id": "00kunwmi6kgxy4j5qmft7uz0y", "text": "This is the message text", "created": 1634031935796, "modified": 1634031935796, "userId": "sys02qmoxwlwprnnovhrxtx7n", "attachments": [ { "id": "00kunwoaknjy4vca8c7cukxdo", "name": "what an image.gif", "properties" : [ ] } ], "reactions": [] }
Send a message update using the following JSON. The response is a the updated message.
{ "text": "<The text to send to the channel>", "attachments": [ <attachment descriptions> ] }
REQUEST Fields | Value Type | Description |
---|---|---|
text | String | The optional text message to send to the channel |
attachments | String | Optional list of attachments to send along with the message. See Attachment Description |
Note: Only the text
field is allowed.
Note: Only the original message creator is allowed to modify the text.
# Request # Use bearer token for authorization POST /api/cowork/teams/3n1ytbwme7ngfyn9g9guwwurt/channels/3y8kdto0lnx3ig3mshwvrb9x7 /messages/00kunwmi6kgxy4j5qmft7uz0y HTTP/1.1 Accept: */* Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u {"text":"Hey there."} # Response HTTP/1.1 200 OK Content-Type: application/json { "id": "00kunwfaycw5sqp8gc8kc0jms", "text": "Hey there", "created": 1634031935796, "modified": 1634031935796, "userId": "sys02qmoxwlwprnnovhrxtx7n", "attachments": [], "reactions": [] }
# cURL example curl --request POST \ --url https://127.0.0.1:9000/api/cowork/admin/teams/3n1ytbwme7ngfyn9g9guwwurt/channels/3y8kdto0lnx3ig3mshwvrb9x7/botmessage \ --header 'Authorization: Bearer <access_token>' \ --header 'Content-Type: multipart/form-data' \ --form 'json={"text":"Hi there","attachments":[{"name":"first image.jpg","lastModified":1680774451041,"attachmentType":"Unknown","previewWidth":100,"previewHeight":100},{"name":"second image.jpg","lastModified":1680774451041,"attachmentType":"Unknown","previewWidth":100,"previewHeight":100}]}' \ --form attachment0=@/Users/dev/Downloads/image1.jpg \ --form attachment1=@/Users/dev/Downloads/image2.jpg