https://developers.line.me/bot-api/getting-started-with-bot-api-trial#receiving_messages_operations
https://developers.line.me/bot-api/api-reference#receiving_messages
試しに何かを入力してみたところ、送られてきた電文は以下の通りでした
{ "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 |