Aircall Everywhere SDK
Building an integration with Aircall &
want your customers to make calls directly from it?
Aircall Everywhere lets you embed the Phone app
inside your website in a few small steps!
Installation
You just have to add this repository in your project, and then import the library in your code.
Check the following demo on how to use this library!
npm install -s aircall-everywhere
import AircallPhone from 'aircall-everywhere'
Load Aircall Phone
Informations about the Agent logged in are retrieved on load.
Click on the button to load the Aircall Phone. You will then be able to toggle it via the phone icon in the header of this page.
Detailed specifications of the AircallPhone
construction are available on our GitHub repository.
// user informations
const phone = new AircallPhone({
domToLoadPhone: '#phone',
onLogin: settings => {
// ...
},
onLogout: () => {
// ...
}
});
Call lifecycle events
There are multiple events happening during the lifecycle of a phone call. Try making an outbound or inbound call to see what happens!
The list of all available events is documented on our Github repo.
Waiting for events...
phone.on('incoming_call', callInfos => {
// ...
});
phone.on('call_end_ringtone', callInfos => {
// ...
});
phone.on('call_ended', callInfos => {
// ...
});
phone.on('comment_saved', callInfos => {
// ...
});
phone.on('outgoing_call', callInfos => {
// ...
});
phone.on('outgoing_answered', callInfos => {
// ...
});
Events to the phone
You can send events to get information or perform actions.
Make sure the phone is loaded before sending events to it!
// isLoggedIn result
// dial_number result
phone.isLoggedIn(response => {
// ...
});
const payload = {
phone_number: '+33123456789'
};
phone.send(
'dial_number',
payload,
(success, data) => {
// ...
}
);