Integrating your CRM/ERP/Desk with a PBX, such as Megacall, offers several advantages for businesses:
Access to a Large Client Database:
The integration allows your system to tap into the extensive Megacall client base of over 2 million users.
Your services become accessible to a broader audience without additional expenses for your clients.
Free Telephony Integration:
Clients can integrate telephony services, including PBX, API, and other integrations, without incurring additional costs.
This provides a cost-effective solution for clients looking to enhance their communication capabilities.
Global Coverage:
Megacall's worldwide coverage with support in seven languages, data centers on three continents, and virtual numbers in 100 countries ensures that your clients can be located anywhere in the world.
Testing and Promotion Opportunities:
If your website attracts over 30,000 users per month, Megacall is willing to test your integration and feature it on their website.
This exposure provides access to free traffic from top VoIP providers in Europe.
Main features
For CRM/Desk and other automation system developers, Megacall offers a manual for integrating their system with Megacall IP-telephony. The integration comes with the following main features:
Calls in one click from the CRM interface.
Pop-up notifications about incoming/outgoing calls with caller information and a link to the caller’s card.
Call statistics, and call recordings in the client’s card.
Automatic creation of contacts/leads/deals during a call from a new client.
Automatic routing of incoming calls to the responsible manager.
Client name display on your IP Phone during an incoming call.
Notifications about missed calls.
A curated blacklist for incoming calls.
Adding integration to the Megacall personal account.
The integration involves interactions with Megacall's API, which can be categorized into two parts:
- Requests from CRM to Megacall API:
These requests (POST, GET) are made from the CRM side to the Megacall API.
- Call Notifications (Webhook):
POST requests with information regarding calls are sent by Megacall's API to the CRM, facilitating real-time updates.
1. Integration Setup on Megacall's Side
Within the Megacall personal account:
Generate API authorization keys (Key and Secret).
Create a Virtual PBX and complete the Setup Wizard (Configure PBX extension lines with call recording corresponding to the number of CRM users and set up incoming call scenarios).
Assuming we have a Megacall account and a specific CRM with a URL address for the telephony module, such as:
https://mybestcrm.com/megacall
or
https://id12345678.mybestcrm.com/megacall
Going forward, we'll use the link https://mybestcrm.com/megacall as an example. Please replace it with the URL specific to your CRM.
In the Megacall personal account, navigate to Settings > API. In the "Notify me and send the data in the following events:" column, ensure that all types of notifications are checked. In the "Call notifications to the PBX" section, input your CRM's URL in the "Link to your website" field. Notifications about calls will be sent to this address.
To ensure the system accepts the link, add a verification code at the beginning of the script.
Example for PHP:
<?php if (isset($_GET['zd_echo'])) exit($_GET['zd_echo']); ?>
Link validation occurs after clicking the "Add" button. A random collection of symbols, such as 1234567, is sent to the link.
According to the provided PHP code, the link should send back the value without additional symbols, spaces, BOM sequences, etc. If the link doesn’t pass validation, check the returned value. Send a cURL request to your link by appending: ?zd_echo=1234567.
curl https://mybestcrm.com/megacall?zd_echo=1234567
The link should return the value 1234567. If it is empty or has a different value, validation was unsuccessful.
For enhanced security, it is recommended to allow access to your link only from the IP address 185.45.152.42. With each request to your link, you will receive an additional header "Signature," which can be used to verify data integrity and authenticity.
2. Integration Setup on the CRM Side
In the Megacall personal account, you already have a validated link to the CRM to receive call notifications, along with authorization keys created. Now, these keys need to be saved in the CRM. The CRM side should have a page for integration setup, referred to as "Telephony Settings." This page should encompass the following main parameters:
Fields for key authorization (Key and Secret).
Link to the telephony module in CRM, which was validated earlier (e.g., https://mybestcrm.com/megacall).
A list of users with an option to set a unique PBX extension number for each of them.
Retrieve a list of extension numbers using the method GET /v1/pbx/internal/.
From the received list of extension numbers, create a contextual menu for assigning an extension number to each CRM user. If an extension number is already assigned to a user, it should not be available for selection or assigned to another user.
It's recommended to designate one of the users as responsible by default by creating an appropriate checkbox on the telephony setup page. The default responsible user is an employee automatically assigned for events without a designated manager. For example, an incoming call from a new client directed to 5 extension numbers (5 CRM users) should not result in the loss of a client if none of them picks up. In such cases, an event can be created in CRM where a task or lead for a "Missed call from number" is added. If it is assigned to all 5 users, the client may receive 5 callbacks, which is not ideal. In this scenario, the event can be assigned to the default responsible user (e.g., a Sales Manager). If there is a pool of undealt leads in CRM and users autonomously take leads and become responsible according to an internal algorithm, the option to create a default responsible user can be skipped.
Typically, telephony settings in CRM are accessible only to users with administrator or manager access.
For call centers, displaying the remaining Megacall balance on the telephony settings page can be useful. Retrieve the balance using the method GET /v1/info/balance/.
3. Outgoing Calls from CRM Interface
3.1 WebRTC Widget for Calls from the Browser
If your CRM uses HTTPS, you can set up our widget. Note: Do not place the widget in public domains; otherwise, anyone will be able to make calls using your account. With every page load from the server code side, you need to generate a WebRTC key, which can be obtained using the method GET /v1/webrtc/get_key from our API (Key lifetime - 72 hours).
In your account on the Settings – Integrations and API page, in the section "WebRTC widget integration," you need to enter your CRM domain and choose widget display and placement settings. Then, use the obtained code to integrate it with your CRM. Instead of YOUR_KEY, place the key generated via API; instead of YOUR_SIP, input your SIP-number or the full PBX extension number login that will be used to make calls.
Code sample:
<script src="https://my.megacall.es/webphoneWebRTCWidget/v8/js/loader-phone-lib.js?v=17"></script>
<script src="https://my.megacall.es /webphoneWebRTCWidget/v8/js/loader-phone-fn.js?v=17"></script>
<script>
if (window.addEventListener) {
window.addEventListener('load', function() {
megacallWidgetFn('YOUR_KEY', 'YOUR_SIP', 'square' /*square|rounded*/, 'en' /*ru, en, es, fr, de, pl, ua*/, true, "{right:'10px',bottom:'5px'}");
}, false);
} else if (window.attachEvent) {
window.attachEvent('onload', function(){
megacallWidgetFn('YOUR_KEY', 'YOUR_SIP', 'square' /*square|rounded*/, 'en' /*ru, en, es, fr, de, pl, ua*/, true, "{right:'10px',bottom:'5px'}");
});
}
</script>
Hidden widget:
Expanded widget:
3.2 Callback Calls
In the CRM interface, next to each phone number, add an icon/button for call initiation to that phone number. We also recommend having a web phone with number dialling for calls to new numbers not previously saved in CRM. Outgoing calls are realized using the Callback principle. An IP phone or softphone for making and receiving calls has to be set up for PBX extension numbers. The CRM user clicks on the icon next to the number or a call button on the web phone; a Callback is sent from the CRM side.
Method GET /v1/request/callback/
Parameters:
from – three-digit PBX extension number assigned to the user.
to – the phone number that the user wants to call.
The user receives an incoming call to their softphone, takes it, and waits for the connection to the number he/she wants to reach.
Example:
4. Pop-up Call Notifications in the CRM Interface
When the PBX extension number receives or makes a call, there has to be an appropriate notification in CRM. The notification should only appear for the users whose extension numbers participate in the call.
The notification might contain the following information:
Phone number
Contact name/company/lead if the phone was previously saved in CRM, the name represents a link to the essence (contact/company/lead)
If the call is from a new client – a button to create a contact/company/lead
Name of the responsible employee if the call is from an existing client
The virtual number that received an incoming call (number connected to Megacall)
An event is a trigger for the pop-up notification NOTIFY_INTERNAL (start of the incoming call to PBX extension number) or an event NOTIFY_OUT_START (start of an outgoing call from PBX)
When the call is answered and the conversation starts, CRM will receive a notification NOTIFY_ANSWER (answer to the call on the extension number or external line), which will trigger a pop-up notification. When receiving NOTIFY_ANSWER, a call duration count can start in real-time in the notification, and the notification title “Call from 442037691880” can be changed to “Conversation with 442037691880”
When a call is ended, a notification will be sent NOTIFY_END (the end of the call to PBX extension number) or NOTIFY_OUT_END (the end of an outgoing call from PBX)
After receiving NOTIFY_END or NOTIFY_OUT_END, the pop-up notification has to close.
Realization example:
5. Audio Records and Call Statistics
To upload audio files from Megacall to CRM, call recording to the cloud has to be set up in the PBX extension number settings. After finishing a call, when the audio file is available for download, the CRM will receive a notification NOTIFY_RECORD (call recording is ready for download).
The call_id_with_rec parameter identifies the call, and with it, you can obtain the call recording using the method GET /v1/pbx/record/request/. The response will include a link to the audio file. If your CRM has cloud storage, the recording can be automatically uploaded there. If there is no storage, a play button can be added for audio playback directly from the link. The play button can be placed next to the information about the call, such as lead/contact/deal, and in general call statistics.
For creating general call statistics in CRM, the information received from NOTIFY_END and NOTIFY_OUT_END has to be utilized.
6. Automatic Contact/Lead/Deal Creation during a Call from a New Client
Automated creation of contacts, leads, deals, or requests in CRM during incoming calls from unknown numbers or outgoing calls to unknown numbers. When receiving or initiating a call, the phone number is cross-referenced with the CRM database, and if not found, a new contact/lead/deal/request can be generated and linked to the user making the call. It's advisable to configure distinct settings for automatic event creation for both incoming and outgoing calls.
For outgoing calls, the creation of an entity can occur at various stages: when the call is initiated (notification NOTIFY_OUT_START), when the call is answered (notification NOTIFY_ANSWER), or when the call concludes (notification NOTIFY_OUT_END). The phone number dialled is identified in the "destination" parameter.
In the case of incoming calls, the entity can be generated when the call is received by the CRM user's PBX extension number (notification NOTIFY_INTERNAL). The caller's number is identified in the "caller_id" parameter, allowing the user to access the client's card during the call for editing, note-taking, etc. After the call concludes, the notification NOTIFY_END indicates the PBX extension number that received the call, verified against the list of CRM users to identify the responsible party. Alternatively, the entity can be created after the call ends with the receipt of NOTIFY_END. Some CRM systems may provide manual control over entity creation, allowing agents to determine whether the call qualifies as a target and create a lead/contact/task manually.
7. Automatic Incoming Call Routing to the Responsible Employee
For incoming calls from existing clients, whose numbers are already stored in the CRM, the system automatically directs the call to the CRM user responsible for the client. This eliminates the need for the caller to go through the voice greeting and request connection to the specific agent they spoke to before; instead, the call is seamlessly routed to the responsible agent through the CRM user. This functionality is implemented using the NOTIFY_START notification.
The caller's number is identified in the "caller_id" parameter. If the number is previously saved in the CRM as a client's contact and has an assigned responsible agent, the incoming call can be directed to that specific agent.
Additionally, a call duration limit for the responsible agent can be set, for example, 15 seconds. If the responsible agent is unavailable within this timeframe, the client's call will revert to the voice menu, following the PBX scenario.
This is achieved by responding to the POST request NOTIFY_START.
{ "redirect": "101", "return_timeout": "15" }
Where:
redirect: PBX extension number (three-digit number).
return_timeout: Value in seconds (≥ 3) – the duration of the call to the extension number before it returns to the menu, with the recommended value being 15 or 20.
8. Client Name Display in IP-phone/Softphone
This feature enables the transmission of the client's name from the CRM to the IP Phone or softphone of the user handling an incoming call.
Implementation is carried out through the NOTIFY_START notification.
In response to this notification, the caller's number is provided in the "caller_id" parameter.
If the number is already associated with a client/contact/lead in the CRM, the client's name can be displayed using the following response format:
{ "caller_name": "IBM" }
Where:
caller_name: Client or company name stored in the CRM.
9. Missed Calls Reminders
In the event of an incoming call from a client, upon receiving the NOTIFY_END notification with the caller_id parameter containing the caller's number, you can identify the corresponding client/contact/lead and their assigned agent. If the call remains unanswered (indicated by the "disposition" parameter with a status of "Not Answered"), the responsible agent can initiate the creation of a task/reminder/notification to acknowledge the missed call from the client.
10. Blacklist in CRM
You have the option to compile a list of numbers for call rejection, and these numbers can be managed either on the telephony settings page or by adding a button for each user. Utilizing the NOTIFY_START notification and its corresponding response, if the caller's number in the caller_id parameter matches a number in the CRM blacklist, respond to NOTIFY_START with:
{ "redirect": "blacklist" }
11. Adding the Integration to Megacall Personal Account
After successful completion of the previous steps and one-user testing, you can submit a request to have your integration added to Megacall marketplace (if the monthly traffic of your system’s website exceed 30,000 users). This will allow any Megacall user with an active account and set PBX to use the integration. It will also allow the end-user to quickly and conveniently save all the necessary settings.
Requests have to be directed to the email "integration@megacall.es" with a subject "Request to add integration with [Name of your СRM] system to Megacall marketplace". The request has to contain the following additional information:
URL-address in your CRM for integration enabling
The information about the Megacall user, who tries to integrate the telephony and your CRM, will be sent to this address. In a chosen format (GET, POST) you will receive a unique user identification in a form of md5 hash line. In response, you have to send back a randomly generated key, which will be assigned to this user.
In the future for each request to your CRM system, the user identification and hash sent by you will be used as user’s verification data with a title:
Authorization: Bearer [userId . hash]
User identification will also be sent in each call notification in the field zdUserId. Examples of possible answers are necessary.
URL-address in your CRM for integration disabling
A request to disable the integration will be sent to this address. The standard Bearer authorization is used.
URL-address in your CRM for call notifications
Call notifications are sent to all integrated users. The user can be identified via the field zdUserId. Notification format can be found on the API description page. The standard Bearer authorization is used.
URL-address to your CRM which can be addressed to receive the client’s name by the phone number
Necessary for the feature “Client name display on softphone”. An example of a request and possible answers is necessary. The standard Bearer authorization is used.
(Optional) URL-address in your CRM which can be addressed to receive a list of managers
Necessary for the feature “Connecting managers to PBX extension numbers”. This will allow the user to compare the list of CRM managers and Megacall PBX extension numbers. In case there is a need to sync this information with your CRM, you have to also specify the URL-address to send it to in JSON-format. An example of a request and possible answers is necessary. The standard Bearer authorization is used.
Displayed name of the author of the integration (can be your company name and a link to the main page)
Integration logo in PNG format on a transparent background, size 500 x 150px
We recommend to make features from items 6-10 optional so that the end-user can enable/disable needed features on the page “Telephony settings” in CRM
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article