The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SMS::Send::NANP::Twilio - SMS::Send driver for Twilio

SYNOPSIS

  Configure /etc/SMS-Send.ini

  [NANP::Twilio]
  username=onestring
  password=anotherstring
  from=+12025551212
  ;sid=Copilot_MessagingServiceSid_instead_of_from

  use SMS::Send;
  my $sms     = SMS::Send->new('NANP::Twilio');
  my $success = $sms->send_sms(text=> 'Hello World!', to =>'+17035551212');

  use SMS::Send::NANP::Twilio;
  my $sms     = SMS::Send::NANP::Twilio->new;
  my $success = $sms->send_sms(text=> 'Hello World!', to =>'+17035551212');
  my $json    = $sms->{__content};
  my $href    = $sms->{__data};

DESCRIPTION

SMS::Send driver for Twilio

send_sms

Sends SMS Message via Twilio web service and returns 1 or 0 will die on critical error.

  my $status = $sms->send_sms(text=> 'Hello World!', to =>'+17035551212');
to

Passed as "To" in the posted form data. The destination phone number for SMS/MMS or a Channel user address for other 3rd party channels. Destination phone numbers should be formatted with a '+' and country code e.g., +16175551212 (E.164 format).

text

Passed as "Body" in the posted form data. The text of the message you want to send, limited to 1600 characters.

Properties

Properties may be stored in /etc/SMS-Send.ini.

username

The "Account SID" is passed on the URL and sent as the username for basic authentication credentials

password

The "Auth Token" sent as password for basic authentication credentials

from

The "From" parameter passed in the posted form

A Twilio phone number (in E.164 format), alphanumeric sender ID or a Channel Endpoint address enabled for the type of message you wish to send. Phone numbers or short codes purchased from Twilio work here. You cannot (for example) spoof messages from your own cell phone number.

sid

The "MessagingServiceSid" parameter passed in the posted form

The 34 character unique id of the Messaging Service you want to associate with this Message. Set this parameter to use the Messaging Service Settings and Copilot Features you have configured. When only this parameter is set, Twilio will use your enabled Copilot Features to select the From phone number for delivery.

url

Returns a URI object for the Messages.json resource at api.twilio.com

SEE ALSO

SMS::Send::Driver::WebService, SMS::Send, https://www.twilio.com/docs/api/messaging/send-messages

AUTHOR

Michael Davis

COPYRIGHT AND LICENSE

Copyright (C) 2018 by Michael Davis

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.