rapidsms.contrib.messaging¶
The messaging contrib application allows you to send messages to one or more recipients through a web interface.
Installation¶
- The messaging contrib application depends on django-selectable to create a recipient multi-selector with autocomplete on the front-end view. You can install django-selectable using pip:
pip install django-selectable
Add
"rapidsms.contrib.messaging"
and"selectable"
(if not already present) toINSTALLED_APPS
in your settings file:INSTALLED_APPS = [ ... "rapidsms.contrib.messaging", "selectable", ... ]
Add URLs for messaging and selectable to your urlconf:
urlpatterns = ("", ... (r"^messaging/", include("rapidsms.contrib.messaging.urls")), (r"^selectable/", include("selectable.urls")), ... )
Usage¶
The messaging front-end view displays a form through which you can write a text message and select its recipients. The recipient selector uses autocomplete to search through all RapidSMS connections. You may select any number of recipients to receive the message.
When sending a message, the messaging application calls rapidsms.router.send()
with the message text and recipient.default_connection for each recipient.
If an error occurs, the message will not be sent to further recipients but it
may have already been sent to earlier recipients. The order in which messages
will be sent is not guaranteed.