Skip to content

Instantly share code, notes, and snippets.

// Set the messenger to open fullscreen
FxoMessenger.setConfig({
fullscreen: true
});
// Set header text and color
FxoMessenger.setConfig({
headerText: 'Chat to Us',
color: '#4B0082'
});
// Send a simple message
FxoMessenger.sendMessage('Hey!');
// Send a message with metadata
FxoMessenger.sendMessage('Hey!', {
user_id: 12345,
name: 'John Doe'
});
// Wait until the messenger is fully
// ready, then send a message
FxoMessenger.on('stateChanged', function(state) {
if (state === 'connected') {
FxoMessenger.sendMessage('Hey!');
}
});
// Subscribe to all messages received,
// logging them to the console