|
| 1 | +--- |
| 2 | +sidebar_position: 10 |
| 3 | +--- |
| 4 | + |
| 5 | +# Trigger a webhook on prompt commit |
| 6 | + |
| 7 | +You can configure a webhook to be triggered whenever a commit is made to a prompt. |
| 8 | + |
| 9 | +Some common use cases of this include: |
| 10 | + |
| 11 | +- Triggering a CI/CD pipeline when prompts are updated |
| 12 | +- Synchronizing prompts with a GitHub repository |
| 13 | +- Notifying team members about prompt modifications |
| 14 | + |
| 15 | +## Configure a webhook |
| 16 | + |
| 17 | +Navigate to the **Prompts** section in the left-hand sidebar or from the application homepage. |
| 18 | +In the top right corner, click on the `+ Webhook` button. |
| 19 | + |
| 20 | +Add a webhook **url** and any required **headers**. |
| 21 | + |
| 22 | +:::note |
| 23 | +You can only configure one webhook per workspace. If you want to configure multiple per workspace or set up a different webhook for each prompt, let us know in our [Community Slack](https://langchaincommunity.slack.com/) (sign up [here](https://www.langchain.com/join-community) if you're not already a member). |
| 24 | +::: |
| 25 | + |
| 26 | +To test out your webhook, click the "Send test notification" button. This will send a test notification to the webhook url you provided with a sample payload. |
| 27 | + |
| 28 | +The sample payload is a JSON object with the following fields: |
| 29 | + |
| 30 | +- `prompt_id`: The id of the prompt that was committed. |
| 31 | +- `prompt_name`: The name of the prompt that was committed. |
| 32 | +- `commit_hash`: The commit hash of the prompt. |
| 33 | +- `created_at`: The date of the commit. |
| 34 | +- `created_by`: The author of the commit. |
| 35 | +- `manifest`: The manifest of the prompt. |
| 36 | + |
| 37 | +## Trigger the webhook |
| 38 | + |
| 39 | +Commit to a prompt to trigger the webhooks you've configured. |
| 40 | + |
| 41 | +### Using the Playground |
| 42 | + |
| 43 | +If you do this in the Playground, you'll be prompted to deselect any webhooks you'd like to avoid triggering. |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +### Using the API |
| 48 | + |
| 49 | +If you commit via the API, you can specify to skip triggering all webhooks by setting the `skip_webhooks` parameter to `true` or to specify specific webhooks to trigger by setting the `ignore_webhook_ids` parameter to a list of webhook ids. |
| 50 | +See API docs [here](https://api.smith.langchain.com/redoc#tag/commits/operation/create_commit_api_v1_commits__owner___repo__post) for more information. |
0 commit comments