Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Connect the social accounts you want your bot to handle through the Zernio dashb
Create a webhook in your Zernio dashboard pointing to your bot's webhook endpoint:

- **URL**: `https://your-app.com/api/chat-webhook`
- **Events**: Select `message.received` and `comment.received`
- **Events**: Select `message.received` and `comment.received`. Add `reaction.received` if you handle reactions (routes to `bot.onReaction`).
- **Secret**: Set a strong secret and pass it as `ZERNIO_WEBHOOK_SECRET`

### 4. Enable the Inbox Addon
Expand Down Expand Up @@ -200,6 +200,24 @@ bot.onNewMessage(/.*/, async (thread, message) => {
});
```

## Receiving Reactions

Reactions (WhatsApp and Telegram) route to `onReaction`, not `onNewMessage`, so a 👍 is never treated as an inbound message. Subscribe your webhook to `reaction.received` to receive them.

```typescript
bot.onReaction(async (event) => {
// event.emoji normalized emoji (use event.rawEmoji for the raw platform value)
// event.added true when added, false when removed
// event.messageId the message that was reacted to
// event.thread the thread where it happened
if (event.added) {
await event.thread.post(`Thanks for the ${event.emoji}!`);
}
});
```

> Telegram only delivers reactions when the bot is an administrator in the chat (never in private chats). On WhatsApp removals the emoji is reported as an empty string.

## Platform-Specific Data

Access the underlying platform through the raw message:
Expand Down
Loading