Koha Tutorial Videos

Monday Minutes: Suppressing SMS Transport of Specific Notices in Koha

In this week's Monday Minutes, Kelly and Jessie chat with Emily Lamancusa, IT Specialist at Montgomery County Public Libraries on how they suppress SMS Transport for specific notices in Koha.

Emily wrote the article below on how to customize these notices using the template toolkit!

By Emily Lamancusa (Montgomery County Public Libraries)

Koha offers a great deal of customizability of notices, both through settings configuration and through the powerful tool of Template Toolkit to enable libraries to design dynamic, flexible notice templates for different situations. However, one area in which notice customizability is more limited is the lack of granular control over which essential notices can be sent by SMS. SMS can be disabled entirely, and the SMS templates for nonessential notices can simply be deleted, but Koha does not currently offer a way to enable SMS messaging for some essential notices but not others.

This is where Template Toolkit can come to the rescue! With Template Toolkit, we can edit specific notice templates as a workaround to suppress SMS messaging on those notices, even if the notice template can’t be deleted. To do this, simply edit the SMS notice template for the notice you want to suppress, and enclose all of the notice text between the following pair of Template Toolkit tags:

[% IF 0 %]

[% END %]

For example, the SMS Check-in message:

The following items have been checked in:

----

[% biblio.title %]

----

Thank you.

Would become this:

[% IF 0 %]

The following items have been checked in:

----

[% biblio.title %]

----

Thank you.

[% END %]

(Note: If adding these tags causes the notice to exceed the 160 character limit, you may need to delete some text from the notice body. Make sure you save a copy of the original notice in case you ever want to enable that notice again in the future!)

This would work for suppressing email delivery of a certain notice, too, if you add these tags to the Email notice template instead of the SMS notice template.

Why does this work? It’s all because of the way the IF tag behaves. Normally, the IF tag would tell Koha to include certain information in the notice, but only if a certain condition is true. For example, you could use [% IF borrower.categorycode == STAFF %] to add extra information to a notice, but only if it is being sent to a staff account. In Template Toolkit, 0 is the same as “false”, so [% IF 0 %] will never be true, and the enclosed text will never be included. This leaves a blank notice, so Koha won’t attempt to send it at all.

The downside with this method is that library patrons won’t necessarily know that a certain notice type is disabled. If the library allows patrons to customize their own notification settings, Koha won’t prevent or warn patrons if they sign up for a notice that has been suppressed in this way, so it will be up to the library to communicate to patrons that this type of notice will not be sent. In the long term, it would be even better if Koha could add configuration features to control the enabled messaging types for different notices at the library or system level. But in the meantime, this workaround can give libraries one more option for customizing their notices in a way they couldn’t do otherwise!

Additional Resources

Customizing Notices & Slips with Template Toolkit

Read more by Jessie Zairo

Tags Monday Minutes, sms, notices