Development
Set up a local environment to test the Blooio API and webhooks
Prerequisites
- cURL or an HTTP client (Insomnia/Postman)
- Optional: Node.js 18+ or Python 3.9+ for examples
- A public HTTPS endpoint (or a tunneling tool) to receive webhooks. We recommend checking out webhook.site for quick testing.
Environment setup
Set your API key as an environment variable:
export BLOOIO_API_KEY=YOUR_API_KEYMake test requests
Try a simple authenticated request to validate your key:
curl -H "Authorization: Bearer $BLOOIO_API_KEY" \
https://backend.blooio.com/v2/api/meSend a message:
curl -X POST "https://backend.blooio.com/v2/api/chats/%2B15551234567/messages" \
-H "Authorization: Bearer $BLOOIO_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: dev-$(uuidgen)" \
-d '{"text": "Hello from Blooio (dev)!"}'Receive webhooks locally
You can test webhooks by running a local server and exposing it with a tunneling tool.
- Start a local server (Node.js example):
// server.js
import express from 'express'
const app = express()
app.use(express.json())
app.post('/webhooks/blooio', (req, res) => {
console.log('Webhook:', req.headers['x-blooio-event'], req.body)
res.sendStatus(200)
})
app.listen(3001, () => console.log('Listening on http://localhost:3001'))- Expose your server:
ngrok http http://localhost:3001- Create a webhook with your public URL:
curl -X POST https://backend.blooio.com/v2/api/webhooks \
-H "Authorization: Bearer $BLOOIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"webhook_url":"https://YOUR-NGROK-URL/webhooks/blooio"}'See the full event payloads in Webhook events.
Tips for development
- Use Idempotency-Key during development to avoid duplicates
- Log response bodies and headers when debugging
- Store timestamps (ms) from responses to correlate with webhooks