@wireland/sms
v0.1.0
Published
Wireline SMS API.
Downloads
2
Readme
Send SMS service
Simple wrapper for Twilio that will send an SMS message to a mobile number.
Usage
First make sure we have examples monorepo initialized. Run yarn
from the examples repo root.
Deploy the SMS stack service
Run the follwing commands from the examples/sms
wire build
wire service register --domain example.com
wire stack deploy
Wireline Sandbox
Create a new project using the
service-template
.Update
stack.yml
to add a reference to the SMS service:stack: sms: reference: endpointUrl: "wrn::example.com/sms/sms"
Modify
handler.js
to import theSMS
APIimport { Wireline } from '@wirelineio/sdk'; import SMS from '@wireland/sms'; module.exports = { test: Wireline.exec(async (event, context) => { const { phone, msg = 'Hello there!' } = event.queryStringParameters || {}; await new SMS(context).send(phone, msg); }) };
If there is an error sending the message the error will be thrown by the
.send
method so its recommended that you use a try/catch block to handle any errors.