Create a routine
Changed onCreate a routine that runs a saved prompt on a schedule and delivers the AI response through a single destination — email (one or more recipients / user groups), Slack (a single channel or direct message), or a webhook (a public HTTPS URL each run is posted to as JSON). Each scheduled run executes once using the routine owner's permissions, and every recipient receives the same result. Supply condition to deliver only when a stated condition holds. Omni returns the authored semantic query and verifies it once before creation to establish the initial comparison baseline. Organization API keys can pass ?userId=<userId> to create the routine for a specific organization member.
Request
- Base URLhttps://omniapp.co (the document declares no server; this is the origin it was published from)
- URLhttps://omniapp.co/api/v1/ai/routines
- AuthHTTP bearer
Query parameters
Target user ID (for org-scoped API keys)
Request body
Example request
{
"branchId": "550e8400-e29b-41d4-a716-446655440000",
"description": "Weekly signups summary for the growth team.",
"modelId": "770e8400-e29b-41d4-a716-446655440002",
"name": "Weekly user signups",
"prompt": "How many users signed up last week?",
"schedule": "0 9 ? * MON *",
"timezone": "America/New_York",
"topicName": "users",
"condition": {
"conditionPrompt": "there are failed orders"
},
"destination": {
"recipientEmails": [
"alice@example.com",
"bob@example.com"
],
"type": "email",
"userGroupIds": [
"X9kQ2mPz"
]
}
}Response
Routine created successfully.
Example response
{
"condition": {
"conditionPrompt": "there are failed orders",
"conditionType": "RESULTS_PRESENT",
"query": {
"aiGenerated": true,
"calculations": [],
"column_totals": {},
"fields": [
"orders.id"
],
"fill_fields": [],
"filters": {
"orders.status": {
"case_insensitive": true,
"kind": "EQUALS",
"type": "string",
"values": [
"failed"
]
}
},
"limit": 1,
"modelId": "770e8400-e29b-41d4-a716-446655440002",
"pivots": [],
"row_totals": {},
"sorts": [],
"table": "orders",
"userEditedSQL": "SELECT ${orders.id}\nFROM ${orders}\nWHERE UPPER(${orders.status}) = UPPER('failed')\nLIMIT 1",
"version": 9
}
},
"id": "880e8400-e29b-41d4-a716-446655440003"
}Changes
- info
added
webhookdiscriminator mapping keys to therequest property - info
added to the
request propertyoneOflist
- info
- breaking
the
//////request property's minLength was increased from0to1 - info
the
//////request property format was generalized fromuuidto no format
- breaking