orgId = XXXXXX; // replace orgId
//add the required keywords
keywordsList = {"Complaint","Issue","Problem","Faulty","Defect","Expensive","Overpriced","Unresponsive","Poor service","Outdated","Complicated","Difficult","Unreliable","Inconsistent","Disappointed","Never","Not again","Refund","Contract","Switch","Switching","Move","Moving on","Better options","Latency","Outage","Unstable","Difficult setup","Hard to use","Poor integration","Incompatible","Overpriced","Limited features","Poor support","Slow response","Better options","Switching providers","Cancel","Termination","Expensive upgrades","Outdated software","No improvement","Unreliable","Connectivity issues","Refund","Disconnect","Lack of customization"};
//===================================================================
logs = Collection();
doesThreadContainRequiredKeywords = false;
latestThreadData = invokeurl
[
url :deskURL + "/api/v1/tickets/" + ticketId + "/latestThread"
type :GET
connection:"zohosupport"
];
logs.insert("latestThreadData":latestThreadData);
threadContent = latestThreadData.get("content");
for each currKeyword in keywordsList
{
if(threadContent.containsIgnoreCase(currKeyword))
{
doesThreadContainRequiredKeywords = true;
break;
}
}
logs.insert("doesThreadContainRequiredKeywords":doesThreadContainRequiredKeywords);
if(doesThreadContainRequiredKeywords == true)
{
templateId = "3337XXXXXXXX"; // replace templateId
Template = invokeurl
[
type :POST
connection:"zohosupport"
];
sendmail
[
from :zoho.adminuserid
subject :Template.getJSON("subject")
message :Template.getJSON("body")
]
}
info "Logs:" + logs;
I setup the above custom function and enabled it for a workflow
I set it to execute on:
create & customer reply