Handling FB Messenger Messages

Learn how to build scalable Messaging applications using the Elarian customer engagement framework.

Sending

const customer = new client.Customer({
    number: 'YOUR-CUSTOMERS-MESSENGER-CHAT-ID',
    provider: 'facebook'
});

const resp = await customer.sendMessage(
  {
    number: 'YOUR-MESSENGER-BOT',
    channel: 'messenger'
  },
  {
    body: {
      text: 'Hello World!'
    }
  }
);

Receiving

client.on('receivedMessenger', (notification, customer, appData, callback) => {
  console.log(notification);
});