Documentation menu
Getting startedOverviewQuickstartAccount and sign-inChannelsConnect channelsPublishingComposerCalendar and schedulingMedia and picture editorAI assistantGrow and automateAnalyticsAutomationsTeamsWorkspaces and teamsReferenceLimitsTroubleshootingDevelopersOverviewREST APIAPI: postsAPI: media, analytics, AIMCP serverCLI and agent skillWebhooksWebhooks
Yeetzo can POST an event to your server. Add the address in App > Developers; each webhook has its own secret.
Events
| Event | When |
|---|---|
post.published | A post was published |
post.failed | Publishing failed |
post.pending | A post is waiting for approval |
Request
A POST with a JSON body:
{
"event": "post.published",
"at": "...",
"post": { "id": "...", "status": "sent", "channels": [1], "results": [] }
}post is the full Post object.
| Header | Value |
|---|---|
x-yeetzo-event | The event name |
x-yeetzo-signature | sha256= followed by the hex HMAC-SHA256 of the raw body, keyed with the webhook's secret |
Verify the signature
Compute it over the raw bytes, before any JSON parsing, and compare in constant time.
Node.js
import { createServer } from 'node:http';
import { createHmac, timingSafeEqual } from 'node:crypto';
const secret = process.env.YEETZO_WEBHOOK_SECRET;
createServer((req, res) => {
const chunks = [];
req.on('data', (c) => chunks.push(c));
req.on('end', () => {
const raw = Buffer.concat(chunks);
const want = Buffer.from('sha256=' + createHmac('sha256', secret).update(raw).digest('hex'));
const got = Buffer.from(req.headers['x-yeetzo-signature'] || '');
if (got.length !== want.length || !timingSafeEqual(got, want)) {
res.writeHead(401).end();
return;
}
const { event, post } = JSON.parse(raw.toString('utf8'));
console.log(event, post.id);
res.writeHead(200).end('ok');
});
}).listen(3000);Python
import hashlib, hmac
def verify(raw_body: bytes, header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header or "")Good practice
- Answer quickly with a 2xx and do slow work afterwards.
- Make handling safe to repeat, keyed on the post id and event.
- Use HTTPS and reject anything with a bad signature.