// 标准参数
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("+");
}
// 功能标签用于Zoho CRM日志和Zoho Cliq集成
// 它保存在Woztell日志模块和Zoho Cliq消息中
function_tag = "automated message sample";
// 您可以决定是否希望在Zoho Cliq中发布消息。
// 设置true发布或false不发布
// post_in_zoho_cliq = true;
// 或者
// post_in_zoho_cliq = false;
post_in_zoho_cliq = true;
//
// 标头文件
// 不要删除 headerParameterList = List();
headerParameterList = List();
// 如果模板包含文件(文档、图片、视频)作为标头
headerParameter1 = Map();
headerParameter1.put("type","document");
headerParameter1.put("document", {"link":"url of the file"});
headerParameterList.add(headerParameter1);
//
// 请求体模板参数
// 不要删除 bodyParameterList = List();
bodyParameterList = List();
// 如果模板没有参数,请注释此代码
bodyParameter1 = Map();
bodyParameter1.put("type","text");
bodyParameter1.put("text","test Woztell");
bodyParameterList.add(bodyParameter1);
//
//
//
// 不要修改以下代码 !!
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);
// 模块:Leads 或 Contacts
message_meta_zoho.put("record",{"id":"XXXXX".toString(),"name": "XXX","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;