Skip to main content

bots

Lets the project run Bots: server-side code that Ovok executes on request, when data changes, or on a schedule.

TypeProject feature
Value in featuresbots
Change withPATCH /v1/projects/me/features (replaces the whole list)
Who can change itProject admin. Any practitioner can read the list.
On for new projectsYes
Other features that need itcron and Subscriptions that deliver to a Bot
When offBots cannot be executed or deployed

What it enables​

CapabilityRoute
Run a Bot by idPOST /fhir/R4/Bot/:id/$execute
Run a Bot by identifierPOST /fhir/R4/Bot/$execute?identifier= and POST /bots?identifier=
Deploy Bot codePOST /fhir/R4/Bot/:id/$deploy
Run a Bot when data changesA Subscription whose channel endpoint is Bot/<id>
Run a Bot on a scheduleTogether with cron

Turn it on​

Read the current list, add bots, and send the whole list back. PATCH replaces the list, so any feature you leave out is turned off.

curl --request PATCH \
--url 'https://api.sandbox.ovok.com/v1/projects/me/features' \
--header "Authorization: Bearer ${OVOK_TOKEN}" \
--header 'Content-Type: application/json' \
--data '{"features":["bots","cron","email","transaction-bundles","websocket-subscriptions"]}'

The response is { "features": [...] }, the list as stored.

What callers see when it is off​

RequestStatusResponse
POST /fhir/R4/Bot/:id/$execute400An OperationOutcome saying Bots not enabled
POST /fhir/R4/Bot/:id/$deploy400Bots not enabled
POST /bots?identifier=400Failed to execute bot.

A Subscription that delivers to a Bot, and a scheduled Bot, simply do not run.

Gotchas​

  • The check is made against the project the Bot belongs to. A Bot lives in the project where it was created, so that project needs the feature.
  • Scheduled Bots keep firing after you turn it off, and fail. Schedules that already exist are not removed; each run is refused with Bots not enabled. Remove a Bot's schedule if you want it to stop.
  • The feature is necessary, not sufficient. A Bot also needs a supported runtime. One that does not have one fails with Unsupported bot runtime.
  • Sending email from a Bot is a separate feature. Add email as well.
  • POST /bots?identifier= needs exactly one match. No Bot, or more than one, with that identifier answers 400, and a successful run answers 201.
  • Projects created before this was a default can lack it. Call GET /v1/projects/me/features and check.