Auto SMS sender from RapidSMS

Hi Nahid,

Yes, you’ll want to use the scheduler app in RapidSMS. I’m copying an
old email from Rowena which has some information about this. The UI
for creating schedules is not so good, so you’ll have to do most of
your event creation in a python shell I think.

Feel free to reach out if you get stuck,

Cory

Dear Michael,

If you want to hard-code one-shot tasks for a specific amount of time
in the future (i.e. ‘send me a reminder 3 days from right now’),
Schuyler has a utility for this built right into rapidSMS core:
http://gist.github.com/137537. However, we did put together a
scheduler app which is particularly optimized for your use case:
managing tasks scheduled over a particular date/time interval through
a web interface using RapidSMS.

You can find the latest version of the scheduling app here:
http://github.com/dimagi/rapidsms/tree/master/apps/scheduler/. (dimagi
repository, rapidsms fork, weltel branch, ‘scheduler’ app).

In order to use the scheduler, simply write a static callback function
and then save an instance of the EventSchedule model with the
’callback’ field set to the fully-qualified name of that function. Its
fields have been inspired by the API for cron tasks. For example, to
call a function at 8:00 am and 3:00 pm every Tuesday, you would set

  • minutes = set([0]) # at the 0th minute
  • hours = set([8, 15]) # 24-hour clock
  • days_of_week = set([1]) # 0 is Monday, 1 is Tuesday
    You can also save arguments as a list in callback_args, and keyword
    arguments as a dictionary in callback_kwargs. You can also specify
    time_start and time_end intervals, as well as a maximum number of
    times you want the callback to fire (use the ‘count’ field). There’s a
    utility function to set a weekly event or set a daily event at the
    bottom of models.py.

You can see examples of how the API is used by looking at
tests/faketime.py within the scheduler app.

Hope that’s helpful!

Cheers,

Rowena

··· On Fri, Jul 16, 2010 at 2:23 PM, Nahid Hossain wrote: > Hello, > > I would like to know, whether schedule based auto SMS is available in > RapidSMS or not. Schedule will be collected from database. If yes, could you > please guide me, where can I look in to this and how can we implement? > > > > Thanks > > Nahid > >

Thanks Cory,
Let me look at it and I will let you know if I get stuck.

Nahid

··· -----Original Message----- From: commcare-developers@googlegroups.com [mailto:commcare-developers@googlegroups.com] On Behalf Of Cory Zue Sent: Saturday, July 17, 2010 12:28 AM To: commcare-developers Subject: Re: Auto SMS sender from RapidSMS

Hi Nahid,

Yes, you’ll want to use the scheduler app in RapidSMS. I’m copying an
old email from Rowena which has some information about this. The UI
for creating schedules is not so good, so you’ll have to do most of
your event creation in a python shell I think.

Feel free to reach out if you get stuck,

Cory

Dear Michael,

If you want to hard-code one-shot tasks for a specific amount of time
in the future (i.e. ‘send me a reminder 3 days from right now’),
Schuyler has a utility for this built right into rapidSMS core:
http://gist.github.com/137537. However, we did put together a
scheduler app which is particularly optimized for your use case:
managing tasks scheduled over a particular date/time interval through
a web interface using RapidSMS.

You can find the latest version of the scheduling app here:
http://github.com/dimagi/rapidsms/tree/master/apps/scheduler/. (dimagi
repository, rapidsms fork, weltel branch, ‘scheduler’ app).

In order to use the scheduler, simply write a static callback function
and then save an instance of the EventSchedule model with the
’callback’ field set to the fully-qualified name of that function. Its
fields have been inspired by the API for cron tasks. For example, to
call a function at 8:00 am and 3:00 pm every Tuesday, you would set

  • minutes = set([0]) # at the 0th minute
  • hours = set([8, 15]) # 24-hour clock
  • days_of_week = set([1]) # 0 is Monday, 1 is Tuesday
    You can also save arguments as a list in callback_args, and keyword
    arguments as a dictionary in callback_kwargs. You can also specify
    time_start and time_end intervals, as well as a maximum number of
    times you want the callback to fire (use the ‘count’ field). There’s a
    utility function to set a weekly event or set a daily event at the
    bottom of models.py.

You can see examples of how the API is used by looking at
tests/faketime.py within the scheduler app.

Hope that’s helpful!

Cheers,

Rowena

On Fri, Jul 16, 2010 at 2:23 PM, Nahid Hossain nahid.hossain@brotecs.com wrote:

Hello,

I would like to know, whether schedule based auto SMS is available in
RapidSMS or not. Schedule will be collected from database. If yes, could
you
please guide me, where can I look in to this and how can we implement?

Thanks

Nahid