MFN Integration Guide
  • What is MFN
  • Overview
    • Getting started
    • Integration methods
    • Disclaimer / IPO
    • Caching
    • Checklist after integration
  • Integration methods
    • On-Demand API
    • Synced API
    • MFN Loader
    • IFrame Widget
  • Wordpress Plugin
  • MFN Widgets
    • Report archive
    • Email Subscription Widget
    • Media collection
  • API
    • Feed
    • Model
      • Tags
    • Demo Data
    • WebSub
      • Endpoint
      • Subscribe (optional)
      • Ping Extension (optional)
      • Code samples
      • Misc
    • Archive
    • Email Subscription Guide
Powered by GitBook
On this page
  • Ping request
  • Ping response

Was this helpful?

  1. API
  2. WebSub

Ping Extension (optional)

Optional extension to WebSub that periodically pings subscriptions

PreviousSubscribe (optional)NextCode samples

Last updated 2 years ago

Was this helpful?

Optionally we can ping your subscriptions to make sure they are still working. This can be useful in a production setup, since it can help us detect errors early, and notify you.

To setup a subscription that will be pinged, use hub.ext.ping query param in the as described in the documentation. After that the callback endpoint will be periodically pinged by us.

Ping request

Your callback URL will be periodically called using all three methods (GET, DELETE, PUT) to make sure that it's all working and getting through correctly.

The ping requests will have an extra HTTP header set X-Hub-Ext-Ping with a value of true. And the body will be made up of a special "ping NewsItem" without any real content, that we use to test that HMAC verification, JSON decoding works and then respond to the challenge.

{
  "news_id": "00000000-0000-0000-0000-000000000000",
  "content": {
    "slug": "ping-challenge-[value]"
  },
  "properties": {
    "type": "ping"
  },
  "source": "mfn"
}

Ping response

To respond successfully to a ping, the response should be a JSON object containing the following values. And if the subscription was made with a hub.secret the body should be signed using the same shared secret and sent back with the X-Hub-Signature response header.

JSON Path

Content

pong.method

Echo back the HTTP method from the request (case insensitive)

POST / PUT / DELETE

pong.challenge

Echo back the challange value extracted from content.slug in the ping request

The metadata object can contain any content. The fields user_agent and version are recommended but totally optional. The contents of both are freeform.

{
  "pong": {
    "method": "put",
    "challenge": "[value]",
  },
  "metadata": {
     "user_agent": "mfn-wp-plugin",
     "version": "0.0.53",
  },
}

subscription request