Skip to content

Instantly share code, notes, and snippets.

View giovannicocco's full-sized avatar

Giovanni Cocco giovannicocco

View GitHub Profile
@giovannicocco
giovannicocco / encrypt_response.py
Last active October 26, 2023 10:11
WhatsApp Flow (Encrypt response)
from base64 import b64decode, b64encode
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
import json
def flip_iv(iv):
flipped_bytes = []
for byte in iv:
flipped_byte = byte ^ 0xFF
flipped_bytes.append(flipped_byte)
return bytes(flipped_bytes)
@giovannicocco
giovannicocco / Cookies.tsx
Last active September 20, 2023 10:14
Get Cookies Values and Display It in Framer.com
// Create a TSX file of type override by clicking on Assets -> Code and clicking on (+);
//Copy, paste the code below and save;
//Go to Pages, select the page and select the paragraph or heading you want to display the cookie value;
//In the right side menu go to Code Overrides and click (+), select the Cookies file;
//In Overrides select withCookies;
//Publish your page and you're done.
// In this example I am getting the value from _fbp cookie
import type { ComponentType } from "react"
import Cookies from "cookiejs"
@giovannicocco
giovannicocco / gtm-webhook.json
Created March 18, 2023 12:58
Google Tag Manager - Chamando webhook - Instale direto no seu GTM - Importe esse código para o seu GTM - Não se esqueça de alterar caso necessário o nome da variável de camadas de dados conforme o seu dataLayer.
{
"exportFormatVersion": 2,
"exportTime": "2023-03-18 12:51:51",
"containerVersion": {
"path": "accounts/6006751052/containers/104884648/versions/2",
"accountId": "6006751052",
"containerId": "104884648",
"containerVersionId": "2",
"name": "Webhook",
"container": {
@giovannicocco
giovannicocco / gtm-webhook.js
Created March 18, 2023 12:25
Google Tag Manager - Chamando webhook
<script>
var headers = new Headers();
headers.append("Content-Type", "application/json");
var body = {
"name": {{dlv- Name}}, // Variável da camada de dados
"email": {{dlv - Email}}, // Variável da camada de dados
"utm_url": {{First Cookie __gtm_campaign_url}}, // Variável de cookie primário
"user_agent": navigator.userAgent,
"ip": {{dlv - IP Adress}}, // Variável da camada de dados