Available events
In this article
ready
- `ready` - is fired when continually is initialized and ready to use.
Just one parameter is provided for listener - continually object
Usage
continually.on('ready', function(api){ api.on('emailCapture', function(event){ console.log(event); console.log('emailCapture'); }); });
api
- is a Continually object, can be used to define other event listeners
welcomeMessage:open
welcomeMessage:open
- is fired when continually widget appears. The event isn’t fired if conversation format is ‘hidden’
Usage
continually.on('welcomeMessage:open', function(event){ console.log(event.widget); });
The console output will be:
- sidebarOpen: false
- isOnline: false|true,
- widgetVisible: true
Where event.widget.widgetVisible = true
means that widget is shown
welcomeMessage:close
- `welcomeMessage:close` - is fired when a lead closes continually message.
Usage
continually.on('welcomeMessage:close', function(event){ console.log(event.widget); });
The console output will be:
- sidebarOpen: false,
- isOnline: false|true,
- widgetVisible: false
Where event.widget.widgetVisible = false means that message is turned into bubble, i.e. closed
sidebarOpen
- `sidebarOpen` - is fired when a lead clicks on continually message/button/their own element with ‘continually’ class - i.e when sidebar is opened.
Usage
continually.on('sidebarOpen', function(event){ console.log(event.widget); });
The console output will be:
- sidebarOpen: true,
- isOnline: false|true,
- widgetVisible: true|false
Where event.widget.sidebarOpen = true means that sidebar is shown
sidebarClose
- `sidebarClose` - is fired when a lead clicks on sidebar close button.
Usage
continually.on('sidebarClose', function(event){ console.log(event.widget); });
The console output will be:
- sidebarOpen: false,
- isOnline:false|true,
- widgetVisible: true|false
Where event.widget.sidebarOpen = false means that sidebar is closed
startConversation
- `startConversation` - the startConversation event fires when the user starts a new chat.
Usage
continually.on('startConversation', function(event){
console.log('company id - ' + event.companyId);
console.log('conversation id - ' + event.conversationId);
console.log('team member - ' + JSON.stringify(event.teamMember));
});
The console output will be:
- company id - 463eykw6ynvj
- conversation id - 6wkym24k3re2
- team member - {"id":"k98rezxkyepm","name":"John Smith"}
Usage
continually.on('startConversation', function(event){ console.log('company id - ' + event.companyId); console.log('conversation id - ' + event.conversationId); console.log('team member - ' + JSON.stringify(event.teamMember)); });
The console output will be:
- company id - 463eykw6ynvj
- conversation id - 6wkym24k3re2
- team member - {"id":"k98rezxkyepm","name":"John Smith"}
completeConversation
- `completeConversation` - the event fires when the user completes conversation.
Usage
continually.on('completeConversation', function(event){ console.log('conversation id - ' + event.conversationId); });
The console output will be:
conversation id - 6wkym24k3re2
message
- `message` - the message event fires when the user receives a message from a team member.
Usage
continually.on('message', function(event){ console.log('message: ' + event.message); });
The console output will be:
message: When suits you for a demo?
message:sent
- `message:sent` - The message:sent event fires when the user replies to a conversation
Usage:
continually.on('message:sent', function(event){ console.log('message: ' + event.message); console.log('response: ' + event.response); });
The console output will be:
- message: How are you?
- response: Fine (i.e. user’s output, for multiple answers question there will be a list of chosen answers separated by comma like ‘Product 1, Product 2, Product 3’)
emailCapture
- `emailCapture` - the event fires when a user provides their email, either for email or for appointment question
Usage
continually.on('emailCapture', function(event){ console.log('email: ' + event.lead.email); });
The console output will be:
email: test@example.com
We try to return as much data as possible for a lead if we have it for the user email. So, event.lead object should be checked if name, company and phone fields are not null. If we know name, phone or company for the user, appropriate questions would not be shown for a lead, and appropriate events won’t fire.
nameCapture
- `nameCapture` - the event fires when a user provides their name
Usage
continually.on('nameCapture', function(event){ console.log('name: ' + event.lead.name); });
The console output will be:
name: Kurt Russell
phoneCapture
- `phoneCapture` - the event fires when a user provides their phone
Usage
continually.on('phoneCapture', function(event){ console.log('phone: ' + event.lead.phone); });
The console output will be:
phone: +1234567890
companyCapture
- `companyCapture` - the event fires when a user provides their company
Usage;
continually.on('companyCapture', function(event){ console.log('company: ' + event.lead.company); });
The console output will be:
company: Acme
scheduling:requestMeeting
- `scheduling:requestMeeting` - the event fires once a lead is provided with Appointment question with a calendar connected
Usage
continually.on('scheduling:requestMeeting', function(event){ console.log("Appointment question is shown, calendar " + event.teamMember.name); });
The console output will be:
Appointment question is shown, calendar John Smith
scheduling:meetingBooked
- `scheduling:meetingBooked` - the event fires if a lead confirms appointment request (by choosing a timeslot, event doesn’t fire if a lead proposes custom time)
Usage
continually.on('scheduling:meetingBooked', function(event){ console.log(event.appointment); });
The console output will be:
- "timeUTC": "2018-08-29T06:30:00+00:00",
- "leadTimezone": "Europe/London",
- "companyTimezone": "Europe/Amsterdam",
- "duration": 30
Where
timeUTC
is the scheduled time specified in UTC timezoneleadTimezone
is the timezone that the lead chose in the appointment questioncompanyTimezone
is the timezone specified on the calendar settings page by the bot owner,duration
is the meeting duration in minutes