How to: Automate workflows with webhooks
How do webhooks work?
When Events occur, Spark captures all the necessary event-related properties and packages them as JSON.
Next, Spark initiates an HTTP
POSTrequest to the URL configured for the webhook. It includes the JSON data in the request body, along with the third-party server's API key preconfigured to be sent as a request header or query parameter.The third-party server (receiving endpoint) then processes the request and initiates a callback to respond to the user's action.
Set up webhooks on Spark
Only tenant-admin s can set up webhooks on Spark.
To get started, click on your initials found on the top right corner of the Spark interface and select Options.
On the Tenant configuration page, navigate to the Webhooks tab.
Select Enable webhooks.
Select New webhook.
Enter the Name.
Enter the Endpoint URL.
Select which Event types will trigger webhook messages.
Add Request headers and Query string parameters that may be needed for the webhook call to be consumed.
Enter a Description if you have one.
Select Add to add this webhook to the list.
Select Save to save the new webhook.
JSON object of event properties
In response to a user action, Spark sends the following JSON request to the external endpoint. All the fields below are defined as string types.
FolderName
The folder associated with the event.
ServiceName
The service associated with the event.
EntityId
Id of the folder associated with the event.
UserAction
Event type, see How to: Automate workflows with webhooks.
AuditType
Classification of the entity. Typically, this is either Product for a folder or ProductEngine for a service.
Data.ProductName
Same as FolderName.
Data.EngineName
Same as ServiceName.
Data.FileName
Filename of the original service.
Data.ProductId
Same as EntityId.
Data.ServiceVersionId
version_id of the service.
Tenant
The tenant associated with the event.
RequestTimeStamp
Timestamp for the event.
RevisionId
null
Sample webhook body
External receiver endpoint
The external receiving endpoint should implement API key authorization. This token, provided by Spark, will be used by your endpoint for validation. The API Key can be included either:
Query string
POST /your-api?api_key=abcdef12345
Request header
POST HTTP/1.1 x-api-key: abcdef12345
After successful authorization, your endpoint should extract the JSON values from the request body and process the callback accordingly.
Last updated
