.. _http-webhooks: Webhooks ======== Setup ----- Setup the hook on the actor using xbusctl: .. code-block:: bash xbusctl actor config set http.webhook.url=http<...> Optionaly, set a message content-type ('application/json' (default) or 'application/x-protobuf'). .. code-block:: bash xbusctl actor config set http.webhook.content-type= For example: .. code-block:: bash xbusctl actor config set my-frontend-consumer http.webhook.url=https://myfrontend.com/webhook/somehardtoguesswebpath .. warning:: The xbus-http instance must be restarted after setting up a webhook. API --- The gateway will POST new requests on the url. The response must be a properly encoded ActorProcessingState. If not, the process will fail. If the status of the returned state is 'RUNNING', the client must call '/processingend' later. **Example request**: .. sourcecode:: http POST /my/hook/webpath HTTP/1.1 Host: example.com Accept: application/json Accept-Item-Encoding: binary Content-Type: application/json { "context": {}, "inputs": [{ "name": "default", "envelope": { "event_ids": ["53131466-4e2e-11e7-916e-af2b1e6d242d"], "events": [{ "id": "53131466-4e2e-11e7-916e-af2b1e6d242d", "type": "test", "ItemCount": 1, "encoding": "binary", "items": ["QSBtZXNzYWdl"] }] }, "envelopeposition": { "envelope_id": "53131466-4e2e-11e7-916e-af2b1e6d242d", "start": true, "complete": true, "eventPosisions": [{ "event_id": "53131466-4e2e-11e7-916e-af2b1e6d242d", "index": 1, "itemCount": 1 }] } }] } **Example response** .. sourcecode:: http { "context": {}, "status": "SUCCESS", "messages": [{ "timestamp": "2018-08-20T22:56:12Z", "level": "NOTICE", "text": "Hello there" }] }