Skip to content

Instantly share code, notes, and snippets.

View fadoaglauss's full-sized avatar
🏠
Working from home

Fadoa Glauss V. fadoaglauss

🏠
Working from home
  • Montréal, CA
  • 19:23 (UTC -03:00)
View GitHub Profile
@fadoaglauss
fadoaglauss / dynamic-content-template.json
Last active September 22, 2020 14:05
Use this json file when sending a message from a template to Whatsapp with input parameters, like {{1}}
{
"type": "template",
"template": {
"namespace": "{{namespace}}",
"language": {
"policy": "deterministic",
"code": "pt_BR"
},
"name": "{{template_name}}",
"components": [
@fadoaglauss
fadoaglauss / reset_all_context_user_variables.py
Created September 22, 2020 10:53
Reset all user context variables in bot flow in BLiP
# Author: Hércules Nakai
from blip_session import BlipSession
# Fill with bot authorization key and user identity
BOT_AUTHORIZATION = ''
USER_IDENTITY = ''
DELETE_METHOD = 'delete'
GET_METHOD = 'get'
@fadoaglauss
fadoaglauss / dateToSendNextMessage.js
Last active September 11, 2020 20:41
Gets the next day that you will send an automatic message to your clients considering timezone, service start time, working days and holidays.
function nowUTC(offset) {
let now = new Date;
let utc_timestamp = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(),
now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds());
return new Date(utc_timestamp + offset * 3600 * 1000);
}
function formatDay(day) {
return day < 10 ? `0${day}` : day;;
@fadoaglauss
fadoaglauss / validateCPF.js
Last active September 1, 2020 11:57
Validates cpf
function validateCPF(cpf) {
if (isNumber(cpf)) {
if (isCPFValid(cpf)){
return true;
}
}
return false;
}
@fadoaglauss
fadoaglauss / isNameValid.js
Last active August 31, 2020 19:01
Validates name without special characters with regex expression
function isNameValid(name) {
if (name != "" && name != null && name != undefined) {
if (isFullName(name)) {
if (!hasInvalidSymbols(name)) {
return true;
}
}
}
return false;
}