HyperPortal - SMS support
Summary
The possibility to send an SMS message is currently made available within HyperPortal as a function for an automated workflow task, and as an internal function; both using the third-party Twilio service as the underlying infrastructure.
Usage - automated workflow task
When defining workflow tasks you can select an automated "Send SMS" task.

This task creates a specific node where the user can specify the phone number to send the SMS message to (has to be a phone property to guarantee phone number correctness) and a default message to send. The message can use process variables using the templating nomenclature {{var}}. Additionally, for example to consider multi-language, a mapping property and mapping values can be used to tailor the message more specifically.

When an instance of such as process runs and the sms task completed successfully, an SMS is sent to the specified phone number.

For carriers and phone number that support it, an identifier "hyperportal" is assigned to the sender phone number.

Usage - internal lambda invocation
Within our backend components you can invoke this function as an internal lambda, meaning that you can invoke the lambda from another lambda if outside the phone service (e.g., send an SMS to a number every time an error occurs in the codebase), or simply calling the logic function if within the phone service. The input schema is defined as follows. To note that the current implementation for the internal version has different input parameters than the invocation via workflows.
export const evtSchema = Joi.object({
tenantId: Joi.string().required(),
message: Joi.string()
.min(1)
.required(),
phoneNumber: Joi.string()
.regex(E164_PHONE_NUMBER_REGEX)
.required()
}).required();The function can be called using our invoke utilities.
import { invoke } from '@hypercharge/lambda-utils/lib/libLambda';
await invoke(<${Env}-PhoneInvokeInternalHandler>, {
handlerName: 'sendSms',
handlerEvent: {
tenantId,
message: 'My message',
phoneNumber: '+351910000000'
}
});Codebase
In the HyperPortal backend repository (lambdas-monorepo) there is a phone microservice which contains phone related functionality: webhook for Twilio WhatsApp messaging, automated workflow task to send SMS (with internal version also), and an phone validator. Please refer to the README file for additional information.
Twilio
We integrate with the third-party Twilio service to actually send the SMS messages. Not all developers have access to our account, therefore if you need access please ask a manager or a colleague.
Within Twilio you can purchase phone numbers from different countries and with different characteristics to fulfil your intentions. Phone number have different costs and compliance regulations, therefore always check their documentation for more up to date information. At this moment, we have two phone numbers associated with HyperPortal.

After having phone numbers, it is now possible to configure a Programmable SMS messaging service. This can be accomplished within Twilio's interface and requires specifying properties, features, use cases, inbound and outbound settings, as well as associated phone numbers.



Within the Twilio interface it is also possible to check the logs for SMS messages sent, failed, pricing and other usage/insights metrics.

Tenant usage control
Currently, the only way to check how many SMS's a specific tenant has sent is programmatically by a developer. There is no tool for a manager/consultant to check. Programmatically, this can be achieved by checking which workflows have SMS tasks, and then checking if those tasks completed, failed, or have not yet executed. For a future where we need more tracking, I would suggest having the type of task as a property of the task definition so that it can be queried more directly.