Supporting Multiple Phone Numbers for a Single Client in CHT

Hello community,

I’m exploring how to support multiple phone numbers for a single client in a CHT deployment.

In my current setup:

  • It’s straightforward to capture two numbers in the form, e.g. primary_phone and secondary_phone.

  • These get stored in the client’s contact document in CouchDB.

The challenge comes when handling SMS messaging:

  • By default, CHT workflows seem to associate only one number (the phone field) with a client.

  • This means if a client texts in from their secondary number, the message won’t link to their contact record.

My questions for the community:

  1. Is there an existing recommended way to configure CHT so that a client can be recognized by either of their registered numbers?

  2. Can TextIt support aliases or multiple numbers per contact?

  3. If not, what patterns or schema changes have other implementers used to solve this?

The goal is to improve accessibility for clients who may switch between SIM cards or have more than one active phone.

Thanks in advance for your guidance!

Cliff
cc @diana @mrjones

3 Likes

Hi @cliff

This has always been possible within the CHT everywhere you have the option to select the `recipientin an SMS workflow. You would just populate the`recipient` field with the secondary phone property you want to use.

For example, I used this config:

"transitions": {
      "accept_patient_reports": true,
      "update_clinics": true,
      "generate_patient_id_on_people": true,
      "death_reporting": true,
    },   
    "patient_reports": [
      {
        "form": "P",
        "messages": [
          {
            "event_type": "report_accepted",
            "recipient": "contact.phone_alternate",
            "message": [
              {
                "locale": "en",
                "content": "Done"
              }
            ]
          }
        ]
      }
    ],
    "forms": {
      "P": {
        "meta": {
          "code": "P",
          "icon": "pregnancy-1",
          "label": {
            "en": "New Pregnancy (SMS)",
            "hi": "नयी गर्भावस्था (SMS)",
            "id": "Kehamilan Baru (SMS)"
          }
        },
        "fields": {
          "patient_id": {
            "labels": {
              "description": {
                "en": "Patient ID"
              },
              "short": {
                "en": "ID"
              },
              "tiny": {
                "en": "ID"
              }
            },
            "position": 0,
            "type": "string",
            "flags": {
              "input_digits_only": true
            },
            "length": [
              5,
              13
            ],
            "required": true
          }
        }
      }
    },

I added a `phone_alternate` field on the contact that submits the report and sent a P form from the admin app.

So you can access any property in the SMS context as the recipient property. More details about what is present in the SMS context can be found in the docs.

1 Like

thanks @diana for the feedback..
1.can this to be implemented with CHT- Text-it workflow?
2. For inbound SMS through text-it, will the CHT automatically match a message from the phone_alternate number to the correct contact,?

  • Would this show in CHT for one person? In other words, if they text from both numbers, could this show in the Messages tab as just one Client?

can this to be implemented with CHT- Text-it workflow?

This applies to every time the CHT generates a message. It doesn’t matter which gateway is used to send it. I encourage you to try it out.

For inbound SMS through text-it, will the CHT automatically match a message from the phone_alternate number to the correct contact,?

No, this won’t be the case, unfortunately. Contacts are only matched by the `phone` field.

1 Like

thanks @diana, looks sticky to implement this currently :slightly_smiling_face: