Keep payout tweets under 280 (short CTA URL + hard length guard)

Blotato counts the raw URL length toward the 280 limit (no t.co
shortening), so the long UTM CTA overflowed. Shortened default CTA to
?utm_source=x and added a guard in render(): drop hashtags, then trim
body, so a tweet can never exceed 280. Verified a real test post to
@cryptoteambuild returns HTTP 201.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-15 11:38:32 -05:00
parent c418aa516a
commit c52add619a
+8 -2
View File
@@ -14,7 +14,7 @@ const BLOTATO_URL = 'https://backend.blotato.com/v2/posts';
const MIN_GAP_MS = 2600; // ~23/min ceiling, under Blotato's 30/min const MIN_GAP_MS = 2600; // ~23/min ceiling, under Blotato's 30/min
const DATA_DIR = process.env.DATA_DIR || '.'; const DATA_DIR = process.env.DATA_DIR || '.';
const TWEETED_FILE = path.join(DATA_DIR, 'tweeted-payouts.json'); const TWEETED_FILE = path.join(DATA_DIR, 'tweeted-payouts.json');
const DEFAULT_CTA = 'https://rmcircle.saasy.top/?utm_source=twitter&utm_medium=social&utm_campaign=payproof'; const DEFAULT_CTA = 'https://rmcircle.saasy.top/?utm_source=x'; // short: Blotato counts raw URL length toward 280
const DEFAULT_TAGS = '#Crypto #Polygon #POL #Web3 #CryptoTeamBuild'; const DEFAULT_TAGS = '#Crypto #Polygon #POL #Web3 #CryptoTeamBuild';
const DEFAULT_TWITTER_ID = '7998'; // @cryptoteambuild in Blotato const DEFAULT_TWITTER_ID = '7998'; // @cryptoteambuild in Blotato
@@ -67,7 +67,13 @@ function render(evt, cfg) {
`💰 Cha-ching! Member #${evt.toId} earned ${pol} POL on-chain the second a new member came aboard — no waiting. 🚀`, `💰 Cha-ching! Member #${evt.toId} earned ${pol} POL on-chain the second a new member came aboard — no waiting. 🚀`,
]); ]);
} }
return `${body}\n\nBuild with us 👉 ${cta}\n\n${tags}`; const head = `${body}\n\nBuild with us 👉 ${cta}`;
// Hard 280 guard (Blotato counts raw string length, no t.co shortening):
// keep body + CTA, drop hashtags first, then trim the body as a last resort.
let out = `${head}\n\n${tags}`;
if (out.length > 280) out = head;
if (out.length > 280) out = head.slice(0, 279) + '…';
return out;
} }
const queue = []; const queue = [];