wiki:UserGuidelines/Messaging

Version 23 (modified by mmatthews, 14 years ago) ( diff )

--

Messaging Module

This is the userguide for the current version of the Messaging module

NB The Cron task(s) needs to be enabled in cron/crontab. This doesn't currently work for Win32 service. For mod_wsgi, need to add support to the system crontab.

Email

How do I use Gmail to send outbound mail?

Edit models/000_config.py Uncomment these lines & put in the username/password that you wish to use:

#deployment_settings.mail.server = "smtp.gmail.com:587"
#deployment_settings.mail.login = "username:password"

SMS

What Hardware do I need?

If using an online gateway, then you don't need any hardware other than the network card :)

If you wish to be able to send messages without an Internet connection then you need a comaptible device such as one from the following.

Hardware compatibility databases:

How do I use it?

1st you need to decide whether you will be using a local modem or an online gateway (e.g. Clickatell or Tropo).

This is configured by the Administrator in the Global message Settings:

The Gateway or Modem details are configured via their own panels.

Clickatell

Global provider - average price globally:

  • http://clickatell.com
    https://api.clickatell.com/http/sendmsg
    user=myusername&password=mypassword&api_id=myapi_id
    text
    to
    

Mvaayoo

Indian provider - cheap for local calls

http://api.mvaayoo.com/mvaayooapi/MessageCompose
user=my@email.address:mypassword&senderID=TEST SMS&state=4
msgtxt
receipientno

Tropo

Provide an automated-attendant (IVR) service which supports Voice, Jabber (XMPP, e.g. GTalk) & Twitter as well as SMS.

  • http://tropo.im
  • The Twitter/GTalk 'bots' are great for testing the system out without incurring call charges (suggest using the Jabber configuration in Tropo application rather than GTalk, although you can use GTalk as the client)

US Inbound number is free for development use so this is great for demos.

  • no other local numbers available for SMS (UK numbers may be available upon special request)

They have helpful support forums.

Configure your Tropo token by copying the "Outbound Token" labeled "Messaging" into the text field at the following link (this allows outbound messaging from your app):

Inbound messages are collected in controllers/msg.py by the tropo() function, so configure this URL into your Application on the Tropo site:L

Don't forget to add select "Add a new phone number," in order to reserve a phone number for incoming voice and messaging (in this case, messaging). This new number is the number that should be entered in, e.g. ODK Collect (in versions with SMS support).

For regular, non-multi-part messages, the incoming message is parsed by the parserdooth() function which uses difflib to allow users to mis-spell the keywords. In the case of multi-part messages, the tropo() function calls "concatSMS(lastMessage, fromaddress)" method to see if this is the last message in a sequence. At present, the "sequence" is highly proprietary, and integrated into the "modified jaxdroid" branch of ODK Collect mentioned here. The sequence information is combined with a 5-digit unique identifier for that particular form submission. That sequence information and unique identifier are prepended to the each part of the multi-part SMS transmission by the modified ODK Collect branch's SMS form submission code. It will look something like this:

  • (1/3)(12345)<?xml version='1.0' ?><pr_person>...
  • (2/3)(12345)last_name>...
  • (3/3)(12345)-08</date_of_birth></pr_person>

The unique identifier -- here, 12345 -- is actually significantly more random than that. The reason the tropo() controller method calls concatSMS() with each new part of a multi-part message is that the messages may arrive out of order. However, when the concatSMS() method detects that all message parts of that XForms submission have been received, it will stitch those messages together (while removing the prepend, obvious), and submit them to parserdooth() as before.

How does it work?

Compose a new message. The autocomplete will find either Persons or Groups.

Contact numbers from Persons have non-numeric characters stripped & then a '+' is prefixed when using a local modem.

For gateway usage, a default Country Code is added to numbers which start with 0.

More


UserGuidelines

Note: See TracWiki for help on using the wiki.