Skip to content

Feature Request: Configurable SMS Recipient Fallbacks & Disable "Sender" Default #10459

@binokaryg

Description

@binokaryg

What feature do you want to improve?

SMS recipient resolution: Add alternate recipient(s) and way to disable the default behaviour of sending it back to the sender

Describe the improvement you'd like

I am requesting two specific enhancements to the recipient resolution logic:

  • Priority/Fallback Lists: The ability to define a list of potential recipients. The system should attempt to resolve them in order and use the first valid phone number found.

  • Disable Default Redirection: A configuration option to prevent the system from defaulting to the report sender (submitter) when no recipient is found.

CHT provides several ways to specify the SMS recipient.

Example Use Case: I want to send a reminder related to a patient in a household.

I can either send it to:

  • the patient using patient.phone
  • or, to the household primary contact with patient.parent.contact.phone

I want this instead:

  • If the patient has a phone number -> Send to patient.
  • If patient has no number -> Send to patient.parent.contact (Household Head).
  • If neither has a number -> Do not send the message. (Currently, CHT forces this message to the CHW/sender, which is confusing for them).

Proposed configuration syntax:
Instead of a single string, allow an array for recipient:

"recipient": [
  "patient.phone",
  "patient.parent.contact.phone"
],
"default_to_sender": false

Describe alternatives you've considered

  • Form Calculation: Saving the phone number in the report during submission. Drawback: If the contact's phone number is updated later, the report data remains stale, and the SMS goes to the old number.

  • Mustache Logic: I attempted to use {{#patient.phone}} blocks in the message template to suppress content if the number is missing. Drawback: This still triggers the message sending process, resulting in empty, failed messages cluttering the messages tab.

messages.registration.a.patient = {{#patient.phone}} Hi {{patient_name}}! You have been registered to our system with ID: ({{patient_id}}). {{/patient.phone}}{{^patient.phone}}{{/patient.phone}}

Additional context
Related CHT Forum discussion: Is there a way to disable SMS recipient redirection?

Sub-issues

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

💻 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions