Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created October 12, 2021 04:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeznag/c0ab5a25d35bb7069872204df6aba4ec to your computer and use it in GitHub Desktop.
Save jeznag/c0ab5a25d35bb7069872204df6aba4ec to your computer and use it in GitHub Desktop.
Send templated emails from Zoho CRM using deluge script
config_map = configuration.toMap();
template_id = config_map.get("template_id");
to_email = config_map.get("to_email");
subject = config_map.get("subject");
from_name = config_map.get("from_name");
from_email = config_map.get("from_email");
module_name = config_map.get("module_name");
record_id = config_map.get("record_id");
org_email_address = config_map.get("org_email_address");
template_data = {"id":template_id};
email_payload = {"data":{{"from":{"user_name":from_name,"email":from_email},"to":{{"email":to_email}},"org_email": org_email_address,"subject":subject,"mail_format":"html","template":template_data}}};
send_mail_resp = invokeurl
[
url :"https://www.zohoapis.com/crm/v2.1/" + module_name + "/" + record_id + "/actions/send_mail"
type :POST
parameters:email_payload.toString()
connection:"crm_emails"
];
return send_mail_resp;
standalone.send_email_via_zoho_api({"template_id":803228000047145582,"to_email":email,"subject":null,"from_name":"My Special Org","from_email":"jeremy@ethicaltechnology.co","module_name":"Leads","record_id":lead_id,"org_email_address":true});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment