AI Routines

Create an AI Routine

Changed on

Create 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.

post/v1/ai/routines

Request

  • Base URL
    https://blobsrus.omniapp.co/api
  • URL
    https://blobsrus.omniapp.co/api/v1/ai/routines
  • Auth
    • HTTP bearer
    • or HTTP bearer

Query parameters

userIdstring uuid

Organization API key required. The membership ID of the user to act as.

Request body

branchIdstring uuid nullable

Branch of the shared model the prompt runs against, or null.

descriptionstring

Optional human-readable notes about the routine. Display-only — never used as model input.

modelIdstring uuid required

The UUID of the model the prompt runs against. Must be a shared model, or a shared-extension model usable as a workbook base.

namestring required

Customer-visible name of the routine. Used as the email subject for email destinations, shown on Slack deliveries, and sent as name in webhook payloads.

promptstring required

Natural language prompt Omni runs on each scheduled run. Run a skill as part of the routine by including a skill's /identifier, which will resolve as the routine owner when the routine fires.

schedulestring required

Six-field cron expression (minute, hour, day-of-month, month, day-of-week, year; use ? for an unspecified day field).

Minimum frequency is once per hour; contact Omni support if you need more frequent scheduling.

timezonestring required

IANA timezone identifier used to evaluate the schedule.

topicNamestring

Topic name to scope query generation. If omitted, the AI picks the best topic.

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

idstring uuid required

The unique identifier for the newly created routine.

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 from 0 to 1

    • breaking

      the request property's minLength was increased from 0 to 1

    • breaking

      the request property's minLength was increased from 0 to 1

    • breaking

      the request property's minLength was increased from 0 to 1

    • warning

      the request property's maxLength was set to 2000

    • warning

      the request property's maxLength was set to 512

    • warning

      the request property's maxLength was set to 256

    • 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 email slack webhook discriminator mapping keys to the request property

    • info

      added to the request property oneOf list

    • info

      the ////// request property format was generalized from uuid to 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