loading...

COVID19 Test Result 2-way SMS

codewilliamson profile image Mark Williamson 🇨🇦 ・2 min read

Background

Our regional public health unit in Ontario Canada has had a hard time keeping up with notifying clients of their negative COVID19 test results. They want these notifications to be automated in order to get the results out faster and more efficiently. SMS has been chosen to notify the clients.

What I built

A solution to automatically notify clients that they have tested negative for COVID19.

Demo Link

Sorry, no demo for this solution at this time.

Link to Code

Here is the NodeJS web hook to handle incoming text messages from clients.
https://github.com/CodeWilliamson/covid19-notification

How I built it

Stack

  • Microsoft SharePoint
  • Microsoft Power Automate
  • Twilio
  • NodeJS

Alt Text

I used Microsoft Power Automate to tap into a SharePoint list that our public health department has been using to track clients' COVID19 test results.

Alt Text

The power automate flow runs every 15 minutes and pulls in a batch of list items that meet the criteria to send a client an SMS message. Power Automate will then use the Twilio connector to send out an SMS message to the client. The message sent to the client will contain an ID that the client has to text back. That will match the response to the lab results list item in order to update it. It is done this way because multiple clients and multiple lab tests might be done for the same phone number.

Alt Text

There is another power automate flow that will check the system status of all SMSs sent out to ensure they are delivered. If the phone number can't receive SMS then the system status will reflect that in the SharePoint list item. The client is then asked in the message to respond to the text with an ID number given.

I built a webhook in NodeJS (https://github.com/CodeWilliamson/covid19-notification) to receive the client's response from Twilio and update the SharePoint list item to show that the client has acknowledged the test result notification. The webhook is configured in Twilio by creating an SMS messaging service and configuring like so:

Alt Text

The key is to configure the request url to hit your custom webhook code.

Issues

I ran into an issue when trying to use the Twilio status callback to update the SharePoint list item. The problem is that it runs too quickly for SharePoint to handle the update and I got many 409 conflict errors. This is why I built an asynchronous flow to check the status of SMSs after instead of using the on-demand status callback that Twilio provides.

Posted on by:

codewilliamson profile

Mark Williamson 🇨🇦

@codewilliamson

Lover of technology, developer of things. From big platforms like Salesforce to NodeJS and all the way to home automation with Arduino, I tinker with it all.

Discussion

markdown guide