CHT auto reply to messages from Textit

Hello folks …

As any one configured CHT to generate auto reply to a particular message coming from textit ie when a particular message is posted to CHT via rapidpro webhook, CHT generates an auto feedback sms.

cc @jkuester @mrjones @diana

Hi @cliff

I can think of some possible solutions:

From the top of my head, if the SMS is a form, the simplest would be conditional_alerts. Unfortunately the documentation is lacking for this transition, but I can give you a quick rundown of the config and we have an integration test that you can follow to see some example configs.

transitions: { conditional_alerts: true },
alerts: [{
   form: '<your form code>',
   condition: 'doc.somefield > 100',
   message: 'This is an alert',
   recipient: 'reporting_unit'
}],

Integration test to see more configs: cht-core/tests/integration/sentinel/transitions/conditional-alerts.spec.js at 062da0370cd806c2a98da64bedb2961afe99a2fc · medic/cht-core · GitHub

If your message is not a form, the only auto-response transition that I can think of is default_responses, however this lacks the conditional aspect and will send a message for any received unstructured message.

transitions: { default_responses: true },
default_responses: {
  start_date: '2018-01-01'
},
forms_only_mode: false

Integration test to see more configs: cht-core/tests/integration/sentinel/transitions/default-responses.spec.js at 062da0370cd806c2a98da64bedb2961afe99a2fc · medic/cht-core · GitHub

If you could share more about your specific use-case, we might be able to suggest a more tailored approach.

thanks @diana
i think this approach can work, though would require to get to know how messages from text-it are stored in CHT and where ?.
Are the messages from textit stored as documents in the DB?

the use case is i run a flow in rapidpro that posts a particular message to CHT , upon being received in CHT it automatically triggers an sms feedback response message from CHT back to textit. This feedback response sms should only be triggered on this particular message only , not from each an any other message coming from textit

Yes, all messages will be stored as data_records in the database. Depending on the format, you would see them on the reports or messages tab.

thanks @diana
Ultimately we are looking for a way to be able to monitor and alert eg via email that the two way texting is work correctly between CHT and rapadipro . without being able to access or login into any of the systems(these are client requirements) .
Do you know of the best way approach to this ?
Can the CHT watchdog fit in here ?

Hi @cliff

The monitoring endpoint, which the CHT watchdog queries, does expose data pertaining to SMS health through some metrics:

  • sentinel.backlog - which would show you if Sentinel is correctly processing incoming SMS
  • messaging.outgoing.* - these are an umbrella of metrics that show status outgoing messages

Some of these metrics are available in watchdog and you can follow them in Prometheus and can set up alerts for.

1 Like

Thanks @diana !

@cliff - I’ve included a screenshot below from CHT Watchdog which shows the panels in Grafana for both sentinel.backlog and messaging.outgoing.*. There are built in alerts for this as well. If you have any questions about setting up Watchdog, please start another thread in Tech Support - we’re happy to help!

1 Like

hello @diana @mrjones thanks so much for this , am sure my colleagues will like this once its shared with them next . We are going to look into this :slightly_smiling_face: