Get direct messages

Method

GET

URL

https://typetalk.com/api/v2/spaces/:spaceKey/messages/@:accountName 

Scope

topic.read

URL parameters

Name Type Description
spaceKey String Space key
accountName String Account name

Query parameters

Name Type Description
count (Optional) Number default value: 20, maximum: 200
from (Optional) Number references Post ID
direction (Optional) String “backward” or “forward”

Response Example

{
    "topic": {
        "id": 3917,
        "name": "Jessica,StefHull",
        "suggestion": "Jessica,StefHull",
        "isDirectMessage": true,
        "lastPostedAt": "2018-11-26T01:09:12Z",
        "createdAt": "2016-07-06T02:51:03Z",
        "updatedAt": "2016-08-17T08:30:58Z"
    },
    "mySpace": {
        "space": {
            "key": "xxxxxxxx",
            "name": "Awesome Tech Inc.",
            "enabled": true,
            "imageUrl": "https://apps.nulab-inc.com/spaces/xxxxxxxx/photo/large"
        },
        "myRole": "ADMIN",
        "isPaymentAdmin": true,
        "invitableRoles": [
            "ADMIN",
            "USER",
            "GUEST"
        ],
        "myPlan": {
            "plan": {
                "key": "typetalk.standard10",
                "name": "Standard 10 Users",
                "limitNumberOfUsers": 10,
                "limitNumberOfAllowedAddresses": 10,
                "limitTotalAttachmentSize": 10737418240
            },
            "enabled": true,
            "trial": null,
            "numberOfUsers": 4,
            "numberOfAllowedAddresses": 0,
            "totalAttachmentSize": 14356,
            "createdAt": "2016-01-27T09:37:27Z",
            "updatedAt": "2018-11-09T10:33:30Z"
        }
    },
    "directMessage": {
        "account": {
            "id": 2498,
            "name": "Stefanie",
            "fullName": "Stefanie",
            "suggestion": "Stefanie",
            "imageUrl": "https://typetalk.com/accounts/2498/profile_image.png?t=1453891479138",
            "isBot": false,
            "createdAt": "2016-01-27T09:55:09Z",
            "updatedAt": "2018-11-09T10:29:47Z"
        },
        "status": {
            "presence": "away",
            "web": null,
            "mobile": null
        }
    },
    "bookmark": {
        "postId": 168196,
        "updatedAt": "2018-11-26T01:09:13Z"
    },
    "posts": [
        {
            "id": 164783,
            "topicId": 3917,
            "replyTo": null,
            "message": "Hey",
            "account": {
                "id": 2498,
                "name": "Stefanie",
                "fullName": "Stefanie",
                "suggestion": "Stefanie",
                "imageUrl": "https://typetalk.com/accounts/2498/profile_image.png?t=1453891479138",
                "isBot": false,
                "createdAt": "2016-01-27T09:55:09Z",
                "updatedAt": "2018-11-09T10:29:47Z"
            },
            "mention": null,
            "attachments": [],
            "likes": [],
            "talks": [],
            "links": [],
            "createdAt": "2018-04-27T09:12:25Z",
            "updatedAt": "2018-04-27T09:12:25Z"
        },
        {
            "id": 164784,
            "topicId": 3917,
            "replyTo": null,
            "message": "Can I ask you a question?",
            "account": {
                "id": 2498,
                "name": "Stefanie",
                "fullName": "Stefanie",
                "suggestion": "Stefanie",
                "imageUrl": "https://typetalk.com/accounts/2498/profile_image.png?t=1453891479138",
                "isBot": false,
                "createdAt": "2016-01-27T09:55:09Z",
                "updatedAt": "2018-11-09T10:29:47Z"
            },
            "mention": null,
            "attachments": [],
            "likes": [],
            "talks": [],
            "links": [],
            "createdAt": "2018-04-27T09:13:02Z",
            "updatedAt": "2018-04-27T09:13:02Z"
        },
        {
            "id": 168196,
            "topicId": 3917,
            "replyTo": null,
            "message": "Sure!",
            "account": {
                "id": 2500,
                "name": "Jessica",
                "fullName": "Jessica",
                "suggestion": "Jessica",
                "imageUrl": "https://typetalk.com/accounts/2500/profile_image.png?t=1454061730873",
                "isBot": false,
                "createdAt": "2016-01-27T09:55:35Z",
                "updatedAt": "2018-11-26T05:12:25Z"
            },
            "mention": null,
            "attachments": [],
            "likes": [],
            "talks": [],
            "links": [],
            "createdAt": "2018-11-26T01:09:12Z",
            "updatedAt": "2018-11-26T01:09:12Z"
        }
    ],
    "hasNext": 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).