Outbound push config

Hi @cliff, compiling and uploading the app settings would work as you expected, but I’m unsure if you’re sharing recent enough logs. What command are you running to get logs?

thanks @diana
i am using these commands to view the medic-sentinel and medic-api logs int he containers

After ssh into the remote server i run

  • docker exec -it medic-os /bin/bash to access a shell in the medic-os containe

then i run less /srv/storage/medic-sentinel/logs/medic-sentinel.log

Ok cool, that’s the right place to get logs, but can you please run tail -n 100 /srv/storage/medic-sentinel/logs/medic-sentinel.log (tail is just an example) to get the last lines in the log instead of the first?

1 Like

thanks @diana , it has generated the recent logs

[2022-09-22 16:16:48] 2022-09-22 16:16:48 WARN: Reminder configuration invalid: { form: '',
[2022-09-22 16:16:48]   text_expression: '',
[2022-09-22 16:16:48]   cron: '',
[2022-09-22 16:16:48]   mute_after_form_for: '',
[2022-09-22 16:16:48]   message: '' } 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task replications started 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task outbound started 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task purging started 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task backgroundCleanup started 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task reminders completed 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task replications completed 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task purging completed 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task dueTasks completed 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Background cleanup batch: 1630 -> 1630 (0) 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task backgroundCleanup completed 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 ERROR: Failed to push 41f05b40-7581-4ee2-8271-7c1deaf9592f to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 ERROR: Failed to push 48e872d2-903b-44cb-93d6-ed348f998fc0 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 ERROR: Failed to push 5909cf18-924f-45e7-85e1-dd90f8a6dfa0 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 ERROR: Failed to push 868a0a85-b2d5-447d-aa17-dd391c62ea42 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:16:48] 2022-09-22 16:16:48 INFO: Task outbound completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task dueTasks started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task reminders started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 WARN: Reminder configuration invalid: { form: '',
[2022-09-22 16:21:48]   text_expression: '',
[2022-09-22 16:21:48]   cron: '',
[2022-09-22 16:21:48]   mute_after_form_for: '',
[2022-09-22 16:21:48]   message: '' } 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task replications started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task outbound started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task purging started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task backgroundCleanup started 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task reminders completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task replications completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task purging completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Background cleanup batch: 1630 -> 1631 (1) 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task dueTasks completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 ERROR: Failed to push 41f05b40-7581-4ee2-8271-7c1deaf9592f to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task backgroundCleanup completed 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 ERROR: Failed to push 48e872d2-903b-44cb-93d6-ed348f998fc0 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 ERROR: Failed to push 5909cf18-924f-45e7-85e1-dd90f8a6dfa0 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 ERROR: Failed to push 868a0a85-b2d5-447d-aa17-dd391c62ea42 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation. 
[2022-09-22 16:21:48] 2022-09-22 16:21:48 INFO: Task outbound completed 
[2022-09-22 16:22:09] 2022-09-22 16:22:09 INFO: saved changes on doc 77c8f55f-8d59-40d3-ac3f-5937fd7c7f9a seq 1632-g1AAAAJmeJyd0DsKwkAQANDVCNp6Aj2B7MfdZCtzE91PlhCiVtZ6ErX3ADaC4iGsBL1J3E_KICQMzMB8XjElAGCURxqM1Xanci1ThOMZtIFKO-oLICdVVRV5JC5r2xgqbBASqOngDyOnNstFLT29lHBGDWNtpdRJy1o6egmyucoQaSutnLSvpauXcEY1NaaltBnYDA62WOzktLfXCJE0TlQn7Ry0u9Ne4V9GYmx0J-0RtI_Tbl7Tdo3wuJP2DZr7mwSgBwPIBaSSN50WP_9lpCg

i see ERROR: Failed to push 868a0a85-b2d5-447d-aa17-dd391c62ea42 to patient triggers enroll workflow in Textit: CouchDB config key 'medic-credentials/rapidpro.app' has not been populated. See the Outbound documentation in the logs . Could this be a result of the key value in the outbound configuration ?
"value_key": "rapidpro.app"

Hi @cliff,

That’s right. Have you added the rapidpro.app credentials?
This is the relevant documentation about how to add these credentials: API to interact with CHT Applications | Community Health Toolkit

1 Like

uumh thanks @diana i had spiked this ,let me look into it

hello @diana i added the rapidpro.app credentials though it says the credentials were not provided

