ダイレクトメッセージを送信する

やりとりを開始しているダイレクトメッセージにメッセージを投稿します。

メソッド

POST

URL

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

スコープ

topic.post

URL パラメーター

名前 説明
spaceKey 文字列 組織のキー
accountName 文字列 アカウント名

フォームパラメーター

名前 説明
message 文字列 投稿するメッセージ。最大 4000 文字
replyTo (任意) 数値 返信先の postId
showLinkMeta (任意) 真偽値 メッセージに含まれる URL の OGP 情報の表示設定。デフォルト値: true
ignoreHashtag (任意) 真偽値 投稿のハッシュタグ機能を無効化。デフォルト値:false
fileKeys[0] … fileKeys[4] (任意) 文字列 添付ファイルキー (添付ファイルのアップロード 参照)(最大 5 個まで)
talkIds[0] … talkIds[4] (任意) 数値 この投稿を追加したいまとめ ID (最大 5 個まで)
attachments[0].fileUrl … attachments[4].fileUrl (任意) 文字列 最大 5 個のファイル URL (最大ファイルサイズ: 10 MB)
attachments[0].fileName … attachments[4].fileName (任意) 文字列 パラメーターがない場合は ‘fileUrl’ からファイル名が設定 (最大 5 個まで)

レスポンスの例

{
    "space": {
        "key": "xxxxxxxx",
        "name": "Nulab Inc",
        "enabled": true,
        "imageUrl": "https://apps.nulab.com/spaces/xxxxxxxx/photo/large"
    },
    "topic": {
        "id": 6249,
        "name": "agata,masanori",
        "suggestion": "agata,masanori",
        "isDirectMessage": true,
        "lastPostedAt": "2018-11-26T01:29:16Z",
        "createdAt": "2018-09-25T06:28:07Z",
        "updatedAt": "2018-09-25T06:28:07Z",
        "description": ""
    },
    "post": {
        "id": 168198,
        "topicId": 6249,
        "replyTo": null,
        "message": "良いですね!",
        "account": {
            "id": 2488,
            "name": "masa",
            "fullName": "masa",
            "suggestion": "masa",
            "imageUrl": "https://typetalk.com/accounts/2488/profile_image.png?t=1453868694472",
            "isBot": false,
            "createdAt": "2016-01-26T08:17:39Z",
            "updatedAt": "2018-11-26T01:25:03Z"
        },
        "mention": null,
        "attachments": [],
        "likes": [],
        "talks": [],
        "links": [],
        "createdAt": "2018-11-26T01:29:16Z",
        "updatedAt": "2018-11-26T01:29:16Z"
    },
    "mentions": [],
    "exceedsAttachmentLimit": false,
    "directMessage": {
        "account": {
            "id": 2489,
            "name": "agata",
            "fullName": "Toshitaka Agata",
            "suggestion": "Toshitaka Agata",
            "imageUrl": "https://typetalk.com/accounts/2489/profile_image.png?t=1453867573519",
            "isBot": false,
            "createdAt": "2016-01-26T08:18:12Z",
            "updatedAt": "2018-11-22T08:19:23Z"
        }
    }
}

レスポンスのフォーマットは全て JSON です。GET メソッドは ETag に対応しているので、If-None-Match ヘッダを付けて送ると、変更がない場合は 304 を返します。日付のフォーマットは ISO 8601 で、UTC です。 (例 : 2014-01-09T06:20:08Z )