> For the complete documentation index, see [llms.txt](https://docs.valohai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valohai.com/automation-overview/triggers/webhooks/examples/v7-integration.md).

# Trigger Example with V7

You can integrate model annotation workflows from [V7 Labs](https://www.v7labs.com) with Valohai using webhooks.

## Configuration on Valohai

You will need a step configured in your project to be launched as a V7 webhook is received. Here's an example configuration and code:

Add this step to your `valohai.yaml`:

```yaml
- step:
    name: V7 incoming
    image: python:3.11
    command:
    - pip install valohai-utils
    - python ./v7_request.py
    inputs:
      - name: v7-payload
```

Create a file named `v7_request.py`, with this code:

```python
import json
import valohai

with open(valohai.inputs("v7-payload").path()) as payload_f:
    payload = json.load(payload_f)

print("Got this data from V7:")
print(json.dumps(payload, indent=4))
```

We can now create a new Webhook Trigger in your Project settings -> Triggers -> Create Trigger

You will need to create and write down a unique secret token to authorize the webhook request. Your password manager can create and manage this secret, or you can choose this value freely.

1. For *Trigger Type*, select Webhook
2. Using the condition column's *+ Add* menu, add a *Web Request Authentication* condition
   1. *Type*: select "Static Token"
   2. *Token Lookup Namespace*: select "HTTP Header"
   3. *Token Lookup Key*: type `Authorization`
   4. *Secret Key*: put the unique secret token
   5. *Value Prefix*: type `token=`
3. Using the action column's *+ Add* menu, add a *Run Execution* action
   1. *Source Commit Reference*: type the primary branch of your Valohai project in Git. This is usually either `main` or `master`
   2. *Step Name*: type `V7 incoming`
   3. *Payload Input Name*: type `v7-payload`
4. Click on *Save Trigger*
5. You are now on the Triggers list again. Select the `...` menu of the trigger we just created, and select "Edit" to return to editing the trigger. Get the trigger URL and save it to your notes.

{% hint style="info" %}
**You can also launch a pipeline:** While this guide just uses a simple execution that lets you inspect the data payload V7 is sending, a good next step is to bootstrap the creation of a pipeline by parsing the webhook payload into input files and parameters for further steps in a pipeline.

This allows reusing general purpose steps as only the entry point execution needs to know how V7 sends data payloads.
{% endhint %}

## Configuration on V7

Webhooks are represented on V7 as Webhook stages in a workflow.

Navigate to your workflow, create a webhook stage, and connect it to the rest of the workflow:

1. *URL*: paste the webhook URL we created above
2. *Authorization header*: type: `token=<paste unique secret token here>`
3. Check *Include annotation data*
4. You can now click the "Test" button to check that it's all wired up and an execution is launched on Valohai

V7 will now automatically launch your step on Valohai once the workflow reaches the Webhook stage.

## Next steps

* Read [7labs docs about Webhook stages](https://docs.v7labs.com/docs/the-webhook-stage)
* You can call the V7 API from inside your Valohai executions to report results back. See the [V7labs docs for example code](https://docs.v7labs.com/docs/validate-annotations-with-webhooks)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.valohai.com/automation-overview/triggers/webhooks/examples/v7-integration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