root@e5352b116fea:/srv# tail -n 5 /srv/storage/medic-sentinel/logs/medic-sentinel.log
[2022-09-22 21:31:49] 2022-09-22 21:31:49 ERROR: Failed to push 5092f538-7e88-4ff4-bac8-4e925e0246bd to patient triggers enroll workflow in Textit, server responsed with 403 
[2022-09-22 21:31:49] 2022-09-22 21:31:49 ERROR: Response body: {"detail":"Authentication credentials were not provided."} 
[2022-09-22 21:31:49] 2022-09-22 21:31:49 ERROR: Failed to push c7e4b935-a410-4690-8614-877db77dba0c to patient triggers enroll workflow in Textit, server responsed with 403 
[2022-09-22 21:31:49] 2022-09-22 21:31:49 ERROR: Response body: {"detail":"Authentication credentials were not provided."} 
[2022-09-22 21:31:49] 2022-09-22 21:31:49 INFO: Task outbound completed

Not sure which kind of credentials are needed here because i added the deployments credentials via curl and Fauxton

Hi @cliff

You should have details about required authentication in textit.
value_key is added, as is, as the Authorization header of the request. This means that you should include the Token prefix along with the token itself as the value_key, if those are the texit authorization instructions.

hello @diana

i have added the token authorization key in textit used while POSTing to CHT


as the value_key in outbound config and also added it via Fauxton

 "destination": {
        "base_url": "https://textit.in",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "Token 57b30498a5b0aae73f2bd974f850ef4181856378"
        },
        "path": "/api/v2/flow_starts.json"
      },

but kind of facing ERROR: Response body: {"detail":"Authentication credentials were not provided."}

Hi @cliff
From what I understood, you need to add your token as per API to interact with CHT Applications | Community Health Toolkit and then reference it with the value_key in your configuration.

3 Likes

thanks @magp18
I added the token to the medic-credentials as seen below in couch DB


However when i use the /api/v1/credentials endpoint it gives

cliff@cliff-Latitude-5580:~$ curl -X PUT -H "Content-Type: text/plain" https://medic:password@cht.openelis-global.org/api/v1/credentials/Token 57b30498a5b0aae73f2bd974f850ef4181856377 -d 'password1'
{"error":"not_found","reason":"Database does not exist."}
curl: (6) Could not resolve host: 57b30498a5b0aae73f2bd974f850ef4181856377

Hi @cliff

/api/v1/credentials is being added in 4.0, please use the 3.x api section from the documentation for directions: API to interact with CHT Applications | Community Health Toolkit

hello @diana
The api token number in textit had changed which worked on changing to the same token in CHT.
Thanks much for your assistance always :+1:

3 Likes

hello @diana @mrjones

We are experiencing an issue with outbound, ideally i configured the push to trigger a flow in textit whenever a new patient is registered in CHT however now when you register a patient the outbound is not successful ie triggering the flow in textit as seen in the sentinel logs below for the 3 patients i have tried to register in CHT

