June 12, 2018
Back to Blog
Created by: Paul Ojennus, Whitworth University
Note: With special thanks to Nick Budak who originally developed the code.
Code repository: https://github.com/alliance-pcsg/primo-explore-send-sms
Add a button to the Send To Ribbon that will send an SMS message of the current item.
This is a lightweight solution that uses the email message native to Primo and repackages it as an SMS message. There are several issues you will want to consider before implementing this customization: First, the email message is verbose and contains more fields than you might want in an SMS message; for example a typical use-case would be to find a physical item on the shelf, where you would want title, author, and call number only; these will be included in the message, but will be among other fields. Second, the email to SMS transformation works differently on different carriers; most carriers break the email into 144-character chunks, then recombine them on the receiving device; Project Fi includes the HTML tags which makes the message hard to read; Verizon text-to-SMS option (@vtext.com) sends only the first 144 characters, and Verizon media-to-SMS option (@vzwpix.com) sends the full message but includes the HTML tags; AT&T will only display the first 5 concatenated messages, which often does not include the call number. We recommend not including the Project Fi and Verizon carriers in your setup.
In the Send To Ribbon:
System Components: PBO, Package Manager
- In the PBO make sure you have the “Inherit Central Package” box checked.
- Implement the Add Custom Action customization.
- In your local package, in the custom.js file, include the modules ‘customActions’ and ‘sendSms’ in your app definition, for example:
var app = angular.module('viewCustom', ['customActions','sendSms']);
If you are using other angular modules your app definition will include those also. For example:
var app = angular.module('viewCustom', ['angularLoad,', 'customActions', 'reportProblem','sendSMS']);
- In your local package, in the custom.js file, add the tag <sms-action /> inside the template from the Add Custom Action customization:
template: '<custom-action name="open_pnx"
- If you want to customize your button (text label, image, position in the ribbon, carriers available in the carriers drop-down menu), add the following block of code and edit the values for your preferences:
label: 'Send SMS',
'Project Fi': 'msg.fi.google.com'
- You can customize the fields:
name: this is internal to the code, it just needs to be unique
label: this is the text that will appear in the Send To ribbon
index: the placement/order of the new action in the Sent To action list. Supported values are any integer, 0 is on the far left
icon: the name of the icon from https://material.io/icons/
icon-set: the name of the icon set
type: can be ‘svg’ or ‘png’
smsCarriers: this array determines the carriers included in the carrier drop-down menu and the email domain that will be used for that carrier; for example if you wanted to use the Verizon media-to-SMS option you would edit the Verizon line to 'Verizon': 'vzwpix.com'.
- Zip and upload your local package in the PBO
- Deploy your view