Hello again,
A Zoho Inventory account.
A Zoho Cliq account.
A Zoho Cliq auth token. Click here to learn how you can generate one.
A suitable Zoho Cliq bot. Click here to learn how you can make one.
Open the Zoho Inventory organization.
Click on the gear icon from the top-right corner.
Select Automation from the drop-down.
Now click on the button adjacent to +New Workflow Rule.
Out of the four options from the drop-down, select Custom Functions.
Now let's add a name to this workflow rule and make sure that there are no spaces between words.
Select Sales Orders against Module.
Add a Description if you need one.
Now, the workflow type is going to be Event Based.
The condition to set shall be, "when a Sales Order is created".
Now copy and paste this code snippet inside the deluge pane:
authtoken = "XXXXXXXXXXXXXXXXX"; //cliq authtoken
salesorderID = salesorder.get("salesorder_id");
salesorderdate = salesorder.get("date").toDate();
organizationID = organization.get("organization_id");
customername = salesorder.get("customer_name");
info customername;
payload = Map();
str = "Sales order " + salesorder.get("salesorder_number") + " for " + customername + " has been created. ";
info str;
payload.put("text",str);
res = postUrl("https://cliq.zoho.com/api/v2/bots/YOURBOTLINKNAME/message?authtoken=" + authtoken,payload + "");
Navigate to the first line - authtoken = "XXXXXXXXXXXXXXXXX"; and replace the XXXXXXXXXXXXXXXX inside of the double quotes with the authtoken number that you have generated from Zoho Cliq (see prerequisites for instructions).
You can also write your own custom message/modify notification content by navigating to the 8th line that says - str = "Sales order " + salesorder.get("salesorder_number") + " for " + customername + " has been created. ";.
Now to link the code with the appropriate Zoho Cliq bot, navigate to the last line - res = postUrl("https://cliq.zoho.com/api/v2/bots/YOURBOTLINKNAME/message?authtoken=" + authtoken,payload + ""); and replace this link with the one from your bot inside of Zoho Cliq. To get your very own bot link for this step:
Open Zoho Cliq in a new window.
Navigate to the bot you have created for this purpose.
When you click upon it, you will spot a URL below its name in the pop-up window. Copy the URL and replace the above URL with the one from the bot.
Hit Save to finish.