Facebook Messenger Chatbot Custom Event Tracking
Asked Answered
S

2

8

I am trying to log custom events with a Facebook Chatbot I have developed, however I cannot for the life of me find a reference for the custom_events types.

The example listed on their reference shows fb_mobile_purchase as a custom eventName. I don't want that, and I can't find anywhere that lists other types.

I want to be able to track when the chatbot sends the user a specific message, but just setting the eventName to anything results in an event name in the Analytics as Reserved5.

Is there a reference to eventNames anywhere within Facebook Documentation?

Szechwan answered 24/2, 2017 at 12:9 Comment(2)
The very definition of “custom” here is that you specify how the event should be named. “I want to be able to track when the chatbot sends the user a specific message” – why would you need to track that using events? It is your bot that sent the message, so you already know that it has happened.Genesis
Unfortunately, as I stated above, the custom name shows up as Reserved5 in the analytics. I need to be able to track when a specific message is sent to the user, as it stands, the analytics only says that any message was sent, but not what that message was.Szechwan
F
1

You could consider using Chatbase for bot analytics (free to use), which has a Custom Events API.

Forbidden answered 12/1, 2018 at 22:19 Comment(0)
J
0

Currently the docs give this as an example request:

var request = require('request');

request.post({ 
  url : "https://graph.facebook.com/<app_id>/activities",
  form: {
    event: 'CUSTOM_APP_EVENTS',
    custom_events: JSON.stringify([{
      _eventName: "fb_mobile_purchase",
      _valueToSum: 55.22,
      _fb_currency: 'USD'
    }]),
    advertiser_tracking_enabled: 0,
    application_tracking_enabled: 0,
    extinfo: JSON.stringify(['mb1']),
    page_id: <page_id>,
    page_scoped_user_id: recipientId
  }
}, function(err,httpResponse,body){ 
  console.error(err);
  console.log(httpResponse.statusCode);
  console.log(body);
});

So, when the bot is sending that specific message you want to keep an eye out for, fire that message but with a different _eventName, and if needed other parameters.

Keep in mind, by recipientId they mean the PSID of the user the bot is sending the message to.

Juvenility answered 20/10, 2017 at 23:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.