[Bps-public-commit] rt-extension-notifysms branch, cleanup-initial-release, repushed
Craig Kaiser
craig at bestpractical.com
Mon Jan 25 15:49:56 EST 2021
The branch cleanup-initial-release was deleted and repushed:
was c2c3e5cd9efa0785f2d2e8fe742a54c26e65a858
now ae7cb3d28b3bd93492cb2550400ebf5016d3c721
2: 518b5f8 = 1: 65f66fd Update Module::Install
4: ea18ff7 ! 2: 4646d1a Update overlay of NotifySMS::SetRecipients
@@ -1,9 +1,10 @@
Author: craig kaiser <craig at bestpractical.com>
- Add overlay of Notify::SetRecipients for sending SMS
+ Update overlay of NotifySMS::SetRecipients
This change allows for the SetRecipients method to take an arguement of
- 'type' which can be 'EmailAddress' ( default ) or 'MobilePhone'.
+ 'type' which can be 'EmailAddress' ( default ) or 'MobilePhone'. It also
+ uses a copy of the RT 5 version of RT::Notify::SetRecipients.
diff --git a/lib/RT/Action/NotifySMS.pm b/lib/RT/Action/NotifySMS.pm
--- a/lib/RT/Action/NotifySMS.pm
@@ -36,6 +37,8 @@
+ return scalar @{ $self->{'SMS'} };
}
++# We overlay the SetRecipients method here in order to get users who may have a
++# Mobile Phone value but no email.
sub SetRecipients {
my $self = shift;
+ my $type = shift || 'EmailAddress';
5: c2c3e5c ! 3: 24518b8 Parse template object in Prepare method if no MIMEObj exist
@@ -13,11 +13,12 @@
);
+ unless ( $self->TemplateObj->MIMEObj ) {
-+ my ( $result, $message ) = $self->TemplateObj->Parse(
++ my ( $ret, $msg ) = $self->TemplateObj->Parse(
+ Argument => $self->Argument,
+ TicketObj => $self->TicketObj,
+ TransactionObj => $self->TransactionObj
+ );
++ RT::Logger->error( "Could not parse SMS template: $msg" ) unless $ret;
+ }
+
return scalar @{ $self->{'SMS'} };
@@ -38,3 +39,4 @@
my $content = $self->TemplateObj->MIMEObj->as_string;
unless ( $content ) {
RT::Logger->debug( 'No message found, not sending SMS' );
+
1: 0cb88f8 ! 4: ae7cb3d Make documentation clearer
@@ -1,14 +1,15 @@
Author: craig kaiser <craig at bestpractical.com>
- Update documentation to be found more easily
+ Make documentation clearer
diff --git a/README b/README
--- a/README
+++ b/README
@@
+ messages.
DESCRIPTION
- Provide additional actions for Scrips, that allow for the sending of
+- Provide additional actions for Scrips, that allow for the sending of
- messages inplace of email. The new action can be loaded in the web UI
- from:
-
@@ -21,32 +22,57 @@
- For the action you can choose to pass the following parameters:
-
- All, Owner, Requestor, AdminCc, Cc
-+ messages inplace of email to users 'Mobile number'.
++ Provide additional actions for Scrips, that allow for the sending of SMS
++ messages alongside of email.
RT VERSION
- Works with RT 4.4.0
-@@
+- Works with RT 4.4.0
++ Works with RT 5.
+
+ INSTALLATION
+ perl Makefile.PL
+@@
+ If you run this twice, you may end up with duplicate data in your
+ database.
+
+- Edit your /opt/rt4/etc/RT_SiteConfig.pm
++ Edit your /opt/rt5/etc/RT_SiteConfig.pm
+ If you are using RT 4.4 or greater, add this line:
+
+ Plugin('RT::Extension::NotifySMS');
+@@
+ action is being used, see the module for specifications.
+
+ Clear your mason cache
+- rm -rf /opt/rt4/var/mason_data/obj
++ rm -rf /opt/rt5/var/mason_data/obj
Restart your webserver
+CONFIGURATION
+ Twilio
-+ The new action can be loaded in the web UI from:
-+
-+ Global -> Actions -> Create
-+
-+ Where the action module is one of the notify option from this extension:
-+
-+ "NotifyTwilio"
-+
-+ For the action you can choose to pass the following parameters:
++ The `make initdb` command creates a new RT::Action called Notify Twilio.
++
++ You can now use this action in your RT::Scrips, just like existing
++ notification scrips use email notification actions.
++
++ By default the Notify Twilio action provides alerts to all of the
++ following roles:
++
++ Owner, Requestor, AdminCc, Cc
++
++ If you'd like a more specific role on a ticket notified, then you can
++ create a new action in the RT web UI:
++
++ Admin->Global->Actions
++
++ Where the "Action Module" is "NotifyTwilio". Then in the "Parameters to
++ Pass" section you can provide one or more of the following options:
+
+ All, Owner, Requestor, AdminCc, Cc
+
-+ Like "On Comment Notify AdminCc" sends email to AdminCcs on comment, the
-+ SMS works the same way. Admins can set up scrips to send texts to the
-+ selected roles on the ticket, members of those roles will recieve a text
-+ if their user record has a Mobile Phone value.
++ It is important to remember that only user records that have a value for
++ the "Mobile Phone" attribute will be able to receive SMS alerts.
+
+ NotifyTwilio
+ Send a message using the Twilio web api, requires the follow config
@@ -67,6 +93,19 @@
Best Practical Solutions, LLC <modules at bestpractical.com>
+diff --git a/etc/initialdata b/etc/initialdata
+--- a/etc/initialdata
++++ b/etc/initialdata
+@@
+ push @ScripActions, (
+ {
+ Name => 'Notify Twilio',
+- Description => 'Send SMS messages using Twilio API',
++ Description => 'Send SMS Messages Using Twilio API To All Roles',
+ ExecModule => 'NotifyTwilio',
+ Argument => 'All',
+ },
+
diff --git a/lib/RT/Action/NotifyTwilio.pm b/lib/RT/Action/NotifyTwilio.pm
--- a/lib/RT/Action/NotifyTwilio.pm
+++ b/lib/RT/Action/NotifyTwilio.pm
@@ -99,9 +138,10 @@
--- a/lib/RT/Extension/NotifySMS.pm
+++ b/lib/RT/Extension/NotifySMS.pm
@@
+
=head1 DESCRIPTION
- Provide additional actions for Scrips, that allow for the sending of messages
+-Provide additional actions for Scrips, that allow for the sending of messages
-inplace of email. The new action can be loaded in the web UI from:
-
- Global -> Actions -> Create
@@ -113,11 +153,33 @@
-For the action you can choose to pass the following parameters:
-
- All, Owner, Requestor, AdminCc, Cc
-+inplace of email to users 'Mobile number'.
++Provide additional actions for Scrips, that allow for the sending of SMS
++messages alongside of email.
=head1 RT VERSION
-@@
+-Works with RT 4.4.0
++Works with RT 5.
+
+ =head1 INSTALLATION
+
+@@
+ If you run this twice, you may end up with duplicate data
+ in your database.
+
+-=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
++=item Edit your F</opt/rt5/etc/RT_SiteConfig.pm>
+
+ If you are using RT 4.4 or greater, add this line:
+
+@@
+
+ =item Clear your mason cache
+
+- rm -rf /opt/rt4/var/mason_data/obj
++ rm -rf /opt/rt5/var/mason_data/obj
+
+ =item Restart your webserver
=back
@@ -125,21 +187,27 @@
+
+=head2 Twilio
+
-+The new action can be loaded in the web UI from:
-+
-+ Global -> Actions -> Create
-+
-+Where the action module is one of the notify option from this extension:
-+
-+ "NotifyTwilio"
-+
-+For the action you can choose to pass the following parameters:
++The `make initdb` command creates a new RT::Action called Notify Twilio.
++
++You can now use this action in your RT::Scrips, just like existing notification
++scrips use email notification actions.
++
++By default the Notify Twilio action provides alerts to all of the following roles:
++
++ Owner, Requestor, AdminCc, Cc
++
++If you'd like a more specific role on a ticket notified, then you can create a new
++action in the RT web UI:
++
++ Admin->Global->Actions
++
++Where the "Action Module" is "NotifyTwilio". Then in the "Parameters to Pass" section
++you can provide one or more of the following options:
+
+ All, Owner, Requestor, AdminCc, Cc
+
-+Like "On Comment Notify AdminCc" sends email to AdminCcs on comment, the SMS works the same way.
-+Admins can set up scrips to send texts to the selected roles on the ticket, members of those roles
-+will recieve a text if their user record has a Mobile Phone value.
++It is important to remember that only user records that have a value
++for the "Mobile Phone" attribute will be able to receive SMS alerts.
+
+=head3 NotifyTwilio
+
@@ -162,4 +230,3 @@
=head1 AUTHOR
Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
-
3: 5a72d60 < -: ------- Update docs from rt4 -> rt5
More information about the Bps-public-commit
mailing list