Skip to content
SMS Management

SMS Management

SMS Management sends text messages through an SMS provider, currently Spryng. Messages which cannot be sent immediately are queued and retried in the background. Administrators see the queue and can send a test SMS.

Send a test SMS

Enable

import cfgsms "go.wdy.de/nago/application/sms/cfg"

smsMgmt := std.Must(cfgsms.Enable(cfg)) // cfgsms.Management

SMS Management enables Secret Management. cfgsms.Management has the fields UseCases sms.UseCases and Pages uisms.Pages with the paths Queue and Send.

Configure a provider

Create a secret of the type Spryng SMS with the API token in the vault and share it with the group System. If several providers exist, ProviderHint selects one by name or ID.

Send an SMS

recipient := std.Must(message.NewMSISDN("+49 170 1234567"))
_, err := smsMgmt.UseCases.Send(subject, message.SendRequested{
	Recipient:  recipient,
	Originator: "MyApp",
	Body:       "Your appointment is tomorrow at 10:00.",
}, sms.SendOptions{})
if err != nil {
	return err
}

The originator has at most 11 alphanumeric characters or 14 digits. Without a provider or on failure the message is queued, unless SendOptions.NoQueue is set. Publishing a message.SendRequested on the event bus sends it as the system user. Sent messages are removed after 7 days.

Use cases

Use caseDescription
SendSends an SMS or queues it.
FindAllMessageIDsLists the stored messages (queue and history).
FindMessageByIDLoads a stored message.
DeleteMessageByIDDeletes a stored message.
ReloadProviderRebuilds the providers from the vault, also done automatically.

Permissions

PermissionAllows to
nago.sms.provider.sendsend SMS
nago.sms.provider.find_all_identslist stored messages
nago.sms.provider.find_by_idview a stored message
nago.sms.provider.delete_by_iddelete stored messages
nago.sms.provider.reloadreload the providers

UI

admin/sms/queue shows the stored messages, admin/sms/send sends a test SMS. The admin center shows them in the group SMS as Maintenance and Send SMS.

Related