Aircall Everywhere SDK
Building an integration with Aircall &
want your customers to make calls directly from it?
Aircall Everywhere lets you embed the Workspace 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 AircallWorkspace from 'aircall-everywhere'
Load Aircall Workspace
Informations about the Agent logged in are retrieved on load.
Click on the button to load the Aircall Workspace. You will then be able to toggle it via the workspace icon in the header of this page.
Detailed specifications of the AircallWorkspace
construction are available on our GitHub repository.
// user informations
const aircallWorkspace = new AircallWorkspace({
domToLoadWorkspace: '#workspace',
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...
workspace.on('incoming_call', callInfos => {
// ...
});
aircallWorkspace.on('call_end_ringtone', callInfos => {
// ...
});
aircallWorkspace.on('call_ended', callInfos => {
// ...
});
aircallWorkspace.on('comment_saved', callInfos => {
// ...
});
aircallWorkspace.on('outgoing_call', callInfos => {
// ...
});
aircallWorkspace.on('outgoing_answered', callInfos => {
// ...
});
Events to the workspace
You can send events to get information or perform actions.
Make sure the workspace is loaded before sending events to it!
// isLoggedIn result
// dial_number result
aircallWorkspace.isLoggedIn(response => {
// ...
});
const payload = {
phone_number: '+33123456789'
};
aircallWorkspace.send(
'dial_number',
payload,
(success, data) => {
// ...
}
);