JourneyApps supports outgoing webhooks that allow remote endpoints to be called when data changes are made.
Webhooks can be configured for a specific model in your Data Model, which will then be triggered when certain conditions are met.
Webhooks are defined in the Data Model of your app, in OXIDE.
To define webhooks to be sent when a specific type of object is created or saved, add a
<webhook/>element at the end of a
Webhooks can be defined for integrating with internal JourneyApps systems, specifically CloudCode, or with external services.
All webhook requests include a signature that can be used to verify the authenticity without needing to configure any shared secrets.
The configuration options in the
<webhook/>tag are as follows:
name=""are relevant for webhooks to external systems.
Once the webhook has been defined in OXIDE, the endpoint needs to be configured in the Backend. The webhooks will not fire until this has been completed.
This is done through the "Manage Webhooks" link in the user drop-down menu (only available for elevated super-users). All external webhooks will be listed under the "User hooks" section. The "Manage" action for each webhook allows the webhook to be enabled and the endpoint URL to be specified.
Example: External Webhook
In the example below, we trigger a request to
http://requestb.in/1mwlqhx1every time that an object of type
<webhook type="update" name="external_webhook_name" />
The relevant headers for the resulting POST request are as follows:
The JSON body for the request is as follows:
"name": "Sample Resource",
The values in
Webhook definitions can optionally contain a number of
fieldelements for specifying triggering conditions and embedded attachments or belongs-to objects. The webhook will only trigger once all conditions have been met, regardless of the type of webhook.
The configuration options for the
fieldelement are as follows:
In the example below, we trigger the event for the
asset_readywebhook the first time that the
asset_photoattachment field is set and uploaded and the
belongs-torelationship) is set. The
asset_photoattachment field is embedded in the webhook request.
<model name="asset" label="Asset">
<field name="name" label="Name" type="text:name"/>
<field name="asset_photo" label="Asset Photo" type="photo" />
<belongs-to model="user" />
<webhook type="ready" name="asset_ready">
<field name="asset_photo" required="true" embed="true" state="uploaded" />
<field name="user" required="true" embed="false" />