root@07309c8e69e7:/srv# tail -n 3 /srv/storage/medic-sentinel/logs/medic-sentinel.log
[2022-12-05 07:59:26] 2022-12-05 07:59:26 INFO: Pushed 30a7ad79-5766-495d-85d0-0dd5e7336f34 to patient triggers enroll workflow in Textit 
[2022-12-05 07:59:26] 2022-12-05 07:59:26 INFO: saved changes on doc 30a7ad79-5766-495d-85d0-0dd5e7336f34 seq 3463-g1AAAAJ7eJyd0D0KwjAUAOCnFXT1BHoCaRKTNjjYm2iTNJRSddFZdy8gOOhN9Bw66E1qmhS6FKHlwXvwfr7h5QAwSj0FY7k7yFSJCOFg5ptAuRn1YxCToiiy1BMAvevG9IYSa4Ri1HTzRxJTk8Wyxi4WCzmjmrG2WFRiqxpbWMxnc5kg0hZbl9ixxhKL4YQqqnVLbDswGU6mGO9WgW8LEiJoEMpO4N2Bjwp8ud9pgbFWncCnAz8VeLagMpuEB53ArwOrH_b3DuSxTwVvOs1-YZGjXg 
[2022-12-05 07:59:26] 2022-12-05 07:59:26 INFO: Not pushing 30a7ad79-5766-495d-85d0-0dd5e7336f34 to patient triggers enroll workflow in Textit as payload is identical to previous push 
root@07309c8e69e7:/srv# tail -n 3 /srv/storage/medic-sentinel/logs/medic-sentinel.log
[2022-12-05 08:14:16] 2022-12-05 08:14:16 INFO: Pushed cd66e6bb-3bb4-44b3-a3cb-5e3e29b85a77 to patient triggers enroll workflow in Textit 
[2022-12-05 08:14:16] 2022-12-05 08:14:16 INFO: saved changes on doc cd66e6bb-3bb4-44b3-a3cb-5e3e29b85a77 seq 3465-g1AAAAJ7eJyd0D0KwjAUAODYCrp6Aj2BNIlJGxzsTbRJGkupuuisuxcQHPQmeg4d9CY1TQJditDy4D14P9_wCgDAMPMlGIndQWSSxxCF00AHLPTISwAfl2WZZz4HoHfd6N5AIAVhAptu_kh8ojNf1NjFYBGjRFHaFosrbFljc4MFdCZSiNtiqwo71tjaYCglkijVEtv2dQYnXbR3c-DbgBhzEkaiE3i34MOBL_s7xRFSshP4tODHgWcDSr2JWdgJ_FrQ_dDbW5AlAeGs6TT_AWRdo2A 
[2022-12-05 08:14:16] 2022-12-05 08:14:16 INFO: Not pushing cd66e6bb-3bb4-44b3-a3cb-5e3e29b85a77 to patient triggers enroll workflow in Textit as payload is identical to previous push 
root@07309c8e69e7:/srv# tail -n 3 /srv/storage/medic-sentinel/logs/medic-sentinel.log
[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: Pushed 546e1834-a689-460b-93af-347479d19353 to patient triggers enroll workflow in Textit 
[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: saved changes on doc 546e1834-a689-460b-93af-347479d19353 seq 3467-g1AAAAJ7eJyd0D0KwjAUAOBoBV09gZ5AmsSkDQ72JtokDaFUXXTW3ROIg95Ez6GD3qSmSaBLEVoevAfv5xteAQAY6UCCsdgdhJY8gSiahSZgYUb9FPBJWZa5DjgAvevG9IYCKQhT2HTzR-JTk_myxi4WixklitK2WFJhqxpbWCykc5FB3BZbV9ixxrTFUEYkUaolth2YDE6mGO_mwbcFMeYkikUn8O7Ahwdf7neKI6RkJ_DpwI8HzxaUZhOzqBP4daD_YX_vQJaGhLOm0_wHZ8OjYg 
[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: Not pushing 546e1834-a689-460b-93af-347479d19353 to patient triggers enroll workflow in Textit as payload is identical to previous push 
root@07309c8e69e7:/srv#

What does it mean exactly by the payload being identical to the previous on ?

For each patient entry i was using different names and phone numbers plus other details .
Not sure what is bring abou the identical bit between the payloads of the pushes

Hi @cliff

Everything seems to be working as expected. I’m taking an excerpt of your log:

[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: Pushed 546e1834-a689-460b-93af-347479d19353 to patient triggers enroll workflow in Textit 
[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: saved changes on doc 546e1834-a689-460b-93af-347479d19353
[2022-12-05 08:29:28] 2022-12-05 08:29:28 INFO: Not pushing 546e1834-a689-460b-93af-347479d19353 to patient triggers enroll workflow in Textit as payload is identical to previous push 

The first line says that patient triggers enroll workflow in Textit was pushed. The second says that sentinel saved the edited document (after all transitions ran). Outbound push executed again on the new edits, but found nothing had changed in the payload, so it skipped the push.

thanks @diana for the feedback

hello @diana @magp18
Run into some issue while configuring outbound connection for 4.x on textit …
I have used
curl -X PUT -H "Content-Type: text/plain" https://medic:<password>@<domain-name>/api/v1/credentials/M5W4UXMWT2JVPG7BZYNBGCVYYY3YQ5AXQH7EHNGN -d 'rapidpro.api' to stored the credentials .
M5W4UXMWT2JVPG7BZYNBGCVYYY3YQ5AXQH7EHNGN is the token i have tested the flow simulator in the textit webhook ie Authorization Token M5W4UXMWT2JVPG7BZYNBGCVYYY3YQ5AXQH7EHNGN

In CHT app settings i have “mark_for_outbound”: true, and the enrollment outbound config

 "patient triggers enroll workflow in Textit": {
      "relevant_to": "doc.type === 'person' && doc.tsis",
      "destination": {
        "base_url": "https://textit.com",
        "auth": {
          "type": "header",
          "name": "Authorization",
          "value_key": "rapidpro.app"
        },
        "path": "/api/v2/flow_starts.json"
      },
      "mapping": {
        "flow": {
          "expr": "'750317d6-6662-4c0e-9ea3-138798eba5ef'"
        },
        "urns": {
          "expr": "['tel:' + doc.phone]"
        }
      }

How is the endpoint structured the store the credentials? coz am getting

sudo docker logs compose-sentinel-1 --tail 5
    '    at /service/shared-libs/outbound/src/outbound.js:29:13\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)',
  [message]: "Credentials for 'rapidpro.app' have not been configured. See the Outbound documentation."
}

Hello @cliff

with this curl

M5W4UXMWT2JVPG7BZYNBGCVYYY3YQ5AXQH7EHNGN is the key which will identify these credentials in the database, and rapidpro.api is the token which will be sent.

Try using this curl to save the credentials, switching the key and the token. I think you will also need to add the word “Token” to the token.

curl -X PUT -H "Content-Type: text/plain" "https://medic:<password>@<domain-name>/api/v1/credentials/rapidpro.api" -d 'Token M5W4UXMWT2JVPG7BZYNBGCVYYY3YQ5AXQH7EHNGN'
1 Like