BLUJAY_API_KEY (and, for webhooks, BLUJAY_WEBHOOK_SECRET) in your environment first.
Reply to incoming messages
A webhook receiver that verifies each event and answers a new direct message with an acknowledgement. Subscribe it tomessage.received.
It sends the reply before it answers the webhook. If the send fails with a retryable error, the receiver returns 503, so Blujay delivers the event again later (up to 10 attempts). Using the event ID as the Idempotency-Key means a redelivered event never sends a second reply.
Acknowledge once per conversation, not once per message: the example remembers the last acknowledgement per chat and stays quiet for 12 hours after it, so a contact’s “thanks” doesn’t get another acknowledgement. Every acknowledgement also counts toward the 6 texts in a row the contact must respond to.
reply-bot.mjs
Send a batch safely
Sends a first message to a list of people, one at a time, from the first number that can send. Before each send it checks the number’s livelimits.new_contacts.remaining_today and queue.remaining and stops when either reaches zero, and it also stops on a 429. Each recipient’s idempotency key makes the script safe to run again: finished sends are never repeated.
batch-send.mjs
Next steps
Verify signatures
The signature check used above, explained.
Phone numbers and limits
The live fields the batch script reads.
Build with AI
Have your assistant review your integration.