aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/general.yml-example1
-rw-r--r--perllib/FixMyStreet/SMS.pm8
2 files changed, 8 insertions, 1 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example
index 528fc1012..72b5fbaa3 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -211,6 +211,7 @@ PHONE_COUNTRY: ''
TWILIO_ACCOUNT_SID: ''
TWILIO_AUTH_TOKEN: ''
TWILIO_FROM_PARAMETER: ''
+TWILIO_MESSAGING_SERVICE_SID: ''
# If you want to hide all pages from non-logged-in users, set this to 1.
LOGIN_REQUIRED: 0
diff --git a/perllib/FixMyStreet/SMS.pm b/perllib/FixMyStreet/SMS.pm
index dff27e018..874108706 100644
--- a/perllib/FixMyStreet/SMS.pm
+++ b/perllib/FixMyStreet/SMS.pm
@@ -28,6 +28,11 @@ has from => (
default => sub { FixMyStreet->config('TWILIO_FROM_PARAMETER') },
);
+has messaging_service => (
+ is => 'lazy',
+ default => sub { FixMyStreet->config('TWILIO_MESSAGING_SERVICE_SID') },
+);
+
sub send_token {
my ($class, $token_data, $token_scope, $to) = @_;
@@ -51,7 +56,8 @@ sub send_token {
sub send {
my ($self, %params) = @_;
my $output = $self->twilio->POST('Messages.json',
- From => $self->from,
+ $self->from ? (From => $self->from) : (),
+ $self->messaging_service ? (MessagingServiceSid => $self->messaging_service) : (),
To => $params{to},
Body => $params{body},
);