Outbound push config

Hello @jkuester @diana

I am configuring an outbound push to be sent to textit to start a flow whenever a patient is registered in CHT,i marked "mark_for_outbound": true in the transitions of the app_settings.json file, here is the configuration .

"outbound": {
    "patient triggers enroll workflow in Textit": {
      "relevant_to": "doc.type === 'person' && doc.aka",
      "destination": {
        "base_url": "https://rapidpro.app.medicmobile.org",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'e16b6f2f-168b-4690-a52d-a27f54f88fc6'"
        },
        "urns": {
          "expr": "['tel:' + doc.phone]"
        }
      }
    }
  },

T

How do i access the outbound logs to confirm that the feature works a fine because i dont see the patient going through the flow in textit upon being registered

Hi @cliff

Both API and Sentinel logs should contain information about outbound pushes.
Can you please try to create a matching doc and check API logs? If a push fails, Sentinel will attempt to send it again after 5 minutes, so you should be able to see information about initially failed outbound pushes in Sentinel logs.

thanks @diana , though not sure how this is done

Hi @cliff

How did you deploy the CHT?

thanks @diana ,i am testing against a remote server

Do you have access to the remote server’s logs?

i don’t have access to the remote server logs

Can you then please try your config on a server that you do have access to fully and check if outbound works as expected?

1 Like

sure ,thanks @diana

hello @diana ,
I have setting up a local dev environment for core using docker but the docker compose file genarated from
curl -o docker-compose.yml https://raw.githubusercontent.com/medic/cht-core/master/docker-compose.yml returns 404: Not Found


Could i be missing something here?

Hi @cliff

We’re in the process of changing the architecture around how CHT 4.0 is deployed, and that file was removed from the main branch. Can you please use the old docker compose file from a previous release, like: cht-core/docker-compose.yml at 3.17.x · medic/cht-core · GitHub

1 Like

thanks @diana , let me use that

hello @diana i got access to the sentinel logs

