Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created August 12, 2020 01:16
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/64453d74f4c28b46b8a6c23b5118c14c to your computer and use it in GitHub Desktop.
Save jeznag/64453d74f4c28b46b8a6c23b5118c14c to your computer and use it in GitHub Desktop.
send automated reply to first reply from lead
info has_replied_before;
if(has_replied_before.toString() == "false")
{
update_payload = {"Has_replied_before":true};
update_resp = zoho.crm.updateRecord("Leads",lead_id,update_payload);
// now SMS the lead back
lead_data = zoho.crm.getRecordById("Leads",lead_id);
// From: the Twilio number you will use to send the message
from_number = "+61 123 457 686";
// To: the number to which the SMS should be sent
to_number = ifnull(lead_data.get("Mobile"),lead_data.get("Phone"));
// Message: the SMS you want to send
message_text = "Hi " + lead_data.get("First_Name") + ", thanks for replying. We'll be in touch soon";
// The To Name will appear in the SMS Message title, e.g. "Sent to John Smith on 23-Mar-2020"
to_name = lead_data.get("First_Name") + " " + lead_data.get("Last_Name");
payload = {"params":{"arguments":{"From":from_number,"To":to_number,"Message":message_text,"To_Name":to_name,"Entity_Type":"Lead","Entity_Id":lead_id}}};
sms_response = twiliosmsextension0.twiliosms(payload);
info sms_response;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment