Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created January 25, 2024 20:47
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/45bdf3ed1e163248a064df4cfc9c4784 to your computer and use it in GitHub Desktop.
Save jeznag/45bdf3ed1e163248a064df4cfc9c4784 to your computer and use it in GitHub Desktop.
Send SMS from Zoho CRM
// Choose from number
from_number = "+234324324324";
module_name = "Leads";
record_id = 803228000138359036;
crm_record = zoho.crm.getRecordById(module_name, record_id);
to_number = crm_record.get("Mobile");
record_name = crm_record.get("First_Name") + " " + crm_record.get("Last_Name");
message_text = "🤒 Unfortunately your Orientation on " + 123 + " has been canceled due to staff illness. If concerned, contact - 1300 077 994. 🐾💞";
// leave media_urls as null if you're not sending MMS, otherwise this format: ["https://mysite.com/image.png"]
media_urls = null;
// user ID of user who should receive notifications for replies
user_id = crm_record.get("Owner").get("id");
args = {
"From": from_number,
"To": to_number,
"Message": message_text,
"MediaURLs": media_urls,
"owner_id": user_id,
"Entity_Id": record_id,
"Entity_Type": module_name,
"message_source": "trigger_workflow_sms",
"To_Name": record_name,
"crm_record_id":record_id
};
message_data = {"params":{"arguments":args}};
sms_response = twiliosmsextension0.send_sms_via_messagemedia(message_data);
// Emojis not supported
message_name = "Weekend SMS for " + matching_contact.get("First_Name") + " " + matching_contact.get("Last_Name");
message_to_send = "Special message created by Deluge script " + matching_contact.get("First_Name");
from_number = "+12321412421"; // choose from number
new_sms_record_resp = zoho.crm.createRecord("twiliosmsextension0__Sent_SMS",
{
"Name": message_name,
"ContactName": matching_contact.get("id"),
"Message": message_to_send,
"From": from_number,
"To": matching_contact.get("Mobile")
},
{
"trigger": {"workflow" }
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment