diff --git a/features/automations.mdx b/features/automations.mdx index 56b1027..e84e4b5 100644 --- a/features/automations.mdx +++ b/features/automations.mdx @@ -39,19 +39,12 @@ React to events from your integrations in real-time. | **Linear** | Issue created, issue updated, status changed | | **Slack** | Message in channel, @tembo mention | -### Automation slug +#### Trigger through webhooks -Use an automation slug to trigger an automation on demand from external systems or chat commands. - -1. Set a **Slug** on your automation (in the automation's properties panel). -2. Trigger the automation with that slug from API calls or slash commands. +You can trigger an automation on demand from external systems using the automation's [webhook trigger endpoint](/api/trigger-automation). The payload is passed to the automation as event context, so your instructions can reference it directly. For example, you could write instructions like _"Fix the issue at the URL provided in the event payload"_. -#### API trigger (webhook) - -You can trigger an automation programmatically using its slug via our SDK or an [API request](/api/trigger-automation). - #### Slash command trigger You can trigger a task with the selected automation by using slash commands. diff --git a/openapi.documented.yml b/openapi.documented.yml index f7a47a8..d44fbbb 100644 --- a/openapi.documented.yml +++ b/openapi.documented.yml @@ -398,7 +398,7 @@ paths: const response = await client.task.search({ q: 'authentication bug' }); console.log(response.issues); - /automation/{slug}/trigger: + /automation/{keyOrId}/trigger: post: responses: "200": @@ -438,7 +438,7 @@ paths: - createdAt - updatedAt "404": - description: Automation not found (no automation with the given key exists in your organization) + description: Automation not found (no automation with the given key or ID exists in your organization) content: application/json: schema: @@ -451,14 +451,23 @@ paths: - error operationId: postPublic-apiAutomationTrigger parameters: - - name: slug + - name: keyOrId in: path - description: The slug of the automation to trigger. Set in the automation's properties panel. + description: The automation's UUID or its slug (key). You can find the UUID in the automation's properties panel. required: true schema: type: string - example: myAutomation - description: Trigger an automation with an arbitrary JSON payload, which is passed to the automation as event context. Only automations with a slug set can be triggered. + example: a1b2c3d4-5678-9abc-def0-1234567890ab + - name: apiKey + in: query + description: API key for authentication. Alternative to using the Authorization header. + required: false + schema: + type: string + description: |- + Trigger an automation with an arbitrary JSON payload, which is passed to the automation as event context. + + You can identify the automation by either its UUID or its slug (key). The API key can be supplied via the `Authorization: Bearer` header or the `apiKey` query parameter. summary: Trigger Automation requestBody: description: Arbitrary JSON payload passed to the automation as event context. Your automation instructions can reference any values in this payload. @@ -473,11 +482,20 @@ paths: required: false x-codeSamples: - lang: bash + label: Bearer Auth + source: |- + curl -s -X POST \ + "https://api.tembo.io/automation/${AUTOMATION_ID}/trigger" \ + -H "Authorization: Bearer ${API_KEY}" \ + -H "Content-Type: application/json" \ + -d '{"issue_url": "https://github.com/org/repo/issues/42"}' | jq . + - lang: bash + label: Query Param Auth source: |- - curl -X POST https://api.tembo.io/automation/myAutomation/trigger \ - -H "Authorization: Bearer YOUR_API_KEY" \ + curl -s -X POST \ + "https://api.tembo.io/automation/${AUTOMATION_ID}/trigger?apiKey=${API_KEY}" \ -H "Content-Type: application/json" \ - -d '{"issue_url": "https://github.com/org/repo/issues/42"}' + -d '{"issue_url": "https://github.com/org/repo/issues/42"}' | jq . /repository/list: get: responses: