Created
August 12, 2020 01:16
-
-
Save jeznag/64453d74f4c28b46b8a6c23b5118c14c to your computer and use it in GitHub Desktop.
send automated reply to first reply from lead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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