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 valueDescription
1Text message
2Image message
3Video message
4Audio message
7Location message
8Sticker message
10Contact message

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS