Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created April 15, 2022 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeznag/b9b75315ac2526bd0b0cbde7962bdc86 to your computer and use it in GitHub Desktop.
Save jeznag/b9b75315ac2526bd0b0cbde7962bdc86 to your computer and use it in GitHub Desktop.
automatically create a new lead when a missed call comes in from an unknown number
call_record = zoho.crm.getRecordById("Calls",call_id);
caller_phone_number = call_record.get("Subject").getSuffix("Missed call from ");
new_lead_data = {"First_Name":"Unknown","Last_Name":"From missed call from " + caller_phone_number,"Phone":caller_phone_number,"Lead_Source":"Missed Call from unknown number"};
create_resp = zoho.crm.createRecord("Leads",new_lead_data);
new_lead_id = create_resp.get("id");
update_call_payload = {"What_Id":new_lead_id,"$se_module":"Leads"};
update_resp = zoho.crm.updateRecord("Calls",call_id,update_call_payload);
info update_resp;
@AnadarPro
Copy link

Sorry for my ignorance, new to DELUGE. Where do I add this? Tried adding it as a function in Flow (fire it whenever there was a missed call) but got an error that call_id wasn't set. Thank you.

@jeznag
Copy link
Author

jeznag commented Apr 25, 2022

@SOCPilot I used it in a workflow rule. Refer to companion video: https://www.youtube.com/watch?v=b4YkO_2QsOs

@AnadarPro
Copy link

Great! Thank you. I had trouble with the video because it was a bit blurry but your comment got me in the right direction. For anyone else looking in the future who is as clueless as me, you need to define the callid variable based on the module data calling the function and then it works great from there. Thank you @jeznag!

Copy link

ghost commented May 20, 2022

I like this, is there a way of it recoginising if there is already a contact in the CRM?

@AnadarPro
Copy link

AnadarPro commented May 20, 2022 via email

Copy link

ghost commented May 20, 2022 via email

@AnadarPro
Copy link

AnadarPro commented May 20, 2022 via email

Copy link

ghost commented May 20, 2022 via email

@AnadarPro
Copy link

Sorry, was responding via email. I trimmed out all the extra content. Here's how I implemented it:

From ZOHO CRM:

  • Settings
  • Workflow Rules under Automation
  • Create a workflow
  • WHEN: On Missed Call
  • Condition: Applied to calls from unknown callers
  • Instant Action - this was a tricky part. I created a function. You need to set the name call_id (in @jeznag 's function) = Calls.Call ID. Then add the function. It will be executed when a missed call comes in that wasn't known.

Hope that helps.

Copy link

ghost commented May 20, 2022 via email

@AnadarPro
Copy link

Not sure if anyone knows, but is there a way to get the Caller ID information (specifically name)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment