Left Menu Right Menu
June 12, 2018

Send SMS

Created by: Paul Ojennus, Whitworth University

Note: With special thanks to Nick Budak who originally developed the code.


Description
Add a button to the Send To Ribbon that will send an SMS message of the current item.

Note:
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:


Dialogue box:


System Components: PBO, Package Manager

Skillset Requirements: PBO, Javascript

Implementation Steps:
  1. In the PBO make sure you have the “Inherit Central Package” box checked.
  2. Implement the Add Custom Action customization.
  3. 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']);

  4. In your local package, in the custom.js file, add the tag <sms-action /> inside the template from the Add Custom Action customization:

    app.component('prmActionListAfter', {
        template: '<custom-action name="open_pnx"
                               label="View PNX"
                               index=5
                               icon="ic_find_in_page_24px"
                               icon-set="action"
                               link="/primo-explore/fulldisplay?docid={pnx.search.recordid[0]}&vid=WW&showPnx=true" />
    <sms-action />'
    });

  5. 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:

    app.value('smsOptions', {
        smsAction: {
            name: 'send_sms',
            label: 'Send SMS',
            index: 5,
            icon: {
             icon: 'ic_smartphone_24px',
             iconSet: 'hardware',
             type: 'svg'
            },
        },
        smsCarriers: {
            'ATT': 'txt.att.net',
            'T-Mobile': 'tmomail.net',
            'Virgin': 'vmobl.com',
            'Sprint': 'messaging.sprintpcs.com',
            'Nextel': 'messaging.nextel.com',
            'Verizon': 'vtext.com',
            'Cricket': 'mms.mycricket.com',
            'Qwest': 'qwestmp.com',
            'Project Fi': 'msg.fi.google.com'
        },
    });

  6. 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'.
  7. Zip and upload your local package in the PBO
  8. Deploy your view
Related Customizations

Back to Blog
Comments (0)
Reply To Article