# SMS Gateway and Flows setup in OpenMRS(Technical Document)

## Setting a duration in the SMS flow

Duration is used for starting the sms workflow on the specific/expected date.This is calculated from the schedule date.For e.g: Let sms schedule for xyz athlete on 01-01-2021.Then system will send sms as follows:

* If duration is 0 then application will send the sms on same day.
* If duration is 1 then application calculate current date + next date and then send the sms.

In Our case, first flow start on the schedule date, second flow start on interval of 7 days and third flow start on after 14 days interval of the second flow.

duration  stored in  **specialolympics\_sms\_flow** table.Query for updating the duration during **SMS Gateway Configuration** .



```
$ start transaction;
$update specialolympics_sms_flow set duration=7 where sms_flow_id=2;
$update specialolympics_sms_flow set duration=14 where sms_flow_id=3;
$commit;
```



{% hint style="info" %}
By default all the sms will send on the same day.
{% endhint %}

### Table Details

Following table has been used in sms worklflow:

* specialolympics\_followup\_tracker
* &#x20;specialolympics\_scheduled\_followup&#x20;
* specialolympics\_sms\_flow&#x20;
* specialolympics\_sms\_metadata&#x20;
* specialolympics\_survey

