0.1.0 • Published 7 years ago
@wireland/sms v0.1.0
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 buildwire service register --domain example.comwire stack deploy
Wireline Sandbox
- Create a new project using the
service-template. Update
stack.ymlto add a reference to the SMS service:stack: sms: reference: endpointUrl: "wrn::example.com/sms/sms"Modify
handler.jsto import theSMSAPIimport { 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
.sendmethod so its recommended that you use a try/catch block to handle any errors.
0.1.0
7 years ago