Start a run from a Linear issue
Label a Linear issue marshal and a deputy picks it up. Linear posts each new issue to a Marshal webhook endpoint, Marshal checks Linear’s signature, and a mission starts a run with the issue’s identifier and title as inputs.
Available when your administrator enables webhooks and deputies.
Before you start
- A deputy with an active mission that takes two inputs,
issueandtitle, for example with the promptImplement Linear issue {{.issue}}: {{.title}}. See Create a deputy and a mission. - You can manage that deputy.
- A Marshal API key, to create the trigger with its input map.
- A Linear API key that can create webhooks in your Linear workspace.
Steps
1. Create a Marshal endpoint in the Linear format
Follow Create a webhook endpoint and choose Linear as the Signature format. Copy the Delivery URL and the Signing secret from the Copy these now box.
2. Point a Linear webhook at it
Create the webhook with Linear’s API, so it signs with the secret Marshal issued:
curl https://api.linear.app/graphql \
-H "Authorization: $LINEAR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"mutation($input: WebhookCreateInput!) { webhookCreate(input: $input) { success webhook { id enabled } } }",
"variables":{"input":{
"label":"Marshal",
"url":"<delivery URL>",
"secret":"<signing secret>",
"resourceTypes":["Issue"],
"allPublicTeams":true}}}'To limit it to one team, replace allPublicTeams with "teamId": "<team id>".
3. Bind a trigger to the endpoint
Linear sends no X-Event-Type header, so the trigger binds to * and the condition picks the issues. Create it with the API:
curl -X POST "https://marshal.example.com/api/deputies/<deputy-slug>/triggers" \
-H "Authorization: Bearer $MARSHAL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mission": "<mission slug>",
"integration": "custom-webhook",
"connection_id": "<endpoint id>",
"event_type": "*",
"condition": "event.type == \"Issue\" && event.action == \"create\" && event.data.labels.exists(l, l.name == \"marshal\")",
"inputs": {
"issue": { "path": "data.identifier" },
"title": { "path": "data.title" }
}
}'The condition reads the Linear payload as event. Change the label name to the one your team uses.
4. Try it
Create an issue in Linear with the marshal label.
What you should see
- On the endpoint’s Deliveries tab, a delivery with the outcome
Accepted. - On the Runs page, a new run with
webhookin the Trigger column, its prompt naming the issue. - Issues without the label arrive as accepted deliveries and start nothing.