Skip to content

Instantly share code, notes, and snippets.

View twosdai's full-sized avatar
🐶
🐱

Daniel Wasserlauf twosdai

🐶
🐱
View GitHub Profile
const fetch = require("cross-fetch");
async function fetchAllLeads(url) {
const leadsMap = new Map();
let offset = 0;
const limit = 100;
let totalLeads = Infinity; // initial dummy value
while (offset < totalLeads) {
try {
const fetch = require('cross-fetch');
async function fetchAndCheckLeadsForTrackingmore(url) {
let offset = 0;
const limit = 100;
let totalLeads = Infinity; // Initial dummy value
while (offset < totalLeads) {
try {
const response = await fetch(`${url}&offset=${offset}&limit=${limit}`);
@twosdai
twosdai / webHookRegisterAndTest.js
Created March 18, 2025 23:42
Webhook Register
// Description: This script registers a webhook, tests it, and then unregisters it.
// Run npm install cross-fetch to install the cross-fetch package. you can also use node-fetch but the ESM module system will struggle with it.
// To run the script, run: node webHookRegisterAndTest.js
const fetch = require("cross-fetch");
const apiKey = "EXAMPLE_API_KEY";
const webhookUrl = "https://public.prod.tenex.email/webhooks/register";
const testWebhookUrl = "https://public.prod.tenex.email/webhooks/test";
const unregisterWebhookUrl = "https://public.prod.tenex.email/webhooks/";
function gas() {
local repo_dir branch owner repo api_url gh_status conclusion color
# Ensure GITHUB_TOKEN is set
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "❌ GITHUB_TOKEN is not set. Export it in your shell environment."
return 1
fi
# Find the Git repo root