Zoho Voice to CRM Signal function help
I (with the help of good ol’ ChatGPT) ((ok, mostly ChatGPT!!)) wrote a function and rule in Zoho Voice to send a Signal in CRM when a new incoming SMS is received, it runs successfully, but I don’t get the signal in CRM, even though a Contact has a matching phone number. Can someone help me troubleshoot?
The Rule in Zoho Voice is straightforward:
Condition is also straightforward:
And my Signal in CRM is configured as follows:
Here’s the function, which executes successfully:
// Define the Zoho CRM Signal API endpoint
crm_url = "https://www.zohoapis.com/crm/v2/signals";
// Extract SMS details from Zoho Voice
sms_from = data.get("sender_number");
sms_text = data.get("message_content");
// Initialize API request parameters
paramsMap = Map();
paramsMap.put("signal_namespace", "zohovoice_newincomingsms");
paramsMap.put("message", sms_text);
// Search for a matching Contact in Zoho CRM (Check both Phone & Mobile fields)
search_query = "(Phone:equals:" + sms_from + ") or (Mobile:equals:" + sms_from + ")";
search_response = zoho.crm.searchRecords("Contacts", search_query);
contact_id = null;
if (search_response.isEmpty() == false)
{
contact_id = search_response.get(0).get("id");
}
// If a Contact is found, send a Signal
if (contact_id != null)
{
contact_ids_list = List();
contact_ids_list.add(contact_id);
paramsMap.put("ids", contact_ids_list);
// Ensure headers are properly formatted
headersMap = Map();
headersMap.put("Content-Type", "application/json");
// Invoke the Zoho CRM Signal API using the OAuth Connection
response = invokeurl
[
url: crm_url
type: POST
parameters: paramsMap
headers: headersMap
connection: "crm_custom_connection"
];
// Log the response for debugging
info "Signal sent successfully: " + response;
}
else
{
info "No matching Contact found for SMS from: " + sms_from;
}
return;I’ve got the Service and Connection set up (had to do custom since Zoho Voice doesn’t have a default connection/service for CRM yet). It’s connected.
Any thoughts or guidance? Thanks!