jgorset/facebook-messenger

Best way to use bot analytics providers?

Open

#178 aperta il 4 ott 2017

Vedi su GitHub
 (2 commenti) (1 reazione) (0 assegnatari)Ruby (215 fork)github user discovery
good first issuehelp wanted

Metriche repository

Star
 (970 star)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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"
  }
}

Guida contributor