Patient Encounter notification Application

In this tutorial, we will create a simple application written on Clojure programming language using Aidbox Clojure SDK and or Aidboxone as a backend.

All source code available on Github Aidbox/app-mailgun-clj

Problem statement

We have a Encounter included Patient, date and location of visit.

We want to send an Email to a patient with a notification of the upcoming visit. In this email we want to show the Patient information, time and location of the visit. These notifications should be sent the day before the visit.


Aidbox as backend which will store all Encounters. .....

Clojure application with Aidbox Clojure SDK as a connector between our application and backend.

For sending Emails we will use MailGun service as the easiest way to send emails instead SMPT.

Get started

Firstly, you need to install local Aidbox. See the full instruction on how to install Aidbox locally and how to use Rest API

In this sample application, we use Clojure CLI. See Getting Started for details on how to install the tools.

Enable Aidbox SDK

In this sample app we will use Clojure Cli - command line tools for running REPL and Clojure apps. In deps.end file need specify aidbox-sdk as a reference to git.

  {aidbox-sdk {:git/url "" 
               :sha "057ebd1a542bb17c7a910283ae942f56a89167f1"}}}

And then require aidbox-sdk in the main mailgun.core file

(ns mailgun.core
  (:require [aidbox.sdk.core :as aidbox]))

Connect your app with Aidbox

For connecting your application with Aidbox, you need call aidbox/call method send them information about the location of Aidbox and your application.

(def manifest
  {:id "mailgun-app"
   :type "app"
   :env {:box {;; host and port of Aidbox instance
               :host "localhost"
               :scheme "http"
               :port 8888}
         :app {;; host, port and client creds of your application
               ;;:host "docker.for.mac.localhost"  ;; for Mac Os
               :host "localhost"
               :scheme "http"
               :port 8989
               :id "root"
               :secret "secret"}}})

(defn -main [] (aidbox/start manifest))

How it works?

When you call aidbox/start method, aidbox-sdk try to connect to Aidbox with given , and credentials and then, if the connection is successful, register your app in Aidbox. After that, aidbox/sdk create local web server running on port, in our case is 8989.

Mailgun integration


Aidbox Jobs

Last updated