Search for CoWork messages using a search phrase, just as in the CoWork UI.
Searches for a given query and returns a list of messages, their properties and optional the text content.
{ "query": "<Query String>", "messageCount": "<Amount of messages>", "startOffset": "<Offset within amount>", "textFormat": "<None, Original, Plain, HTML as format>" }
REQUEST Field | Value Type | Description |
---|---|---|
query | String | The query string, just as you would use it in the search of CoWork itself |
messageCount | Number | Amount of messages that the search should include, by default 100. |
startOffset | Number | The index from where to return the messages found, by default 0. |
textFormat | String | The following values can be used: |
None - the text is not returned (default) |
||
Original - the text as typed by the author |
||
Plain - the text converted to HTML and then to plain text. That means, e.g. emojis are translated |
||
HTML - the text converted to HTML |
Note: The amount of messages returned to the user is messageCount - startOffset
. That allows to create a message window that respects the sorting order of messages.
[ { "messageId": "<GUID of the message>", "teamId": "<GUID of the team>", "channelId": "<GUID of the channel>", "userId": "<GUID of the user>", "text": "<The optional message text>", }, ... ]
RESPONSE Field | Value Type | Description |
---|---|---|
messageId | GUID | The GUID of the message addressed by this result. |
teamId | GUID | The GUID of the team this message was found in. |
channelId | GUID | The GUID of the channel this message was found in. |
userId | GUID | The GUID of the user who wrote the message. |
message | Boolean | The optional message text of this result. |
# Request # Use user:password for authorization POST /api/cowork/search HTTP/1.1 Accept: */* Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u {"query":"Channel:News Time:15d","textFormat":"Original"} # Response HTTP/1.1 200 OK Content-Type: application/json [ { "messageId": "00liabidksw87hb0ywi1346uj", "teamId": "4dweeqnssgw7jgcs8xw0c13i", "channelId": "31646d06t7ca7wlgcfyqx3jx7", "userId": "weeBhY2Nlc3MgdGwe9rZ7cas8", "text": "These are the most recent news from today." }]