Skip to content

Instantly share code, notes, and snippets.

@alex-grover
Last active November 30, 2024 21:44
Show Gist options
  • Save alex-grover/d8a03a34c7eb9485fe2f8e1d5fcb1013 to your computer and use it in GitHub Desktop.
Save alex-grover/d8a03a34c7eb9485fe2f8e1d5fcb1013 to your computer and use it in GitHub Desktop.
Warpcast Direct Cast Script
// Get a developer API key from https://warpcast.com/~/developers/api-keys
const API_KEY = ''
// Update message
const message = ''
// Update with recipient FIDs
const fids = [10259]
for (const fid of fids) {
const response = await fetch(
'https://api.warpcast.com/v2/ext-send-direct-cast',
{
method: 'PUT',
headers: {
Authorization: `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
recipientFid: fid,
message,
idempotencyKey: fid,
}),
},
)
switch (response.status) {
case 200:
console.log(`[success] fid: ${fid}`)
break
case 403:
console.log(`[error:permissions] fid: ${fid}`)
break
case 429:
console.log(`[error:rate-limit] fid: ${fid}`)
break
default:
console.log(`[unknown] status: ${response.status}`)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment