Skip to main content

Message body

Facebook sends Messenger events as nested JSON: entry, then messaging.
The object is page and entry[].id is your Page id.
The sender.id is the Page-scoped id of the person (PSID).
Pass it back as the recipient.id when you reply.
Timestamps in messaging are in milliseconds.

Other message events

Beyond plain text, the messaging array carries these events. All arrive at the same webhook URL. An echo of a message the Page sent:
A reaction:
A read receipt and a delivery receipt:
A postback:

Comment and post events

Comments and posts on the Page arrive at the same webhook URL under changes with field set to feed.
value.item says what changed (comment, status, photo, video, …) and value.verb how (add, edited, hide, unhide, remove).
A new comment on one of your posts:
comment_id feeds every comment action. post_id is the post it belongs to; parent_id is the post for a top-level comment and the parent comment for a reply.
Hidden and unhidden comments arrive with the same shape and verb set to hide or unhide. A deleted comment arrives with verb: "remove" and no message.
Comments the Page posts itself also arrive as events. Compare from.id with your Page id to skip them.
A new post on the Page:
created_time on feed events is in seconds. To act on a comment event, see Comments.

What counts as a message

Only inbound messages with text or attachments count toward your usage.
Echoes, reactions, reads, deliveries, postbacks, comments and post events are delivered but never counted.

Verification GET

When you set a deployed webhook URL, HookMyApp checks that your receiver can answer a verification request.
Respond with VERIFY_TOKEN and HTTP 200.
Local listen commands skip this check because they send events to your computer only while the command runs.

Signature verification

Every delivery POST arrives with X-HookMyApp-Signature-256: sha256=<hex>.
Compute HMAC-SHA256 over the raw request body using your webhook signing secret as the key.
This is the HMAC signing secret from hookmyapp channels webhook hmac show <channel>.
It is not the VERIFY_TOKEN.
The VERIFY_TOKEN is only echoed back on the ownership GET probe.
Compare the computed value against the hex digest in the header.
One POST is never signed: when you run webhook set, HookMyApp sends an empty-body verification probe marked X-HookMyApp-Probe: webhook-verification (User-Agent HookMyApp-Webhook-Verifier).
Answer it with any 2xx before checking signatures, or verification fails.

Acknowledge fast

Return 200 immediately.
Process asynchronously.
Queue longer work before responding.

Two ways to receive events

  • Listen to your own Page locally: hookmyapp channels listen <channel> --path /webhook/facebook tells HookMyApp to send your Page’s events to your local receiver.
    Stop the CLI when you are done.
  • Your own Page, your own URL: hookmyapp channels webhook set <channel> --url <your-public-https-url> sends events to your deployed receiver.
    Use this after your receiver is live.

Next steps