Subscribe (optional)

WebSub subscribe flow

Overview

The following is an overview for using the WebSub protocol to setup a subscription. It works by sending a POST request to our WebSub hub url (https://feed.mfn.se/v1) with some parameters as Form data. Available parameters are listed below in the API reference.

Required parameters

  • hub.mode Should be set to subscribe to setup a new subscription.

  • hub.callback Endpoint URL that you would like to setup a subscription for.

    • for example https://site.se/investors/news/j40sk6kfj43lgkr

  • hub.topic the topic to subscribe to, in our system this is part of the feed URL

    • for example for the feed URLhttps://feed.mfn.se/v1/feed/2c07a2db-2f22-4a67-ab46-ccb464296638?lang=sv

    • the topic is /feed/2c07a2db-2f22-4a67-ab46-ccb464296638?lang=sv

    • you can read more about how to construct a feed URL in the feed documentation

Additional parameters

  • hub.secret Recommended. A secret provided by you that we will use to HMAC sign the HTTP body of any POST / PUT / DELETE requests sent to your endpoint.

  • hub.ext.ping Enables Ping Extension. NOTE: if you enable this, make sure that the your endpoint really supports it.

  • hub.ext.event Enables Extended events (PUT/DELETE methods).

Flow

  1. Client POSTs to our APIs WebSub Hub URL with the required params described above

  2. Our API (the Hub) sends a GET request to the endpoint URL provided (hub.callback)

    • The request contains a challenge random string as a query param (hub.challenge)

  3. The endpoint should then echo back the challenge back in the HTTP Body. This verifies the intent of the subscription

  4. The original POST request (1) returns with 202 Accepted

WebSub Subscribe

POST https://feed.mfn.se/v1

Note: all the parameters need to be FORM encoded (x-www-form-urlencoded).

Request Body

NameTypeDescription

hub.mode

string

subscribe | unsubscribe

hub.topic

string

Topic to subscribe to. Suffix of feed URL after /v1/

hub.callback

string

Endpoint to setup a posthook for

hub.secret

string

WebSub secret for HMAC signing and verification

hub.ext.ping

boolean

Enable Ping extension. NOTE: if you enable this, make sure that the your endpoint really supports it.

hub.ext.event

boolean

Enable Extended events (PUT/DELETE methods)

Last updated