For this tutorial in video form, click here

In this article, we’ll explain how to automatically send SMS messages via our plugin, using deluge script. Generally you won’t want to do it this way: there’s an easier way.

Here’s some sample code:

lead_data = zoho.crm.getRecordById("Leads", lead_id);
// From: the Twilio number you will use to send the message
from_number = "+61429357126";
// To: the number to which the SMS should be sent
to_number = lead_data.get("Mobile");
// Message: the SMS you want to send
message_text = "Hi " + lead_data.get("First_Name") + ", happy new year!";
// 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);
return sms_response;

To use it, we’ll head into our CRM at crm.zoho.com and make a new workflow rule. Under Setup, go to Automation and then Workflow Rules.

Next, click “+Create Rule”. We’ve put ours in the Prospects Module and named it like so:

Now it’s time to set up the specifics of our rule. Under “When”, execute it on a Field update, and repeat it whenever the description is updated.

We’ll set up the condition to be executed for all prospects. Under Instant Actions, we’ll select Functions and then + New Function followed by “Write Your Own”.

From there, we’ll give it a title and set it for Deluge.

Next, paste in the code obtained from the user guide.

We’ll need to add an argument. Click “Edit Arguments” at the top. Set it up like so before saving:

Make sure that the left field is lead_id and the right is “Prospects – Prospect id”.

Back in the function, we need to put in our sender ID. Get that from your MessageMedia hub account.

Choose what you want to use, and paste it into the “from_number” section on line 3 of the code, making sure to remove any spaces.

On line 5, be sure to change “Mobile” to “Phone”. On line 7, you’ll notice “message_text =” followed by a message. You can alter this to form whatever message you want.

Additionally, we’ll add an info statement at the end to make sure that it sent.

This can be tested by going to a lead. Then choose the one that has your number in it. Copy and paste the lead’s unique ID when executing the function like so:

Here, you can see that the function went through:

We can also see that it works via the workflow rule as well. Let’s go to our lead. Remember how the Workflow is triggered when the description field is changed? Let’s change it.

It should send an SMS shortly:

For this tutorial in video form, click here