jgorset/facebook-messenger

Best way to use bot analytics providers?

Open

#178 opened on 2017年10月4日

GitHub で見る
 (2 comments) (1 reaction) (0 assignees)Ruby (215 forks)github user discovery
good first issuehelp wanted

Repository metrics

Stars
 (970 stars)
PR merge metrics
 (PR metrics pending)

説明

Since this gem creates a new message object different from the incoming payload, I was wondering whether anybody had thoughts on best way to integrate with bot analytics vendors?

Below is the json data that needs to be passed to typical vendors like dashbot.io via REST.

INCOMING

{
  "object": "page",
  "entry": [
    {
      "id": "943703799078240",
      "time": 1483257600000,
      "messaging": [
        {
          "sender": {
            "id": "1018952661536494"
          },
          "recipient": {
            "id": "943703799078240"
          },
          "timestamp": 1483257600000,
          "message": {
            "mid": "mid.1468531733396:9242db91fea253e355",
            "seq": 978,
            "text": "Hi, bot"
          }
        }
      ]
    }
  ]
}

OUTGOING

{
  "qs": {
    "access_token": "<YOUR ACCESS TOKEN>"
  },
  "uri": "https://graph.facebook.com/v2.6/me/messages",
  "json": {
    "message": {
      "text": "Hello, my human pet"
    },
    "recipient": {
      "id": "975099989272315"
    }
  },
  "method": "POST",
  "responseBody": {
    "recipient_id": "975099989272315",
    "message_id": "mid.1470371655004:4727480467538e9450"
  }
}

コントリビューターガイド