Skip to main content

Automation through Bots

Automation, and the ability to build highly automated, custom workflows is one of the primary use-cases of Medplum. Medplum automations are implemented via bots, which are lambdas that implement custom functions written by developers.

Bots are often linked with integrations and are one of the most utilized features of Medplum.


To get a sense of what bots are, it's useful to consider some examples. Below are examples of automations built using the bots framework.

Writing Bots

Bots are written in TypeScript using the Medplum SDK. Bots are then deployed into and hosted as part of the core application, much like AWS Lambdas. When the bot is invoked the bot code is executed.

  • The bots active in your account can be viewed in on
  • Tutorials on how to write bots can be found here
  • Reference implementations of common bots can be found here
  • Command Line Interface (CLI) documentation for testing and deploying bots can be found here

Triggering Bots

Bots can be triggered the following ways:

  • Via subscription: subscriptions are webhooks that are triggered when FHIR resources are created or updated and can trigger bots.
  • POST to $execute endpoint: each bot exposes an API endpoint and a POST to that endpoint will trigger the bot.
  • Via Questionnaire: you can link a questionnaire to a bot and when the questionnaire is filled out, the bot can process the response.

A detailed guide on these scenarios can be found in our bots tutorials.

FHIR Resources

ResourceApp LinkCreate NewAPI Documentation
BotView AllCreate NewCLI
SubscriptionView AllCreate NewAPI
QuestionnaireView AllCreate NewAPI
QuestionnaireResponseView AllCreated programmaticallyAPI
AuditEventView AllCreated automaticallyAPI

System Diagram

This diagram shows how bots fit into the overall system architecture.

Medplum system overview

Demos and Reference Material