#topicpath ---- #contents 試しに何かを入力してみたところ、送られてきた電文は以下の通りでした { "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| ***Text message [#r895d3d0] "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 } ***Image message [#d70f1cf9] "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 } ***Video message [#v388b26f] "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 } ***Audio message [#lfedba6b] "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 } ***Location message [#xb72baa0] "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 } ***Sticker message [#d21a839e] "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 } ***Contact message [#t10f729f] "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 } **関連リンク [#xa828190] -[[LINE Developers - BOT API - Getting started with BOT API Trial>https://developers.line.me/bot-api/getting-started-with-bot-api-trial#receiving_messages_operations]] -[[LINE Developers - BOT API - API reference>https://developers.line.me/bot-api/api-reference#receiving_messages]] ---- この記事は #vote(おもしろかった,そうでもない) #comment #topicpath SIZE(10){現在のアクセス:&counter;}