Overview
Integration with CallTrackingMetrics (CTM) allows Sunwave users to receive calls from within Sunwave. When a call is received through CTM, a notification will appear in Sunwave allowing the user to accept the call and the new Opportunity dialog will appear.
Configure Field Mappings
Depending on how the customer has configured CTM, some of the exact field names may vary.
Minimally, the following fields should be mapped in Phone Setup to their corresponding values in Sunwave:
Phone Campaign Param Name: source
Phone Campaign ID Param Name: source_id
Phone ANU Param Name: caller_number_format
Note: there are some alternate phone formats that can be used if the customer prefers, for example:
business_number: +14075209970
business_number_format: (407) 520-9970
caller_number_format: (407) 520-9970
caller_number_complete: +14075209970
caller_number_bare: 4075209970
caller_number: +14075209970
Phone State Param Name: state
Phone City Param Name: city
Phone Setup also provides the ability to map up to 10 additional custom fields from CTM.
To look at what fields are being sent to Sunwave from CTM:
In CTM, go to Settings > Webhooks, then click API Logs in the banner at top:
Find a recent call to the Sunwave webhook and click the JSON link to view the payload sent to Sunwave:
Identify the field you want to map in Sunwave. For example, say the customer wants to capture the zip code of the caller which you can see in the screenshot below is returned in a field called postal_code:
In Phone Setup, enter the CTM field name in Name Custom1, and enter the friendly name in Description Custom1 for how you want the corresponding field to be labeled in Sunwave (“Zip”) in the example below:
Click Save.
In CRM > Calls Dynamic Report, you will now see the newly configured field:
NOTE: CTM fields get populated over time and not all attributes may be available at the time the Sunwave webhook is called. If you are seeing values populated in the CTM API Logs that are not appearing in Sunwave, you may need to customize the Sunwave Webhook and CTM configuration using delays and triggers to trigger the Sunwave Webhook at a later point in the call to allow time for them to appear (this will have an effect on when the pop-up appears in Sunwave).
Create Test Campaign in Sunwave
Create a campaign in Sunwave to use for testing the CTM configuration:
CRM>Manage Campaigns
Click +New Campaign
Enter a Campaign Name and Campaign Type, then click Add:
The campaign Name and/or ID for the campaign will be used to associate Tracking Numbers in CTM with their corresponding campaigns in Sunwave.
Map Test Campaign to Tracking Number in CTM
Login to http://app.calltrackingmetrics.com using the username and password of the clients' Admin CTM account.
Campaigns in Sunwave correspond to Tracking Numbers in CTM. Navigate to Numbers > Tracking Numbers using the left menu:
Click the EDIT button on the Tracking Number to associate with the test campaign you created in Sunwave:
A Tracking Number in CTM can be mapped to a Sunwave Campaigns based one or both of the following methods:
Ensure the Tracking Source name associated with the Tracking Number in CTM is identical to the Campaign Name in Sunwave:
Add the campaign ID from Sunwave to the Source Settings > Source Tag attribute on the Tracking Source in CTM:
After verifying that incoming calls including campaign information are being captured in Sunwave, these steps will need to be repeated for each actual Sunwave Campaign and associated Tracking Number / Tracking Source in CTM.
Map CallTrackingMetrics Users to Sunwave Users
Go to Settings in CTM, then select Manage Users.
Search for the User’s number you wish to replace, then click Edit.
Copy the unique ID that's in the URL at the top of the screen (see example below)
In Sunwave, go to Practice Setup > Users.
Click on the corresponding Sunwave User to edit.
Enter the user’s unique ID from CTM (taken from URL)in the Station ID field:
Configure Webhook for Inbound Calls
To configure inbound calls in CTM:
Click on the dropdown on your user profile, select Account Settings:
From the left menu, select API Integration, then click on Webhooks:
Click New Webhook, then configure the following settings:
General > Name: Sunwave Webhook
General > Trigger: When an agent answers a call within a call queue [answered]
Connection > Callback URL: https://emr.sunwavehealth.com/SunwaveEMR/phoneWebHook?sunwave_public_key=***********&sunwave_private_key=***********&station_id=agent_id
NOTE: sunwave_public_key and sunwave_private_key can be found in Sunwave under Phone Setup.
NOTE: Make sure there are no extra whitespace characters at the end of this URL.
Click Save Changes to save the new Webhook.
Configure Webhook for Missed Calls
To configure inbound calls in CTM:
Click on the dropdown on your user profile, select Account Settings:
From the left menu, select API Integration, then click on Webhooks:
Click New Webhook, then configure the following settings:
General > Name: Sunwave Webhook Missed Calls
General > Trigger: When a call ends immediately without delay [end_immediate]
Connection > Callback URL: https://emr.sunwavehealth.com/SunwaveEMR/phoneWebHook?sunwave_public_key=***********&sunwave_private_key=***********&station_id=dial_status
NOTE: sunwave_public_key and sunwave_private_key can be found in Sunwave under Phone Setup.
NOTE: Make sure there are no extra whitespace characters at the end of this URL.
Click Save Changes to save the new Webhook.
Configure Webhook for Outbound Calls
When configured, this webhook allow Sunwave to track outbound calls made from the CTM softphone. Outbound Calls will show in the CRM Calls:
If the outbound number called matches the phone number associated with a Sunwave Opportunity, it will automatically be associated with the Account and Opportunity. Here is an example of how an outbound phone call appears in the Timeline of an Opportunity:
Outbound calls will also appear in the Calls Dynamic Report:
Related Fields:
Direction - indicates whether the call is an inbound vs. outbound call.
Caller Id - for outbound calls, this represents the phone number that was dialed (NOT the number of the person calling).
Outcome - indicates the result of the outbound call, for example ‘connected’ or ‘no answer’.
To configure outbound calls in CTM:
Click on the dropdown on your user profile, select Account Settings:
From the left menu, select API Integration, then click on Webhooks:
Click New Webhook, then configure the following settings:
General > Name: Sunwave Outbound Calls
General > Trigger: At the end of a call/form/chat, once all data has been captured [end]
Connection > Callback URL: https://emr.sunwavehealth.com/SunwaveEMR/phoneWebHook?method=ctm_callback&sunwave_public_key=***********&sunwave_private_key=**********
NOTE: sunwave_public_key and sunwave_private_key can be found in Sunwave under Phone Setup.
NOTE: Make sure there are no extra whitespace characters at the end of this URL.
Click Save Changes to save the new Webhook.
Enable CTM Softphone on Sunwave Users to Receive Inbound Calls and Make Outbound Calls
NOTE: Currently only Engineering has access to this setting (see SUN-1751)
In Sunwave, go to Practice Setup > Users.
Click on the corresponding Sunwave User to edit.
Under User Specific, enable the CTM Softphone option:
Configuration Tips
ngrok:
https connection works only with the paid subscription
do not sign up for the ngrok account: even to stop the service they require to upgrade to paid subscription
if you signed up and you need to restart the service, you need to delete the ngrok configuration file from your user directory: C:\Users\${username}\AppData\Local\ngrok
ngrok has 10 call forwarding attempts limit. If you tested 10 calls, 11th call will not go through. Just stop and restart the ngrok
apache
run apache on a non-https port, ex. 8080
if you run https locally, the easiest way I found was to install a separate apache server and configure server.xml by copying resources from https server configuration
station ID
The easiest way to get station id from CRM is to get it from the test call json file: