1const e=`--- 2title: Outbound Webhooks 3description: Easily automate actions with outbound webhooks, enabling triggers for events like cache disabling and workflow initiation. Boost deployment flexibility and streamline notifications with this powerful feature. 4--- 5 6# Outbound Webhooks 7 8<section> 9 10With outbound webhooks, you can conveniently trigger various actions when an event occurs, such as disabling cache or initiating workflows like notifications. This powerful feature enhances the flexibility and automation of your deployments. 11 12To enable users to define outbound webhooks upon deployment completion, follow these simple steps: 13 14- Go to **App** > **Settings** page 15- Scroll down to **Outbound webhooks** section 16- Click on **Add new webhook** to open the modal form 17- Fill out the required information in the form and proceed by clicking the **Create outbound** webhook button 18 19</section> 20 21## Events 22 23<section> 24 251. After each successful deployment 26 27 The webhook will be triggered after every successful deployment of 28 your application. A successful deployment means that your code has 29 been built and deployed without any errors. This event cycle 30 occurs before status checks are run. 31 322. After each failed deployment 33 34 The webhook will be triggered after every failed deployment. This 35 event cycle occurs before status checks are run. 36 373. After a deployment is published 38 39 The webhook will be triggered after a deployment is published. 40 This event cycle occurs after status checks are run. 41 424. After a cache purge 43 Cache is purged after the following events: 44 45 - A deployment is published 46 - Any operation to snippets 47 - The environment configuration is updated 48 49</section> 50 51## Special variables for payload 52 53<section> 54 55When the \`Request method\` is selected as \`Post\`, you can specify the request payload. This field accepts a raw string that will be send to the request URL. You can use the following variables to customize the request payload. 56 57| Variable | Description | 58| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 59| \`$SK_NOW\` | An ISO 8601 formatted time string. The time is computed when sending the webhook. | 60| \`$SK_NOW_UNIX\` | The unix timestamp. The time is computed when sending the webhook. | 61| \`$SK_APP_ID\` | The application id. | 62| \`$SK_ENVIRONMENT\` | The environment name. When triggering an outbound webhook on publish, this is the name of the environment that the deployment is published to. Otherwise, it is the name of the environment which the build configuration is taken from. | 63| \`$SK_DEPLOYMENT_ID\` | The deployment id. | 64| \`$SK_DEPLOYMENT_ENDPOINT\` | The endpoint to preview the deployment. | 65| \`$SK_DEPLOYMENT_LOGS_ENDPOINT\` | The endpoint to preview the deployment logs. You will need to be authenticated to visit this URL. | 66| \`$SK_DEPLOYMENT_STATUS\` | A string indicating the deployment status. It's either success or failed. | 67 68</section> 69 70## Examples 71 72### Receive an Email Notification when a deployment fails 73 74Requirements: 75 76- Create an Environment-level API key (**Environment** > **Config** > **API Keys**) 77- [Configure mailer](/docs/features/mailer) for your environment 78 79Steps: 80 81- Go to **App** > **Settings** 82- Scroll down to **Outbound webhooks** 83- Click on **Add new webhook** 84- Fill the form like below and click **Create outbound webhook** 85 86| | | | 87| -------------- | --------------------------------- | ------------------------------------------------------- |
88| Request URL | \`https://api.stormkit.io/v1/mail\` | Replace \`stormkit.io\` with your instance if self-hosted | 89| Enable headers | On | | 90| Header 1 | \`Content-Type\` | \`application/json\` | 91| Header 2 | \`Authorization\` | \`<your-api-key>\` | 92| Request Method | \`POST\` | | 93| Payload | See example below | | 94| Trigger When | After each failed deployment | | 95 96\`\`\`json 97{ 98 "to": "[email protected]", 99 "from": "Jane <[email protected]>", 100 "subject": "Deployment failed", 101 "body": "Hi, <br /> Deployment failed: $SK_DEPLOYMENT_ENDPOINT" 102} 103\`\`\` 104`;export{e as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.