The first thing you'll need to do is turn on Webhooks within Sonar so you receive information when new things happen in Messenger.
Messages
For all send/received Facebook messages, you'll receive a webhook like usual but with an additional property of type.
{
'action' => 'new_assigned_message',
'text' => 'hello',
'type' => 'FBMessage',
'direction' => 'received',
'from_name' => 'Joe Customer',
'link' => customer.customer_full_url,
'media_url' => 'https://www.google.com',
'customer' => {
'first_name' => 'Joe',
'last_name' => 'Customer',
'phone_number' => '',
'fb_id' => '1234',
'email' => '[email protected]'
}
}