Task templates
Reusable task text with variables — create templates, fill them in from the New task dialog, and create tasks from them through the API.
A template is task text with {{variable}} placeholders in its title, prompt and background. Keep templates on the
Templates page (managers and above; permission project.update). A template is offered for every project, or
for one.
Variables
Add an endpoint {{method}} {{path}} to the {{service}} service.
Follow the conventions of the existing endpoints and add tests.Each variable can have a label, a default value, and can be optional. Variables used in the text but not described are required. A template holds up to 30 described variables.
Use a template
In the New task dialog, choose a template, fill in what it asks for and press Fill in the task. The title and prompt are filled in and can still be changed before you create the task.
API
| Method and path | Purpose | Permission |
|---|---|---|
GET /orgs/:orgId/task-templates | List templates (all, or those offered for one project) | member |
POST /orgs/:orgId/task-templates | Create | project.update |
PATCH /orgs/:orgId/task-templates/:id | Change | project.update |
DELETE /orgs/:orgId/task-templates/:id | Delete | project.update |
POST /orgs/:orgId/task-templates/:id/use | Create a task from the template, as the caller | task.create |
curl -X POST "$AO_SERVER/api/v1/orgs/$AO_ORG/task-templates/tpl_123/use" \
-H "Authorization: Bearer $AO_TOKEN" -H "Content-Type: application/json" \
--data '{"projectId": "prj_123", "values": {"method": "GET", "path": "/invoices/:id", "service": "billing"}}'The templates of signed webhooks are a different thing: they fill a task from the JSON a system sends.