試しに何かを入力してみたところ、送られてきた電文は以下の通りでした
{ "result": [ { "content": { "toType": 1, "createdTime": 1462347951739, "from": "[MID of the user who sent the message.]", 送信者のMID "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" 受信者のMID配列 ], "text": "てすと", "contentMetadata": { "AT_RECV_MODE": "2", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 1, "seq": null }, "createdTime": 1462347951776, "eventType": "138311609000106303", "from": "[Fixed value(ホントかな?) ]", "fromChannel": 1341301815, Fixed valueらしい "id": "[ID string to identify each event]", "to": [ "[MID value granted by the BOT API server’s Channel]" ], "toChannel": [Channel ID of the BOT API server] } ] }
送られてくるコンテンツ(文字列、画像、動画、音声、位置情報、スタンプ、連絡先)によって、content部分がいろいろ変化するみたいですね。どのコンテンツが送られてきているかは、そのcontent部分のcontentType (上記は1=文字列) で判定します。
contentType value | Description |
1 | Text message |
2 | Image message |
3 | Video message |
4 | Audio message |
7 | Location message |
8 | Sticker message |
10 | Contact message |
"content": { "toType": 1, "createdTime": 1462347951739, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": "てすと", "contentMetadata": { "AT_RECV_MODE": "2", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 1, "seq": null }
"content": { "toType": 1, "createdTime": 1462347958123, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": "", "contentMetadata": { "AT_RECV_MODE": "2", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 2, "seq": null }
"content": { "toType": 1, "createdTime": 1462348013683, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": "", "contentMetadata": { "AT_RECV_MODE": "2", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 3, "seq": null }
"content": { "toType": 1, "createdTime": 1462348038226, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": "", "contentMetadata": { "OBS_POP": "b", "AT_RECV_MODE": "2", "AUDLEN": "3064", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 4, "seq": null }
"content": { "toType": 1, "createdTime": 1462347972512, "from": "[MID of the user who sent the message.]", "location": { "title": "位置情報", "address": " 〒xxx-xxxx 東京都xxxxxxxxxxxxxxxxx", "latitude": [緯度], "longitude": [経度], "phone": null }, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": null, "contentMetadata": { "AT_RECV_MODE": "2", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 7, "seq": null }
"content": { "toType": 1, "createdTime": 1462347993325, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": null, "contentMetadata": { "STKTXT": "[スタンプ]", "AT_RECV_MODE": "2", "STKVER": "100", "STKID": "114", "STKPKGID": "1", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 8, "seq": null }
"content": { "toType": 1, "createdTime": 1462348079866, "from": "[MID of the user who sent the message.]", "location": null, "id": "[Identifier of the message]", "to": [ "[Array of user who will receive the message.]" ], "text": null, "contentMetadata": { "mid": "[連絡先のMID]", "AT_RECV_MODE": "2", "displayName": "[連絡先の名前]", "SKIP_BADGE_COUNT": "true" }, "deliveredTime": 0, "contentType": 10, "seq": null }
この記事は
現在のアクセス:1346