← Back to team overview

dhis2-users team mailing list archive

Re: DHIS2 SMS WebAPI

 

Hi Stephen,
Yeah, I think that is actually not supported from the API (but could be
wrong).

If you look at the table "usersetting" there are only two values,
corresponding to TRUE and FALSE for the setting
"keyMessageSMSNotification", which has been binary encoded. I am not sure
which one corresponds to which, but you could experiment a bit and see if
it works. Likely, you would need at least to clear the server cache and
possibly restart the server after this action.

SELECT DISTINCT value FROM usersetting where name =
'keyMessageSmsNotification';
                                              value

--------------------------------------------------------------------------------------------------
 \xaced0005737200116a6176612e6c616e672e426f6f6c65616ecd207280d59cfaee0200015a000576616c7565787000
 \xaced0005737200116a6176612e6c616e672e426f6f6c65616ecd207280d59cfaee0200015a000576616c7565787001

So, I guess, as a hack, you could write an SQL script to populate this
table with all of the users which should receive SMS notifications,
effectively overriding their settings, which does not seem to be able to be
set through the API (developers can correct me if I am wrong here, but it
seems not to to be the case at the moment).

Its a hack, but it might work.

Regards,
Jason






On Thu, Aug 20, 2015 at 9:36 AM, Ocaya Stephen <stephocay@xxxxxxxxx> wrote:

> Thank You Jason,
>
> We already have a settings in DHIS2 that can send/receive messages, but
> like I said, we need to be sending automated SMS reminders to a selected
> users who have not yet sent their report to do so.
>
> I have tried the messageConversations Option and it seems to work fine.
> The main challenge that I realized is that we shall need to enable over
> 4000+ users account with SMS notifications. problem is it is not possible
> to do that at once may be through a systems settings and the like.
>
> I tried seeing the userSettings resource (from DHIS2 Developer Docs
> <https://www.dhis2.org/doc/snapshot/en/user/html/ch25s29.html> ) to
> update user accounts but that seems not to be working/accessible at least
> for my instance. Any advise to changing the user settings to enable SMS
> Notifications.
>
> Thanks again.
>
> Stephen
>
>
> On Thu, Aug 20, 2015 at 10:22 AM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> Hi Stephen,
>> You can just use the normal messaging system of DHIS2. If you send a
>> message to a user who has checked "Enable message SMS notifications" (or
>> it has been set another way through the API for instance), then when a
>> message is sent to the user through DHIS2, it will be forwarded to the
>> users number using the SMS service which has to be configured in
>> http://yourserver/dhis-web-maintenance-mobile/showSMSConfigureForm.action.
>> There are numerous options to choose from depending on your service
>> provider.
>>
>> Alternatively, you could implement an external service, which draws data
>> from DHIS2 and then sends SMS alerts using the API of the SMS service
>> provider.
>>
>>
>> Regards,
>> Jason
>>
>>
>> On Wed, Aug 19, 2015 at 4:29 PM, Ocaya Stephen <stephocay@xxxxxxxxx>
>> wrote:
>>
>>> Dear all,
>>>
>>> Anyone can help me with any documentation for sending SMS (text
>>> Messages) via DHIS2 WebAPI.
>>>
>>> I would like to implement an automated SMS reminder via an API.
>>>
>>> Thanks
>>>
>>> Stephen Ocaya
>>>
>>> --
>>>
>>> *You can do anything, but not everything.*
>>>
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Jason P. Pickering
>> email: jason.p.pickering@xxxxxxxxx
>> tel:+46764147049
>>
>
>
>
> --
>
> *You can do anything, but not everything.*
>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+46764147049

References