Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
aircall-everywhere
Advanced tools
Library to embed and communicate with aircall-phone in any webpage
npm install -s aircall-everywhere
You need to create an instance to use the library. The constructor has a settings argument:
onLogin
: Callback function after the phone is fully loaded, logged in, and the connexion between the phone and the CRM is established. This callback will triggers everytime the user logs again. User details and integration settings if any are passed as parameters.onLogout
: Callback function after the user logs out of the phone. It will triggers everytime the user logs out.integrationToLoad
: You can specify a CRM from which specific settings can be retrieved. Only zendesk
or hubspot
available for now. You can ignore this if you have your own CRM.domToLoadPhone
: You must specify in which element you want to load the phone. Query selector string.size
: You can specify a preset for the size of the phone loaded. 3 possibilities:
big
: 666px by 376px. Recommanded and default valuesmall
: 600px by 376pxauto
: 100% width and height. Not recommandeddebug
: Enables or disables logging. Defaults to true
.Example:
import AircallPhone from 'aircall-everywhere';
const aircallPhone = new AircallPhone({
onLogin: (settings) => {
console.log('phone loaded');
doStuff();
},
onLogout: () => {},
domToLoadPhone: '#phone',
integrationToLoad: 'zendesk',
size: 'big',
});
Settings passed in the onLogin
callback contains info about the user and integration and looks like this:
{
user: {
email: 'john@company.com',
first_name: 'John',
last_name: 'Smith',
company_name: 'Super Company Inc'
},
settings: {
<specific_integration_settings>
}
}
In addition to the onLogin
and onLogout
callbacks, a isLoggedIn
method is provided that will directly asks the phone about its status. The result is a boolean.
Example:
aircallPhone.isLoggedIn((res) => {
console.log('login status:', res);
});
You can send messages to the phone and listen messages coming from it.
All events from the phone with the payload associated:
incoming_call
: there is an incoming call, ringing.
{
from: '+15557543010',
to: '+15551234567',
call_id: 12345
}
call_end_ringtone
: the ringtone has ended. This event is only triggered for incoming calls.
{
answer_status: 'answered | disconnected | refused',
call_id: 12345
}
outgoing_call
: an outgoing call has started
{
from: '+15557543010',
to: '+15551234567',
call_id: 12345
}
outgoing_answered
: an outgoing call has been answered
{
call_id: 12345;
}
call_ended
: a call has been ended
{
duration: 20,
call_id: 12345
}
comment_saved
: a comment has been saved about a call
{
comment: 'This is a comment',
call_id: 12345
}
external_dial
: a dial has been made from outside of the phone (api/extension)
{
phone_number: '+15557543010';
}
powerdialer_updated
: a powerdialer campaign has been updated (via extension). There is no payload.redirect_event
: event coming from specific CRM settings if it has been enabled in the Aircall Dashboard. Only zendesk
and hubspot
is supported for now. This event data has this schema:
{
type: 'Zendesk::User' | 'Zendesk::Ticket'
id: <userId> | <ticketId>
}
call_id
parameter is a number per call.
duration
is in seconds.
All numbers are sent in the e.164
format.
Example:
aircallPhone.on('incoming_call', (callInfos) => {
console.log(`Call from ${callInfos.from} to ${callInfos.to}`);
doStuff();
});
Example:
aircallPhone.send('dial_number', { phone_number: number }, (success, data) => {
console.log('success of dial:', success);
});
The callback of the send
method has two arguments:
All generic errors from send
:
no_event_name
: the event name sent is not validnot_ready
: Phone is not loaded or logged in yetno_answer
: Phone didn't answer, most likely not logged indoes_not_exists
: The event sent does not existsinvalid_response
: Phone sent an malformed answer, should not happenunknown_error
: Should not happenList of events:
dial_number
: with {phone_number: <number>}
argument, you can ask the phone to dial the number.
Specific errors for this event:
in_call
: Phone is on a call, retry after the call is endedexit_keyboard
: with no argument, you can ask the phone to exit the keyboard view if it is on.
Specific errors for this event:
in_call
: Phone is on a call, retry after the call is endednot_in_keyboard
: Phone is not on keyboard screen, so it can't exit the keyboard :Dmore events to come...
You can remove a listener added by on
with this method.
<iframe>
authorizationsPlease be aware that aircall-everywhere
will generate an iframe with following allow
attributes.
<iframe
allow="microphone; autoplay; clipboard-read; clipboard-write; hid"
src="https://phone.aircall.io?integration=generic"
style="height:100%; width:100%;"
>
</iframe>
If you need to embed aircall-everywhere
in an <iframe>
you own, please be sure to propagate the allow
attributes like so
<!-- your iframe -->
<iframe src="your src here" allow="camera; microphone; clipboard-read; clipboard-write; hid">
<!-- iframe generated by aircall-everywhere -->
<iframe
allow="microphone; autoplay; clipboard-read; clipboard-write; hid"
src="https://phone.aircall.io?integration=generic"
style="height:100%; width:100%;"
>
</iframe>
</iframe>
The clipboard API is not accessible through <iframe>
since Chrome v81 and a policy has been added since Chrome v85. That's why aircall-everywhere
needs these attributes. More info here.
You can run the demo webpage with:
yarn start
tests are available:
yarn test
yarn test-watch
yarn coverage
to create a new version:
yarn version --patch|--minor|--major
and create a PR. The CI will publish the new version after manual approval.
A code coverage report is available here.
FAQs
Library to embed and communicate with aircall-phone in any webpage
The npm package aircall-everywhere receives a total of 2,737 weekly downloads. As such, aircall-everywhere popularity was classified as popular.
We found that aircall-everywhere demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.