lib.messagebird.tel
Tag 0
Telephony powered by Messagebird. Claim numbers, send SMSes, set handlers in response to incoming SMSes
You must click here to accept the latest terms for this service before you can use it
  Published by messagebird on Jan 17th 2018, 11:35 PM
  # Telephony with Messagebird and StdLib This service gives you the ability to claim, manage, and use Messagebird telephone numbers. You can send SMS messages and set a StdLib function as a handler to respond to incoming messages. ## Getting Started After accepting the terms of service above, you can see a selection of available telephone numbers by calling the `available` function as `lib messagebird.tel.available`. You can also specify a specific country code as `lib messagebird.tel.available --country <US, CA>`. Choose one, then call the `init` function from your command line as: ``` $ lib messagebird.tel.init --number <available phone number> ``` Congratulations! You've just claimed your first phone number. ## Sending SMS Messages After you've claimed a number, you can send SMS messages using the `sms` function. From your command line, run: ``` $ lib messagebird.tel.sms --originator <your claimed number> --recipient <recipient phone number> --body <the message to send> ``` You can also send SMS messages programmatically by calling this method with the `lib` npm package: ```javascript const lib = require('lib')({token: <one of your StdLib library tokens>}); let result = await lib.messagebird.tel.sms({ originator: <your claimed phone number>, recipient: <recipient phone number>, body: <the message to send> }); ``` You can see your StdLib library tokens by heading to your [dashboard](https://dashboard.stdlib.com/dashboard). It's that simple! ## Setting Handlers To set a StdLib function that will run when one of your phone numbers receives an SMS message, use the `handlers.set` function. For example, from your command line you could run something like: ``` $ lib messagebird.tel.handlers.set --number <your claimed number> --identifier <StdLib service> ``` The identifier parameter will look something like this: `<username>.<service>[@<environmentOrVersion>].<functionName>`. If you want to call the latest released version of the service as a handler, `environmentOrVersion` is optional, and if you want to call the default endpoint for the service, `functionName` is optional. Handlers will receive four parameters: ``` * @param {string} sender The phone number that sent the text to be handled * @param {string} receiver The StdLib phone number that received the SMS * @param {string} message The contents of the SMS * @param {string} createdDatetime Datetime when the SMS was sent ``` To clear a previously set handler, run `lib messagebird.tel.handlers.clear --number <your claimed number>`. ## Additional Information There is currently a limit of 500 sent messages per number per day. You can claim additional numbers for 99¢ each by calling the `claim` function which will allow you to send more messages.
# Telephony with Messagebird and StdLib This service gives you the ability to claim, manage, and use Messagebird telephone numbers. You can send SMS messages and set a StdLib function as a handler to respond to incoming messages. ## Getting Started After accepting the terms of service above, you can see a selection of available telephone numbers by calling the `available` function as `lib messagebird.tel.available`. You can also specify a specific country code as `lib messagebird.tel.available --country <US, CA>`. Choose one, then call the `init` function from your command line as: ``` $ lib messagebird.tel.init --number <available phone number> ``` Congratulations! You've just claimed your first phone number. ## Sending SMS Messages After you've claimed a number, you can send SMS messages using the `sms` function. From your command line, run: ``` $ lib messagebird.tel.sms --originator <your claimed number> --recipient <recipient phone number> --body <the message to send> ``` You can also send SMS messages programmatically by calling this method with the `lib` npm package: ```javascript const lib = require('lib')({token: <one of your StdLib library tokens>}); let result = await lib.messagebird.tel.sms({ originator: <your claimed phone number>, recipient: <recipient phone number>, body: <the message to send> }); ``` You can see your StdLib library tokens by heading to your [dashboard](https://dashboard.stdlib.com/dashboard). It's that simple! ## Setting Handlers To set a StdLib function that will run when one of your phone numbers receives an SMS message, use the `handlers.set` function. For example, from your command line you could run something like: ``` $ lib messagebird.tel.handlers.set --number <your claimed number> --identifier <StdLib service> ``` The identifier parameter will look something like this: `<username>.<service>[@<environmentOrVersion>].<functionName>`. If you want to call the latest released version of the service as a handler, `environmentOrVersion` is optional, and if you want to call the default endpoint for the service, `functionName` is optional. Handlers will receive four parameters: ``` * @param {string} sender The phone number that sent the text to be handled * @param {string} receiver The StdLib phone number that received the SMS * @param {string} message The contents of the SMS * @param {string} createdDatetime Datetime when the SMS was sent ``` To clear a previously set handler, run `lib messagebird.tel.handlers.clear --number <your claimed number>`. ## Additional Information There is currently a limit of 500 sent messages per number per day. You can claim additional numbers for 99¢ each by calling the `claim` function which will allow you to send more messages.
Returns a selection of available phone numbers
  info
context
enabled
bg
info
pricing
free
rate limits
  parameters (click to modify)
{string}
country
= null
Optional country code
  code
Claims additional phone numbers for a user
  info
context
enabled
bg
info
pricing
$0.99 per auth request
rate limits
  parameters (click to modify)
{string}
number
(required)
The phone number you would like to claim
  code
Clears a StdLib service to handle SMS responses
  info
context
enabled
bg
info
pricing
free
rate limits
  parameters (click to modify)
{string}
number
(required)
The phone number you would like to clear the handler for
  code
Sets a StdLib service to handle SMS responses
  info
context
enabled
bg
info
pricing
free
rate limits
  parameters (click to modify)
{string}
number
(required)
The phone number you would like to set a handler for
{string}
identifier
(required)
Identifier for the service you want to set as a handler
  code
Initializes telephony with StdLib by claiming a free number
  info
context
enabled
bg
info
pricing
free
rate limits
  parameters (click to modify)
{string}
number
(required)
The phone number you would like to claim
  code
Returns a selection of phone numbers a user has claimed
  info
context
enabled
bg
info
pricing
free
rate limits
  parameters
(no parameters expected)
  code
Sends a text message from a previously claimed number to a recipient number
  info
context
enabled
bg
info
pricing
$0.01 per auth request
rate limits
  parameters (click to modify)
{string}
originator
(required)
The previously claimed telephone number to send a message from
{string}
recipient
(required)
The telephone number to send the message to
{string}
body
(required)
The contents of the text message you would like to send
  code