Create an AI Routine
Changed onCreate a new AI Routine that runs a saved prompt on a schedule and delivers the AI response through email, Slack, or a webhook. To run a routine when a condition is met, provide a condition in the request body.
Each scheduled run executes once using the routine owner's permissions, and every recipient receives the same result.
Request
- Base URLhttps://blobsrus.omniapp.co/api
- URLhttps://blobsrus.omniapp.co/api/v1/ai/routines
- Auth
- HTTP bearer
- or HTTP bearer
Query parameters
Organization API key required. The membership ID of the user to act as.
Request body
Example request
{
"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",
"destination": {
"recipientEmails": [
"blob.ross@blobsrus.com",
"blob.the.builder@blobsrus.com"
],
"type": "email",
"userGroupIds": [
"X9kQ2mPz"
]
},
"condition": {
"conditionPrompt": "there are failed orders"
}
}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
- breaking
the request property
became not nullable - breaking
the request property
became not nullable - breaking
the
//////request property's minLength was increased from0to1 - breaking
the
request property's minLength was increased from0to1 - breaking
the
request property's minLength was increased from0to1 - breaking
the
request property's minLength was increased from0to1 - warning
the
request property's maxLength was set to2000 - warning
the
request property's maxLength was set to512 - warning
the
request property's maxLength was set to256 - info
added the new optional request property
- info
added the new optional request property
///// - info
the request property
/////became optional - info
request property
/////deprecated - info
added
emailslackwebhookdiscriminator mapping keys to therequest property - info
added to the
request propertyoneOflist - info
the
//////request property format was generalized fromuuidto no format - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
the response property
became required for the status
- breaking