// Standard parameters
token = "your-WOZTELL-token";
phone = "your-destination-phone";
channelId = "your-WOZTELL-channel-id";
templateName = "template-name";
templateLanguage = "template-language";
if(phone.startsWith("00")){
phone = phone.removeFirstOccurence("00");
}else if(phone.startsWith("+")){
phone = phone.removeFirstOccurence("+");
}
// Function tag is used in the Zoho CRM logs and Zoho Cliq integration
// It is saved in the Woztell Logs Module and Zoho Cliq message
function_tag = "automated message sample";
// You can decide if you want to post the message in Zoho Cliq or not.
// Put true to publish or false to not publish
// post_in_zoho_cliq = true;
// or
// post_in_zoho_cliq = false;
post_in_zoho_cliq = true;
//
// Header files
// Don't remove headerParameterList = List();
headerParameterList = List();
// If the template has a file (document, image, video) in the header
// Comment this code if the template doesn't have header or header is text
headerParameter1 = Map();
headerParameter1.put("type","document");
headerParameter1.put("document", {"link":"url of the file"});
headerParameterList.add(headerParameter1);
//
// Body template parameters
// Don't remove bodyParameterList = List();
bodyParameterList = List();
// Comment this code if the template doesn't have parameters
bodyParameter1 = Map();
bodyParameter1.put("type","text");
bodyParameter1.put("text","test Woztell");
bodyParameterList.add(bodyParameter1);
//
//
//
// DON'T MODIFY THE FOLLOWING CODE !!
postMessage = Map();
postMessage.put("channelId",channelId);
postMessage.put("recipientId",phone);
responseMap = Map();
responseMap.put("type","TEMPLATE");
responseMap.put("elementName",templateName);
responseMap.put("languageCode",templateLanguage);
componentsList = list();
if(!headerParameterList.isEmpty())
{
headerComponent = Map();
headerComponent.put("type","header");
headerComponent.put("parameters",headerParameterList);
componentsList.add(headerComponent);
}
if(!bodyParameterList.isEmpty())
{
bodyComponent = Map();
bodyComponent.put("type","body");
bodyComponent.put("parameters",bodyParameterList);
componentsList.add(bodyComponent);
}
responseMap.put("components",componentsList);
responseList = List();
responseList.add(responseMap);
postMessage.put("response",responseList);
message_meta = Map();
message_meta_zoho = Map();
message_meta_zoho.put("user",function_tag);
message_meta_zoho.put("cliq",post_in_zoho_cliq);
// module: Leads or Contacts
message_meta_zoho.put("record",{"id":"XXXXX".toString(),"name": "XXXX","module":"Leads"});
message_meta.put("zoho",message_meta_zoho);
postMessage.put("meta",message_meta);
response = invokeurl
[
url :PostURL
type :POST
parameters:postMessage.toString()
];
info response;