Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

Sending SMS notifications

The noi2 demo project shows Lino as a Content Management System.

>>> from lino_book.projects.noi2.startup import *
>>> mp = settings.SITE.plugins.memo.parser
>>> dd.plugins.notify.use_sms
True
>>> settings.SMS_BACKEND
'sms.backends.console.SmsBackend'

The console backend does not actually send any messages, it just writes to the console what a real-world backend would do.

>>> print(dd.plugins.notify.my_sms_number)
+3724824548
>>> robin = rt.login("robin").get_user()
>>> robin.phone = "+37256672435"
>>> print(robin.phone)
+37256672435
>>> from lino.modlib.notify.api import send_notification
>>> now = datetime.datetime(2026,6,25,10,39)
>>> send_notification(robin, primary_key=1, subject="Test message",
...     body="The body gets ignored in SMS messages.", created=now)
from: +3724824548
to: +37256672435
Test message
-------------------------------------------------------------------------------

Some values for SMS_BACKEND:

  • SMS_BACKEND = ‘sms.backends.console.SmsBackend’

  • SMS_BACKEND = ‘sms.backends.locmem.SmsBackend’

Two real-world backends are available out of the box: Twilio and MessageBird-

External links: