Docs

Integrate Communications Functionality With CRM Modules

Build CRM that communicates with customers! Apifonica Web SDK allows you to embed voice and messaging features in your application.

Learn how to add communications features to existing CRM system.

What does this thing do?

This sample CRM application demonstrates how to add a click-to-call button to the existing application and provide SMS notifications service to the customers.

In this tutorial, we will show you how can easily modify the system so as it sends an SMS notification to a user when a new appointment is created for that user. We will also add the voice calls functionality so any user can be called within a click of a button.

Let’s get started!

Prerequisites

  1. Register at apifonica.com and create your Apifonica account.
  2. In your personal account, find your Apifonica account SID and password.
  3. Rent an Apifonica phone number to be used for calling and sending SMS notifications.

    You can rent a number from your Apifonica account.

  4. Download Apifonica Web SDK.

Step 1 – Add Voice Calls to the CRM

  1. Copy the following script:
    // Apifonica API parameters
    var rented_phone_num = 'your_phone_number';
    var rented_phone_pwd = 'your_phone_password';
    // Web site parameters
    var call_button_field = 'your_input_filed_for_phone_number';
    var call_button_text = 'your_text_for_call_button_on_html5';
    // Call Apifonica WebSDK functions
    start_call(rented_phone_num, rented_phone_pwd, $(call_button_field).val());
    $(call_button_field).parent().parent().html(call_button_text);
    
  2. Replace the sip_id value with your Apifonica phone number.
  3. Replace the sip_password value with the password for this number.

    You can find them in your personal account. Your account will be charged for the calls made from this number.

  4. Paste the updated script to the console.

    The Click-to-Call button replaces the customer’s phone. Clicking this button initiates a phone call.

For example:

// Apifonica API parameters
var rented_phone_num = '3584573973723';
var rented_phone_pwd = 'w29SlDE2uQ_0uEph';
// HITMEDICAL CRM parameters
var call_button_field = 'input[name=number]';
var call_button_text = 
    '<span id="ctcButton" class="btn btn-success btn-block">'
    + '<span id="timer">Call the patient</span></span>';
// Call Apifonica WebSDK functions
start_call(rented_phone_num, rented_phone_pwd, $(call_button_field).val());
$(call_button_field).parent().parent().html(call_button_text);

Step 2 – Enable SMS Notifications on the Appoinment Creation Event

  1. Copy the following script:
    // Apifonica API parameters
    var account_sid = 'your_account_sid_for_api_calls';
    var auth_token = 'your_auth_token_for_api_calls';
    var sms_enabled_number = 'your_number_for_sms';
    // Web site parameters
    var sms_template = 'your_template_with_sms_text';
    // Call Apifonica WebSDK functions
    start_sms(account_sid, auth_token, sms_enabled_number, sms_template);
    
  2. Replace the use_number value with your Apifonica phone number.
  3. Replace the account_sid value with your Apifonica account identifier.
  4. Replace the auth_token value with your Apifonica account password.

    You can find all the above in your personal account. Your account will be charged for the SMS notifications sent from this number.

  5. Paste the updated script to the console.

    The SMS notifications functionality is now active.

  6. Create a new appointment record and see that the SMS notification is automatically sent to the customer’s phone.

For example:

// Apifonica API parameters
var account_sid = 'acca11b31ed-0b68-3ebf-812a-18cfd84b9f2d';
var auth_token = 'aut07c54108-2793-36b3-9f59-e0153b3c2aac';
var sms_enabled_number = '353871452042';
// HITMEDICAL CRM parameters
var sms_template = 'You have the appointment to HITMEDICAL'
    + ' on {{procedure}} in of.{{place}} at {{time}}.'
    + ' To confirm the visit please send "{{id}} yes".'
    + ' To cancel - "{{id}} no".';
// Call Apifonica WebSDK functions
start_sms(account_sid, auth_token, sms_enabled_number, sms_template);