UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

35 lines (31 loc) 921 B
import { serviceResponse } from '../../util'; /** * Create a new TwilioService instance (not meant to be instantiated directly, * use `.service('twilio', '<service-name>')` on a {@link StitchClient} instance). * * @class * @return {TwilioService} a TwilioService instance. */ class TwilioService { constructor(stitchClient, serviceName) { this.client = stitchClient; this.serviceName = serviceName; } /** * Send a text message to a number * * @method * @param {String} from number to send from * @param {String} to number to send to * @param {String} body SMS body content * @return {Promise} which resolves to 'null' when message is sent successfully, * or is rejected when there is an error */ send(from, to, body) { return serviceResponse(this, { action: 'send', args: { from, to, body } }); } } export default TwilioService;