Search messages

Search messages by various criteria.

Method

GET

URL

https://typetalk.com/api/v2/search/posts

Scope

topic.read

Query parameters

Name Type Description
q String Keyword to search
spaceKey String Space key
topicIds (Optional) Number Topic ID
hasAttachments (Optional) Boolean Search only posts with attachments. default value: false
accountIds (Optional) Number Account ID
start (Optional) Number Start position for searching posts.
from (Optional) DateTime Start date for searching posts.
to (Optional) DateTime End date for searching posts.
botExclusion (Optional) Boolean Exclude bot posts from search results. default value: false

Response Example

{
    "count": 32,
    "posts": [
        {
            "id": 11842896,
            "topicId": 53692,
            "topic": {
                "id": 53692,
                "name": "Awesome project",
                "suggestion": "Awesome project",
                "isDirectMessage": false,
                "lastPostedAt": "2017-10-12T06:20:40Z",
                "createdAt": "2017-09-27T09:43:29Z",
                "updatedAt": "2017-10-12T06:22:28Z"
            },
            "replyTo": null,
            "message": "It is sunny today.",
            "account": {
                "id": 50117,
                "name": "Michael",
                "fullName": "Michael Buck",
                "suggestion": "Michael Buck",
                "imageUrl": "https://typetalk.com/accounts/50117/profile_image.png?t=1504408579564",
                "isBot": false,
                "createdAt": "2017-09-01T01:55:05Z",
                "updatedAt": "2017-10-12T07:15:40Z"
            },
            "attachments": [],
            "links": [],
            "directMessage": null,
            "createdAt": "2017-10-12T06:20:20Z",
            "updatedAt": "2017-10-12T06:20:20Z"
        }
    ],
    "isLimited": false
}

All responses are formatted in JSON and include an ETag. If you call an API with an If-None-Match header, the server will return a 304 status code if the data is unchanged. The date and time format is ISO 8601, and the timezone is UTC (eg. 2014-01-09T06:20:08Z).