The messagelog contrib application maintains a database record of all messages sent and received by RapidSMS.
Add "rapidsms.contrib.messagelog" to INSTALLED_APPS in your settings file:
INSTALLED_APPS = [
...
"rapidsms.contrib.messagelog",
...
]
Add messagelog URLs to your urlconf:
urlpatterns = patterns("",
...
(r"^messagelog/", include("rapidsms.contrib.messagelog.urls")),
...
)
Create database tables for the messagelog models:
$ python manage.py syncdb
{% load url from future %}
<li><a href="{% url "message_log" %}">Message Log</a></li>
messagelog defines the Message database model, which stores key information about an IncomingMessage or OutgoingMessage:
connection: The RapidSMS Connection to which the message was sent. contact: The RapidSMS Contact associated with the connection. date: When the message was sent. text: The text of the message. direction: Message.INCOMING or Message.OUTGOING.
Upon parsing an IncomingMessage, messagelog creates a Message object and sets the logger_msg property of the IncomingMessage to be the Message object.
Upon processing an OutgoingMessage, messagelog creates a Message object and sets the logger_msg property of the OutgoingMessage to be the Message object.
You can navigate to the message_log view to browse the full list of stored messages.