HeyMark
Content

Blog

What is a webhook? A simple explanation, with social media examples

8 min read

A webhook is an automatic message a platform sends to a web address of yours (a URL) when something you care about happens: a new comment, a direct message, a lead from a form. Instead of your system asking the platform every so often whether anything is new, the platform tells your system when something is. Technically, that message is an HTTP POST request carrying the event data as JSON, which your server receives and processes.

We read every source on this page on November 30, 2026.

An example: someone comments “price”

Fictional example. Lumbre, a home goods shop, posts a reel of a new lamp. At 6:02 p.m., someone comments “price”. The shop wants to reply with the price and a link to its catalog.

With a webhook. Instagram sends the shop’s URL a notification for the comments field. Simplified, with made-up values and in the format of Meta’s notification examples, it looks like this:

{
  "object": "instagram",
  "entry": [
    {
      "id": "17841400000000001",
      "time": 1764536520,
      "changes": [
        {
          "field": "comments",
          "value": {
            "from": { "id": "1234567890", "username": "customer.example" },
            "comment_id": "17900000000000002",
            "text": "price",
            "media": { "id": "17800000000000003" }
          }
        }
      ]
    }
  ]
}

The shop’s system reads text, spots the word “price” and replies. The notification arrives because the comment happened, not because anyone asked for it.

Without a webhook (calling the API). The shop’s system asks the Instagram API every minute whether there are new comments. That’s 1,440 requests a day (60 an hour for 24 hours) for each post it watches, almost all of them answered with “nothing new”. And the 6:02 p.m. comment may wait until the next check.

Webhook vs API: the difference

Checking on a schedule is called polling. GitHub, which also sends webhooks, puts it this way in its documentation on webhooks: with a webhook, “you only need to express interest in an event once”; webhooks “require less effort and less resources than polling an API”, “scale better than API calls”, and “allow near real-time updates”.

Webhook Calling the API (polling)
Who starts it The platform, when something happens Your system, on a schedule
When you find out Near real time At the next check
What it costs you You only receive something when there’s an event Requests even when nothing is new, which count toward your rate limit
What you need A public URL that’s always on A process that checks at intervals

A webhook doesn’t replace the API. The notification tells you what happened; to reply to the comment or send the message, your system calls the platform’s API. And polling still makes sense in some cases: GitHub says that if you only need information once or intermittently, or from a small set of resources with no plans to scale up, you can call the API when you need it.

How a webhook works at Meta (Instagram and Facebook)

Meta’s getting started guide for webhooks lays out the whole flow:

  1. An HTTPS URL. Your server needs a valid TLS or SSL certificate. Meta doesn’t support self-signed certificates.
  2. Verification. When you set up the webhook, Meta sends a GET request to your URL with three parameters: hub.mode (always subscribe), hub.verify_token (a string you typed in your app dashboard) and hub.challenge (a number). Your server checks that the token matches and responds with the hub.challenge value. That’s how Meta knows the URL is yours and listening.
  3. Notifications. From then on, each change arrives as a POST request with a JSON body. Meta batches them, up to 1,000 updates per batch, and your server should answer every notification with 200 OK.
  4. The signature. Meta signs every notification with SHA256 and sends the signature in the X-Hub-Signature-256 header. Your server computes the signature from the payload it received and your App Secret, and compares it with everything after sha256=. In Meta’s words: “You don’t have to validate the payload, but you should.”

Instagram adds conditions, per the Instagram webhooks setup page: the app must be published (Live) to receive notifications for its users, the comments and live_comments fields require Advanced Access, the account must be a professional account subscribed to the app, and the account that owns the media must be public: private accounts don’t receive comment or mention notifications.

Which social media events arrive by webhook

  • Instagram. The fields and permissions table includes, among others, comments, live_comments, mentions, messages, message_reactions and messaging_postbacks. What’s available depends on how your app logs users in: with Facebook Login there are no messaging fields, and with the Instagram Messaging API through the Messenger Platform there are no comment fields.
  • Facebook (Pages). In the Page webhooks reference, the feed field “describes nearly all changes to a Page’s feed,” such as posts, shares and likes. The same page notes that notifications aren’t sent for ad posts, but are sent for comments on them.
  • TikTok. The TikTok for Developers events list has four: authorization.removed (someone disconnected your app), video.upload.failed, video.publish.completed and portability.download.ready. It includes no comments or direct messages. Leads from TikTok Ads Manager instant forms can be sent to a webhook, but that integration lives in Ads Manager; if they aren’t arriving, see why TikTok leads aren’t reaching your webhook.

For comments and messages, Meta’s webhooks are the notification; the rules on what an app may send back, and within what time window, are covered in the Instagram API and how many automated messages Instagram lets you send.

What can go wrong

Your URL is down or doesn’t respond. According to its getting started guide, Meta retries immediately, then will “try a few more times with decreasing frequency over the next 36 hours”; after those 36 hours, unacknowledged notifications are dropped. TikTok, per its webhooks overview, retries for up to 72 hours with exponential backoff and then discards the notification. The Instagram webhooks page warns that there’s no historical notification store: whatever you missed, you recover by calling the API.

You accept notifications without checking the signature. Your URL is public. If your server doesn’t check the signature, it processes any POST that arrives in the right shape, whether or not it came from the platform. At Meta you compare X-Hub-Signature-256; at TikTok, the TikTok-Signature header carries a timestamp and an HMAC SHA256 signature computed with your app’s client_secret, and its verification page suggests rejecting notifications whose signature is valid but whose timestamp is too old.

The same notification arrives twice. Meta says your server should handle deduplication, and TikTok describes “at least once” delivery, so the same event can arrive more than once. In the shop example, without that check, the person who commented “price” gets two replies. The fix is simple: store each event’s ID (in the example, comment_id) and never act twice on the same one.

Past events don't arrive

A webhook tells you about what happens after you set it up. For TikTok Ads Manager forms, TikTok’s help center puts it plainly: only lead data collected after the integration is sent.

What you need if you don’t code

A webhook needs a receiver: a server that’s always on, verifies, answers in time, drops duplicates and then does something with the notification. Without coding, you have two options:

  • An automation tool with a webhook receiver. For example, n8n has a node that, per its documentation, creates webhooks “which can receive data from apps and services when an event occurs,” with a test URL and a production URL. It works when the source lets you paste any URL, like the TikTok Ads Manager lead webhook. For Instagram and Facebook, though, the webhook is set up inside a Meta app with the permissions in the fields table.
  • A social media management tool already connected to each network’s API. You set the rule (which keyword, which reply) and the tool handles the rest. How these options compare is covered in how to automate social media posts.

In HeyMark, keyword public replies and DMs on Instagram and Facebook are included on every plan, with no credits spent: the walkthrough is in how to send a link by DM with a keyword in HeyMark. HeyMark has no public REST API yet; programmatic access is through its MCP server.

Plan your next post in HeyMark.

Keep the idea, review the draft with your team, and see how it performed in the accounts you connected.