HTTP API referenceTrigger event

POST /apps/{app_id}/events

Publish an event to one or more channels. The Pusher SDKs in every language wrap this for you; you only need to call it directly when you don’t have an SDK handy or you’re testing with curl.

Authentication

Every request needs four query params:

ParamValue
auth_keyYour app key
auth_timestampSeconds since the Unix epoch (must be within 600s of server time)
auth_version1.0
auth_signatureHex HMAC-SHA256 of the canonical string (see below), keyed by your secret

For requests with a body, also include:

ParamValue
body_md5Hex MD5 of the raw request body

Canonical string to sign

POST\n/apps/{app_id}/events\n{sorted_query_params_minus_signature}

Query params are sorted by key, joined as key=value pairs separated by &, with no URL-encoding (Pusher’s spec).

Example

Body:

{ "name": "message", "channel": "chat", "data": "{\"text\":\"hello\"}" }

Note data is a string containing JSON, not a JSON object.

curl:

APP_ID=6855671
KEY=YOUR_KEY
SECRET=YOUR_SECRET
BODY='{"name":"message","channel":"chat","data":"{\"text\":\"hello\"}"}'
BODY_MD5=$(printf '%s' "$BODY" | md5sum | awk '{print $1}')
TS=$(date +%s)
QS="auth_key=$KEY&auth_timestamp=$TS&auth_version=1.0&body_md5=$BODY_MD5"
SIG=$(printf 'POST\n/apps/%s/events\n%s' "$APP_ID" "$QS" \
      | openssl dgst -sha256 -hmac "$SECRET" -hex \
      | awk '{print $NF}')
 
curl -X POST 'https://ws-sa.mawjly.com/apps/'$APP_ID'/events?'$QS'&auth_signature='$SIG \
     -H 'Content-Type: application/json' \
     -d "$BODY"

Response: {} with HTTP 200.

Multi-channel fan-out

Replace channel with channels (array, max 100):

{
  "name": "broadcast",
  "channels": ["news.global", "news.tech", "news.biz"],
  "data": "{\"headline\":\"hi\"}"
}

Batch (different events per channel)

POST /apps/{app_id}/batch_events — body shape:

{
  "batch": [
    { "channel": "chat", "name": "message", "data": "{\"text\":\"a\"}" },
    { "channel": "chat", "name": "message", "data": "{\"text\":\"b\"}" }
  ]
}

Up to 10 events per batch.

Limits

  • data payload: 100 KB max (after JSON encoding)
  • 100 channels max per single trigger
  • 10 events max per batch
  • Server-side rate limit per app, scaled to your plan