Serverless incident notification API using Kumologica and Twilio

Kumologica
5 min readJul 24, 2020

--

When a server goes down, or a critical issue is reported by your customers — your team swing into action but, you have to contact your team promptly. SMS and Voice calls are two channels of communication which are popular for alerting and notification.

In this article we will be creating an IncidentNotification API intelligent enough to decide based on incident severity to send SMS or a Voice call to the support engineers using Twilio cloud messaging platform . We will be building the API using Kumologica. Kumologica is a free low-code development tool to build serverless integrations. You can learn more about Kumologica in this medium article or subscribe to our YouTube channel for the latest videos.

Use case

In this use case we are having an IT service desk operator who will be receiving a call from the customer regarding an issue with the application. The service desk operator takes the details and raises a ticket on the ITSM (IT service management) tool and gets the ticket number. The IT service desk operator then uses the Slack channel to notify the support engineer. In order to notify the service desk operator types the following slack command in the channel /ticket <<ticket number>>.

The API will fetch the support engineer contact number and severity of the incident using the ticket number from ITSM datastore. In this use case we will assume DynamoDB as the ITSM datastore. Now if the severity of the incident is P3 or P2 the flow will route the call to Twilio for sending a SMS with a specific ticket details. If the severity is P1 then route the call to Twilio for making a voice call with a specific message.

High level use case flow

Prerequisite

  1. Kumologica designer installed in your machine. https://kumologica.com/download.html

2. Twilio platform Account

3. Slack Account

4. DynamoDB with the following records.

The emp_contactno should be verified numbers in your Twilio account.

Records in DynamoDB

Implementation

In order to implement the Incident notification API we will be following the below given logic

Incident notification API flow logic
  1. Open Kumologica Designer, click the Home button and choose Create New Kumologica Project.

Enter name (for example IncidentNotificationAPI), select directory for project and switch Source into From Existing Flow …

2. Copy and Paste the following flow

3. press Create Button.

Install Twilio Node.

Twilio node is a contribution node and must be explicitly installed in Kumologica Designer. Press Add more nodes button located in the bottom left corner of designer. You will be presented screen with all contribution nodes that are currently available. Choose Twilio node, press Install button. After few seconds, plugin will be installed and you will be prompted to restart Kumologica Designer. Twilio node will be located under new category: Platforms after restart.

You should be seeing two flows as given below on the designer canvas.

The first flow is the API endpoint with the resource path /ticket. This flow accepts the request from Slack and makes a call to DynamoDB(ITSM) to fetch the ticket details. The ticket details is then published to a Amazon SQS queue. This is done as an event driven model in order to respond back to Slack quickly (the default timeout of Slack is 3 second).

Incident notification API with /ticket resource

The second flow having the rule logic to decide whether to send SMS or voice call. The ticket details are fetched from the SQS using EventListener node and based on the ticket severity appropriate route will be taken to invoke Twilio to send an SMS or a voice call.

Rule logic flow

Note: To try out the above flow ensure to furnish the settings of Twilio node, SQS node and AWS DynamoDB node with appropriate connection configuration.

Deploy flow to AWS Lambda

Select CLOUD tab on the right panel of Kumologica designer, choose AWS Profile and press Deploy button. This will trigger build and deployment of flow into AWS Lambda. On the trigger section you need to add to triggers.

  1. API Gateway
  2. Amazon SQS
Trigger configuration for API gateway and SQS

Once deployed you have to configure the endpoint with Slack command. In order to configure the Slack command (/ticket) you can refer the following link. https://api.slack.com/interactivity/slash-commands

Testing

  1. Type in your Slack channel the following command /ticket <<ticket number>>. The ticket number should match the ticket number stored in the DynamoDB.
  2. When the command entered, following response will be visible as response on Slack channel window.
Slack command with ticket number

3. Based on the severity associated with the ticket number SMS or voice call will be received from Twilio platform.

Conclusion

This article presented how easy Kumologica Designer flow orchestrates and integrates with Twilio platform using Twilio node. Within few minutes we have created and deployed the incident notification Kumologica flow and configured the API endpoint with Slack.

Remember Kumologica is totally free to download and use. Go ahead and give it a try, we would love to hear your feedback.

In the meantime, if there is any specific use case that you would like to see in a future article please let us know in the comments section.

--

--

Kumologica
Kumologica

Written by Kumologica

Kumologica is the first low-code development solution that makes your integration services run on serverless compute regardless the cloud provider.

No responses yet