Skip to main content

Twilio SMS Worker

Send SMS messages through the Twilio messaging service.

Included in All Preset

Registered automatically by registerAllPlugins().

Registration​

import { pluginRegistry } from '@unchainedshop/core';
import { TwilioPlugin } from '@unchainedshop/plugins/worker/twilio';

pluginRegistry.register(TwilioPlugin);

Usage​

You can send SMS with arbitrary providers through Unchained's work system. To add a new SMS to the system, you can use the addWork mutation:

mutation SendSMS {
addWork(type: TWILIO, input: {
to: "+1234567890"
text: "Your order has shipped!"
from: "+0987654321"
}) {
_id
}
}

Note: The from parameter is optional and defaults to TWILIO_SMS_FROM env var.

The Twilio worker plugin automatically picks up any work items with type TWILIO and sends them for you.

Input Parameters​

ParameterTypeRequiredDescription
toStringYesRecipient phone number
textStringNoSMS message content
fromStringNoSender phone number (defaults to TWILIO_SMS_FROM)

Additional Twilio API parameters can be passed and will be forwarded to the API.

Environment Variables​

VariableDescription
TWILIO_ACCOUNT_SIDYour Twilio Account SID
TWILIO_AUTH_TOKENYour Twilio Auth Token
TWILIO_SMS_FROMDefault sender phone number (must be a Twilio number)

Adapter Details​

PropertyValue
Keyshop.unchained.worker-plugin.twilio
TypeTWILIO
Sourceworker/twilio

External Resources​