Webhooks
A webhook subscription makes GroupApp send an HTTPS POST to your URL when something happens. Deliveries follow the Standard Webhooks specification, so you can verify them with the official libraries.
Subscriptions
There is no API route to manage subscriptions yet. A GroupApp admin creates and manages them on the dashboard's webhooks settings screen. For each subscription the admin sets:
| Setting | Notes |
|---|---|
| Name | Up to 80 characters. |
| URL | Must be https, without a username or password. Hosts that are private, loopback, link-local or otherwise reserved, and internal-only names such as localhost or names ending in .internal or .local, are refused. The address your name resolves to is checked again at delivery time. |
| Events | One or more event types, or a wildcard <family>.*: number.*, post.*, request.* or send.*. |
| Enabled | A subscription can be switched off and on. |
The admin can also send a test event, rotate the secret, and see the latest deliveries of a subscription. At most 10 subscriptions can exist per owner.
The signing secret looks like whsec_ followed by base64 text. It is shown once, when the subscription is created or its secret is rotated. Store it like a password.
Events
Every delivery has the same body:
{
"id": "evt_0f3a5c1d8b2e4f6a9c7d1e3b5a8f2c4d",
"type": "number.connected",
"timestamp": "2026-11-22T09:30:00.000Z",
"data": {
"botId": "my-bot",
"instanceId": "my-bot-1",
"status": "connected",
"at": "2026-11-22T09:30:00.000Z"
}
}
| Field | Meaning |
|---|---|
id |
The event id: evt_ and 32 hex characters. It is the same on every retry, and it equals the webhook-id header. |
type |
The event type. |
timestamp |
When the event happened, as an ISO 8601 UTC string. This is not the delivery time. |
data |
Depends on the type, see below. |
Payloads are thin: ids, statuses, counts and times only. Fetch details with the GET routes of the API when you need them.
Event types
| Type | Sent when |
|---|---|
number.connected |
a number's session is connected |
number.banned |
a number was banned |
number.logged_out |
a number was logged out |
number.qr_needed |
a number needs a QR scan or a rescan |
post.sent |
a post finished sending and every one of its targets got it |
post.failed |
a post finished sending and none of its targets got it |
post.partial |
a post finished sending and only some of its targets got it |
post.edited |
a post was edited |
post.deleted |
a post was deleted |
send.completed |
a send to explicit targets (targetIds) has finished |
request.completed |
a request made with an API key has finished |
A wildcard matches every type of its family: post.* matches the five post. types above, request.* matches request.completed and send.* matches send.completed.
Some event types are reserved for GroupApp's own subscriptions and are not listed here.
A customer-owned subscription would only ever receive events about its own bots. Customer-owned subscriptions cannot be created yet.
post.sent, post.failed and post.partial are sent once per post, when its sending has finished. A post with no targets sends none. post.edited and post.deleted are sent when the change succeeded. A post sent with a ga_test_ key (see Test mode) never reaches a bot, so it sends no post.* event. It is not the same for send.completed: a test send to targetIds does queue one, with the sample result. A test send to a superGroupId sends neither.
request.completed is delivered only to the subscriptions that belong to the same owner as the key that made the request. A request made with a test key is not delivered to subscriptions that receive live events.
The admin's test button sends a webhook.test event with data: { "subscriptionId": "..." }. You cannot subscribe to it.
number.* data
| Field | Type | Meaning |
|---|---|---|
botId |
string | The bot. |
instanceId |
string | The number (instance) of the bot. |
status |
string | connected for number.connected, ban for number.banned, logout for number.logged_out, and qr or rescan for number.qr_needed. |
at |
string | When the status was recorded, ISO 8601 UTC. |
No phone number or ban reason is included.
post.sent, post.failed and post.partial data
{
"id": "evt_0f3a5c1d8b2e4f6a9c7d1e3b5a8f2c4d",
"type": "post.partial",
"timestamp": "2026-11-22T09:31:00.000Z",
"data": {
"postId": "pst_...",
"botId": "my-bot",
"superGroupId": "my-super-group",
"status": "partial",
"checked": true,
"targets": { "total": 4, "delivered": 3, "failed": 1, "skipped": 0 },
"finishedAt": "2026-11-22T09:31:00.000Z"
}
}
| Field | Type | Meaning |
|---|---|---|
postId |
string | The post, as taken by GET /v1/posts/{postId}. |
botId |
string | The bot. |
superGroupId |
string or null | The super group the post belongs to. null when the post is not known to belong to one. |
status |
string | sent for post.sent, failed for post.failed, partial for post.partial. |
checked |
boolean | false when the sending was closed without a final check of the groups, so the counts are the best known. |
targets.total |
integer | The number of targets of the post, including those that were not attempted. |
targets.delivered |
integer | Targets that got the post. |
targets.failed |
integer | Targets that were tried and did not get it. |
targets.skipped |
integer | Targets that were not tried: no sending number was available, the post was deleted, or sending was stopped. |
finishedAt |
string | When the sending finished, ISO 8601 UTC. It equals timestamp. |
post.sent means delivered equals total, post.failed means delivered is 0, and post.partial is anything in between. No post text, group name, group id or phone number is included: read the post with GET /v1/posts/{postId} for the outcome per group.
post.edited and post.deleted data
| Field | Type | Meaning |
|---|---|---|
postId |
string | The post, as taken by GET /v1/posts/{postId}. |
botId |
string | The bot. |
superGroupId |
string or null | The super group the post belongs to. null when the post is not known to belong to one. |
at |
string | When the change finished, ISO 8601 UTC. It equals timestamp. |
The new text of an edit is not included: read the post with GET /v1/posts/{postId}.
send.completed data
Sent for a send to explicit targets (targetIds). A send to a super group sends none; follow it with its post.* events.
{
"requestId": "req_00000000-0000-0000-0000-000000000000",
"botId": "my-bot",
"status": "partial",
"targets": { "total": 4, "delivered": 3, "failed": 1 },
"completedAt": "2026-11-22T09:31:00.000Z"
}
| Field | Type | Meaning |
|---|---|---|
requestId |
string | The request, as taken by GET /v1/requests/{requestId}. |
botId |
string | The bot. |
status |
string | sent when every target got the message, failed when none did, partial otherwise. |
targets.total |
integer | The number of distinct targets. |
targets.delivered |
integer | Targets that got the message. |
targets.failed |
integer | total minus delivered. |
completedAt |
string | When the send finished, ISO 8601 UTC. It equals timestamp. |
No target id, message id, error or text is included: read the request for the outcome per target.
request.completed data
| Field | Type | Meaning |
|---|---|---|
requestId |
string | The request, as taken by GET /v1/requests/{requestId}. |
botId |
string | The bot. |
status |
string | succeeded or failed. |
completedAt |
string | When the request finished, ISO 8601 UTC. It equals timestamp. |
metadata |
object | The metadata you sent with the request. Present only when you sent some. |
New event types and new data fields can be added at any time (see versioning). Ignore what you do not know.
The request
POST /your/endpoint HTTP/1.1
content-type: application/json
user-agent: GroupApp-Webhooks/1
webhook-id: evt_0f3a5c1d8b2e4f6a9c7d1e3b5a8f2c4d
webhook-timestamp: 1795339800
webhook-signature: v1,K5oZfzN0o+0Qy5oYb4dQ7y2WZ8o8Yy2m2k9v9m9mZPE=
| Header | Meaning |
|---|---|
webhook-id |
The event id. The same on every attempt. |
webhook-timestamp |
When this attempt was sent, in Unix seconds. It changes on every attempt. |
webhook-signature |
One or more v1,<base64> signatures, separated by spaces. |
During a secret rotation, the signature header holds two signatures: one made with the new secret and one with the previous secret. The previous secret keeps signing for 7 days after a rotation. Verification passes if any one of them matches, so you can switch to the new secret at your own pace inside that window.
Verifying a delivery
Verify every request, on the raw request body, before you parse it. If you parse the JSON and serialize it again, the signature will not match.
Node
npm install standardwebhooks
const express = require('express');
const { Webhook } = require('standardwebhooks');
const wh = new Webhook(process.env.GROUPAPP_WEBHOOK_SECRET); // whsec_...
const app = express();
app.post('/webhooks/groupapp', express.raw({ type: 'application/json' }), (req, res) => {
let event;
try {
event = wh.verify(req.body, {
'webhook-id': req.get('webhook-id'),
'webhook-timestamp': req.get('webhook-timestamp'),
'webhook-signature': req.get('webhook-signature'),
});
} catch {
return res.status(400).end();
}
// Save event.id and process the event in the background.
res.status(200).end();
});
verify throws when the signature is wrong or the timestamp is more than 5 minutes off. It returns the parsed JSON body.
Python
pip install standardwebhooks
import os
from flask import Flask, request
from standardwebhooks.webhooks import Webhook, WebhookVerificationError
wh = Webhook(os.environ["GROUPAPP_WEBHOOK_SECRET"]) # whsec_...
app = Flask(__name__)
@app.post("/webhooks/groupapp")
def groupapp():
try:
event = wh.verify(request.get_data(), dict(request.headers))
except WebhookVerificationError:
return "", 400
# Save event["id"] and process the event in the background.
return "", 200
Without a library
- Read
webhook-id,webhook-timestampandwebhook-signature. If one is missing, reject. - The timestamp must be an integer number of seconds. Reject it if it is more than 5 minutes (300 seconds) from your clock.
- Build the signed content:
<webhook-id>.<webhook-timestamp>.<raw body>. - The key is the base64-decoded text after
whsec_. - Compute HMAC-SHA256 of the signed content with that key and base64-encode it.
- Split
webhook-signatureon spaces. Each entry isv1,<base64>. Compare your value with each entry in constant time. Accept if any one matches.
The Standard Webhooks specification has a public test secret you can use to check your code: whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw.
Delivery behaviour
- At least once. The same event can reach you more than once, and events can arrive out of order. Use
webhook-id(oridin the body) to ignore an event you have already processed, and usetimestampand a fetch of the current state when order matters. - Respond fast with a
2xx. The request times out after 15 seconds. Do the real work after you have answered. - Only a
2xxcounts as success. Any other answer is retried: a3xx(redirects are not followed),4xx,5xx, a timeout, a network error, or a destination that is not allowed. 410 Gonedisables the subscription. Answer410when you want to stop receiving events. The subscription is switched off with no further attempts, and an admin has to switch it on again. Events still waiting for a retry are dropped when their next attempt comes due while the subscription is off.
Retries
An event has at most 6 attempts. After a failed attempt the next one is scheduled after:
| Attempt | Delay after the previous attempt |
|---|---|
| 1 | immediately |
| 2 | about 5 seconds |
| 3 | about 5 minutes |
| 4 | about 30 minutes |
| 5 | about 2 hours |
| 6 | about 5 hours |
Delays other than the first vary by up to 20% either way, and delivery runs on a 5-second tick, so an attempt can start a few seconds later than scheduled. After the sixth failed attempt the event is dropped for that subscription.
Every attempt is signed again with a new webhook-timestamp, so a retry never fails the 5-minute timestamp check.
Not available yet
- Managing subscriptions through the API.
- Replaying events that were dropped. Use the
GETroutes to resynchronize.