2022-08-02 08:53:42] Node Environment Options: '--max_old_space_size=8192'
[2022-08-02 08:53:42] Node Version: 8.11.4 in production mode
[2022-08-02 08:53:42] COUCH_URL http://medic-sentinel:3bf9a36b8f936f63@haproxy:5984/medic
[2022-08-02 08:53:42] COUCH_NODE_NAME couchdb@127.0.0.1
[2022-08-02 08:53:42] CouchDB Version: 2.3.1
[2022-08-02 08:53:42] 2022-08-02 08:53:42 ESC[32mINFOESC[39m: Waiting for API to be ready... 
[2022-08-02 08:53:52] 2022-08-02 08:53:52 ESC[32mINFOESC[39m: Api is ready: {"ready":true,"handler":"medic-api","version":"0.1.0","detail":"All required services are running normally"} 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_clinics" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "self_report" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "registration" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "accept_patient_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "accept_case_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "generate_shortcode_on_contacts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: Loading transition "generate_patient_id_on_people" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: "generate_patient_id_on_people" transition is deprecated. Please use "generate_shortcode_on_contacts" transition instead. 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "default_responses" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_sent_by" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_sent_forms" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: Loading transition "death_reporting" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "conditional_alerts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "multi_report_alerts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_notifications" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_scheduled_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "resolve_pending" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "muting" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "mark_for_outbound" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: transitions: processing enabled 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: startup complete. 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: checking schedule again in 4 minutes 
[2022-08-02 08:53:54] 2022-08-02 08:53:54 ESC[32mINFOESC[39m: saving tombstone for horti-upgrade 
[2022-08-02 08:58:00] 2022-08-02 08:58:00 ESC[32mINFOESC[39m: checking schedule again in 5 minutes 
[2022-08-02 09:03:00] 2022-08-02 09:03:00 ESC[32mINFOESC[39m: checking schedule again in 5 minutes 

Session terminated, terminating shell... ...terminated.
[2022-08-02 09:03:56] 2022-08-02 09:03:56 ESC[32mINFOESC[39m: Running server checks<E2><80><A6> 
[2022-08-02 09:03:56] Node Environment Options: '--max_old_space_size=8192'
[2022-08-02 09:03:56] Node Version: 8.11.4 in production mode
[2022-08-02 09:03:56] COUCH_URL http://haproxy:5984/medic
[2022-08-02 09:03:56] COUCH_NODE_NAME couchdb@127.0.0.1
[2022-08-02 09:03:56] Environment variable "COUCH_NODE_NAME" matches server "couchdb@127.0.0.1"
[2022-08-02 09:03:56] CouchDB Version: 2.3.1
[2022-08-02 09:03:56] 2022-08-02 09:03:56 ESC[32mINFOESC[39m: Waiting for API to be ready... 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Api is ready: {"ready":true,"handler":"medic-api","version":"0.1.0","detail":"All required services are running normally"} 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_clinics" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "self_report" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "registration" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "accept_patient_reports" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "accept_case_reports" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "generate_shortcode_on_contacts" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Loading transition "generate_patient_id_on_people" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: generate_patient_id_on_people transition is deprecated since 3.8.x. Please use "generate_shortcode_on_contacts" transition instead. 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "default_responses" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_sent_by" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_sent_forms" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Loading transition "death_reporting" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "conditional_alerts" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "multi_report_alerts" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_notifications" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_scheduled_reports" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "resolve_pending" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "muting" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "mark_for_outbound" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task dueTasks started 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task reminders started 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task replications started 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task outbound started 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task purging started 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Task backgroundCleanup started 
:

However when i keep on pressing enter to scroll down the logs i came across

[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task outbound started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task purging started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task backgroundCleanup started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task reminders completed 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task replications completed 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task outbound completed

Hi @cliff

From the Sentinel logs it looks it it had no outbound tasks to execute.
Can you create a document that should be pushed via outbound?

hello @diana
According to the configuration below

"outbound": {
    "patient triggers enroll workflow in Textit": {
      "relevant_to": "doc.type === 'person' && doc.docket",
      "destination": {
        "base_url": "https://rapidpro.app.medicmobile.org",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'e16b6f2f-168b-4690-a52d-a27f54f88fc6'"
        },
        "urns": {
          "expr": "['tel:' + doc.phone]"
        }
      }
    }
  },

Whenever a patient registration form is filled out with doc.docket field and type === person it should trigger a textit enrollment flow . I have created a document and do check to confirm that its in the db but the sentinel logs don’t show whether the outbound has properly been executed on not as seen below

[2022-08-02 08:53:42] Node Environment Options: '--max_old_space_size=8192'
[2022-08-02 08:53:42] Node Version: 8.11.4 in production mode
[2022-08-02 08:53:42] COUCH_URL http://medic-sentinel:3bf9a36b8f936f63@haproxy:5984/medic
[2022-08-02 08:53:42] COUCH_NODE_NAME couchdb@127.0.0.1
[2022-08-02 08:53:42] CouchDB Version: 2.3.1
[2022-08-02 08:53:42] 2022-08-02 08:53:42 ESC[32mINFOESC[39m: Waiting for API to be ready... 
[2022-08-02 08:53:52] 2022-08-02 08:53:52 ESC[32mINFOESC[39m: Api is ready: {"ready":true,"handler":"medic-api","version":"0.1.0","detail":"All required services are running normally"} 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_clinics" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "self_report" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "registration" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "accept_patient_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "accept_case_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "generate_shortcode_on_contacts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: Loading transition "generate_patient_id_on_people" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: "generate_patient_id_on_people" transition is deprecated. Please use "generate_shortcode_on_contacts" transition instead. 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "default_responses" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_sent_by" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_sent_forms" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: Loading transition "death_reporting" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "conditional_alerts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "multi_report_alerts" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_notifications" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "update_scheduled_reports" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "resolve_pending" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "muting" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[33mWARNESC[39m: Disabled transition "mark_for_outbound" 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: transitions: processing enabled 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: startup complete. 
[2022-08-02 08:53:53] 2022-08-02 08:53:53 ESC[32mINFOESC[39m: checking schedule again in 4 minutes 
[2022-08-02 08:53:54] 2022-08-02 08:53:54 ESC[32mINFOESC[39m: saving tombstone for horti-upgrade 
[2022-08-02 08:58:00] 2022-08-02 08:58:00 ESC[32mINFOESC[39m: checking schedule again in 5 minutes 
[2022-08-02 09:03:00] 2022-08-02 09:03:00 ESC[32mINFOESC[39m: checking schedule again in 5 minutes 

Session terminated, terminating shell... ...terminated.
[2022-08-02 09:03:56] 2022-08-02 09:03:56 ESC[32mINFOESC[39m: Running server checks<E2><80><A6> 
[2022-08-02 09:03:56] Node Environment Options: '--max_old_space_size=8192'
[2022-08-02 09:03:56] Node Version: 8.11.4 in production mode
[2022-08-02 09:03:56] COUCH_URL http://haproxy:5984/medic
[2022-08-02 09:03:56] COUCH_NODE_NAME couchdb@127.0.0.1
[2022-08-02 09:03:56] Environment variable "COUCH_NODE_NAME" matches server "couchdb@127.0.0.1"
[2022-08-02 09:03:56] CouchDB Version: 2.3.1
[2022-08-02 09:03:56] 2022-08-02 09:03:56 ESC[32mINFOESC[39m: Waiting for API to be ready... 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Api is ready: {"ready":true,"handler":"medic-api","version":"0.1.0","detail":"All required services are running normally"} 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_clinics" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "self_report" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "registration" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "accept_patient_reports" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "accept_case_reports" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "generate_shortcode_on_contacts" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[32mINFOESC[39m: Loading transition "generate_patient_id_on_people" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: generate_patient_id_on_people transition is deprecated since 3.8.x. Please use "generate_shortcode_on_contacts" transition instead. 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "default_responses" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_sent_by" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "update_sent_forms" 
/srv/storage/medic-sentinel/logs/medic-sentinel.log

when you press enter down the logs you only get

[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task outbound started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task purging started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task backgroundCleanup started 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task reminders completed 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task replications completed 
[2022-08-02 09:09:06] 2022-08-02 09:09:06 ESC[32mINFOESC[39m: Task outbound completed

Please enable this transition mark_for_outbound.

hello @diana
its was enabled

 "transitions": {
    "default_responses": true,
    "update_clinics": true,
    "accept_patient_reports": true,
    "conditional_alerts": true,
    "update_sent_by": false,
    "registration": true,
    "update_scheduled_reports": false,
    "multi_report_alerts": false,
    "update_sent_forms": false,
    "generate_patient_id_on_people": true,
    "death_reporting": true,
    "resolve_pending": false,
    "mark_for_outbound": true
  },
  "outbound": {
    "patient triggers enroll workflow in Textit": {
      "relevant_to": "doc.type === 'person' && doc.docket",
      "destination": {
        "base_url": "https://rapidpro.app.medicmobile.org",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'e16b6f2f-168b-4690-a52d-a27f54f88fc6'"
        },
        "urns": {
          "expr": "['tel:' + doc.phone]"
        }
      }
    }
  },

Interesting, because in your logs it appears as disabled:

[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "resolve_pending" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "muting" 
[2022-08-02 09:04:06] 2022-08-02 09:04:06 ESC[33mWARNESC[39m: Disabled transition "mark_for_outbound" 

Can you please double check server settings? These logs looks really old (from August). Can you please check more recent logs?

thanks @diana ,
this is strange, my assumption was that when i compile and upload the app settings they override all the settings in the server that have been there at that time .
May i restart the containers ?