Skip to content

Instantly share code, notes, and snippets.

View jeznag's full-sized avatar

Jeremy Nagel jeznag

View GitHub Profile
@jeznag
jeznag / check_that_message_can_be_sent.ds
Created March 6, 2024 04:19
Zoho Desk integration via Zoho Flow
map check_that_message_can_be_sent(int ticket_id, string sms_content, string send_btn_state, string channel, int desk_org_id)
{
try
{
if(channel != "SMS via Zoho Flow" || sms_content.isEmpty() || send_btn_state != "true")
{
info "stop processing outbound";
info "channel> " + channel;
info "sms_content> " + sms_content;
info "send_btn_state> " + send_btn_state;
@jeznag
jeznag / sending_with_emojis.ds
Created January 25, 2024 20:47
Send SMS from Zoho CRM
// Choose from number
from_number = "+234324324324";
module_name = "Leads";
record_id = 803228000138359036;
crm_record = zoho.crm.getRecordById(module_name, record_id);
to_number = crm_record.get("Mobile");
record_name = crm_record.get("First_Name") + " " + crm_record.get("Last_Name");
message_text = "🤒 Unfortunately your Orientation on " + 123 + " has been canceled due to staff illness. If concerned, contact - 1300 077 994. 🐾💞";
// leave media_urls as null if you're not sending MMS, otherwise this format: ["https://mysite.com/image.png"]
@jeznag
jeznag / safe-slack.js
Created August 31, 2023 02:59
Safe Slack
// ==UserScript==
// @name Safe Slack
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hide channels + messages
// @author You
// @match https://app.slack.com/client/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=slack.com
// @grant none
// ==/UserScript==
@jeznag
jeznag / send_sms_from_zoho_books.ds
Created April 17, 2023 02:19
Sending invoice reminders via SMS from Zoho Books
organizationID = organization.get("organization_id");
payment_link_payload = Map();
payment_link_payload.put("customer_id",invoice.get("customer_id"));
payment_link_payload.put("payment_amount",invoice.get("total"));
payment_link_payload.put("description",invoice.get("invoice_number"));
payment_link_payload.put("expiry_time",invoice.get("due_date").toDate().addDay(90));
JSONString = Map();
JSONString.put("JSONString",payment_link_payload);
result = invokeurl
[
@jeznag
jeznag / widget.html
Created December 30, 2022 04:20
Widget to embed Zoho Creator form inside Zoho CRM
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Zoho Creator Integration</h2>
<iframe id="creator-iframe" width="100%" height="800px"></iframe>
<script src="https://live.zwidgets.com/js-sdk/1.1/ZohoEmbededAppSDK.min.js"></script>
<script>
@jeznag
jeznag / geocodeZohoCRMLead.js
Last active September 4, 2022 10:43
Geocode a Zoho CRM lead using a node js custom function
const axios = require('axios')
const fs = require('fs')
const POSITION_STACK_API_KEY = 'REDACTED';
module.exports = async function (context, basicIO) {
/* 1)entity_object 2)user_object 3)organization_object 4)variables_object 5)request_object are the default parameters which contains entity information, user information,
organization information, variables inforamtion and request information in it respectively.
2) For Button Mass action and RL Button, ids list will be available in basicIO object. you can get by basicIO.getParameter("ids") & basicIO.getParameter("related_entity_ids") respectively
*/
@jeznag
jeznag / storing_sms_data_in_lead.ds
Created July 6, 2022 10:08
storing_sms_data_in_lead
message_record = zoho.crm.getRecordById("twiliosmsextension0__Sent_SMS",message_id);
if(lead_id != null)
{
update_payload = {"Last_SMS_received":message_record.get("Message")};
update_resp = zoho.crm.updateRecord("Leads",lead_id,update_payload);
}
if(contact_id != null)
{
update_payload = {"Last_SMS_received":message_record.get("Message")};
update_resp = zoho.crm.updateRecord("Contacts",contact_id,update_payload);
@jeznag
jeznag / add_country_code.ds
Created June 29, 2022 03:39
Set country code for phone number using Deluge script
lead_record = zoho.crm.getRecordById("Leads",lead_id);
mobile = lead_record.get("Mobile");
mobile_without_numeric_characters = mobile.replaceAll("[^\\d+]*","");
// example: (03) 1245 1(11)
// desired result: 031245111
country = lead_record.get("Country");
if(country == "Australia")
{
country_code = "+61";
}
@jeznag
jeznag / automatically_close_tasks.ds
Created May 23, 2022 23:51
automatically close tasks for a lead in Zoho CRM
outstanding_tasks_to_close = zoho.crm.getRelatedRecords("Tasks","Leads",lead_id);
for each task in outstanding_tasks_to_close
{
if(task.get("Status") != "Completed")
{
update_payload = {"Status":"Completed"};
update_resp = zoho.crm.updateRecord("Tasks",task.get("id"),update_payload);
}
}
@jeznag
jeznag / missed_call_to_lead.ds
Created April 15, 2022 03:17
automatically create a new lead when a missed call comes in from an unknown number
call_record = zoho.crm.getRecordById("Calls",call_id);
caller_phone_number = call_record.get("Subject").getSuffix("Missed call from ");
new_lead_data = {"First_Name":"Unknown","Last_Name":"From missed call from " + caller_phone_number,"Phone":caller_phone_number,"Lead_Source":"Missed Call from unknown number"};
create_resp = zoho.crm.createRecord("Leads",new_lead_data);
new_lead_id = create_resp.get("id");
update_call_payload = {"What_Id":new_lead_id,"$se_module":"Leads"};
update_resp = zoho.crm.updateRecord("Calls",call_id,update_call_payload);
info update_resp;