IncomingWebhook resource can trigger one or more jobs in your pipeline whenever the associated URL is called using the HTTP POST method.
IncomingWebhook resource is created with an Incoming Webhook Integration, it can be specified as an input to any step in that step's
inputResources section. By default, any incoming payload from the webhook will trigger execution of the step, but this can be changed by setting
Any JSON payload passed in by the received POST call is stored in the
payload property of the resource.The step can access the JSON payload through the
res_<resource_name>_payload environment variable. The value of the environment variable can be written to a file, and individual elements can be read from that file using the read_json utility function.
When using Webhook as an output resource, you can construct the outgoing payload through the write_output utility function to add key/value pairs.
You can use an
IncomingWebhookresource to trigger execution of another pipeline. When specified as an output resource of a step in one pipeline and an input resource of a step in a different pipeline, setting a payload for the
IncomingWebhook in the first step will trigger execution of the other step. In this way, completion of a step in one pipeline can trigger execution of a different pipeline.
Incoming Webhooks and Multi Branch Pipelines
When working with Multi Branch Pipelines, to trigger an
IncomingWebhook resource for a specific Pipelines Source branch, you need to add the branch query parameter to your Incoming Webhook URL as follows:
resources: - name: <string> type: IncomingWebhook configuration: webhookName: <string>
An alphanumeric string (underscores are permitted) that identifies the resource.
IncomingWebhook for this resource type.
Specifies all configuration selections for the resource.
The name of an Incoming Webhook Integration
IncomingWebhookis used in a step, a set of environment variables is automatically made available that you can use in your step.
Name of the resource
Webhook payload that was received in the incoming POST or created by the step for output
resources: - name: MyIncomingWebhookResource type: IncomingWebhook configuration: webhookName: MyIncomingWebhookIntegration pipelines: - name: ExamplePipeline steps: - name: ExampleStep type: Bash configuration: inputResources: - name: MyIncomingWebhookResource execution: onExecute: - echo "$res_MyIncomingWebhookResource_payload" | jq '.' > payload.json - read_json payload.json "LESSER_SECRET_FORMULA"