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.modeShould be set tosubscribeto setup a new subscription.hub.callbackEndpoint URL that you would like to setup a subscription for.for example
https://site.se/investors/news/j40sk6kfj43lgkr
hub.topicthe topic to subscribe to, in our system this is part of the feed URLfor example for the feed URL
https://feed.mfn.se/v1/feed/2c07a2db-2f22-4a67-ab46-ccb464296638?lang=svthe topic is
/feed/2c07a2db-2f22-4a67-ab46-ccb464296638?lang=svyou can read more about how to construct a feed URL in the feed documentation
Additional parameters
hub.secretRecommended. 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.pingEnables Ping Extension. NOTE: if you enable this, make sure that the your endpoint really supports it.hub.ext.eventEnables Extended events (PUT/DELETE methods).
Flow
Client POSTs to our APIs WebSub Hub URL with the required params described above
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)
The endpoint should then echo back the challenge back in the HTTP Body. This verifies the intent of the subscription
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
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
Was this helpful?