Webhooks

The webhooks setting allows you to configure a webhook with Cloudomation that triggers a specific flow script. Creating this setting configures an endpoint at https://app.cloudomation.com/api/latest/webhook/<client name>/<webhook name>. A GET or POST request to that URL will execute a flow script. Optionally, the webhook can return a response.

Note: A HTTP GET request should only be used to retrieve a resource, while a HTTP POST request should be used to create a resource. Triggering a Cloudomation webhook creates an execution. Thus the recommended way to trigger a webhook is by using a POST request. For compatibility reasons Cloudomation also allows triggering webhooks using a GET request.

To register a webhook, you need to create a setting that follows a specific pattern:

Setting name: 

client.webhook.<webhook name>

Setting Content:

flow_name: my-flow-name
user_name: my-user-name
key: my-secret-api-key

The flow will receive a dictionary containing the request headers and payload. The key field is optional. If specified, the request must contain the key in the query string or JSON payload.

The standard behavior of the webhook is to execute the flow script, wait for the flow script to finish, and then return the flow with all its inputs and outputs as a json response to the call. If no response is required, it is possible to add a parameter async to the webhook call, which will trigger the flow script without sending a respons

Example Setting

Setting name:

client.webhook.signup

Setting content:

flow_name: signup
user_name: kevin
key: my-secret-api-key

Creating this setting configures an endpoint at https://app.cloudomation.com/api/latest/webhook/myclient/signup. A GET or POST request to that URL will execute the flow named signup with the permissions of user kevin.

Example Calls

curl -d '{"key": "my-secret-api-key"}' https://app.cloudomation.com/api/1/webhook/test-client/my-webhook

The above call will trigger the flow script, wait for it to finish and return the flow script itself as well as its inputs and outputs as a json response.

curl -d '{"key": "my-secret-api-key"}' https://app.cloudomation.com/api/latest/webhook/test-client/my-webhook?async

The above call will trigger the flow script and return immediately without waiting for the flow to finish. The json response will contain the execution id.

Webhooks in Development Mode

Executions can also be started in development mode via a webhook. To configure a webhook to start executions in development mode, add the line mode: dev to the setting that configures the webhook. If no mode is specified in a webhook setting, all executions will by default be executed in productive mode.
Note: make sure you remove the mode: dev line in your webhooks when finishing development!

Find more information about the development mode on the page Development and Productive Mode