diff --git a/go-app-ussd_chw_rapidpro.js b/go-app-ussd_chw_rapidpro.js index 4d18fe27..3695e2f7 100644 --- a/go-app-ussd_chw_rapidpro.js +++ b/go-app-ussd_chw_rapidpro.js @@ -669,6 +669,7 @@ go.app = function() { .send_whatsapp_template_message(msisdn, template_name) .then(function(data) { self.im.user.set_answer("preferred_channel", data.preferred_channel); + self.im.user.set_answer("status_id", data.status_id); if (data.preferred_channel == "SMS") { return self.rapidpro.get_global_flag("sms_registrations_enabled") .then(function(sms_registration_enabled) { @@ -734,7 +735,8 @@ go.app = function() { ).format(), passport_origin: self.im.user.answers.state_passport_country, passport_number: self.im.user.answers.state_passport_no, - preferred_channel: self.im.user.answers.preferred_channel + preferred_channel: self.im.user.answers.preferred_channel, + status_id: self.im.user.answers.status_id }; return self.rapidpro .start_flow(self.im.config.flow_uuid, null, "whatsapp:" + _.trim(msisdn, "+"), data) diff --git a/src/ussd_chw_rapidpro.js b/src/ussd_chw_rapidpro.js index 96a0226a..bec3f89f 100644 --- a/src/ussd_chw_rapidpro.js +++ b/src/ussd_chw_rapidpro.js @@ -497,6 +497,7 @@ go.app = function() { .send_whatsapp_template_message(msisdn, template_name) .then(function(data) { self.im.user.set_answer("preferred_channel", data.preferred_channel); + self.im.user.set_answer("status_id", data.status_id); if (data.preferred_channel == "SMS") { return self.rapidpro.get_global_flag("sms_registrations_enabled") .then(function(sms_registration_enabled) { @@ -562,7 +563,8 @@ go.app = function() { ).format(), passport_origin: self.im.user.answers.state_passport_country, passport_number: self.im.user.answers.state_passport_no, - preferred_channel: self.im.user.answers.preferred_channel + preferred_channel: self.im.user.answers.preferred_channel, + status_id: self.im.user.answers.status_id }; return self.rapidpro .start_flow(self.im.config.flow_uuid, null, "whatsapp:" + _.trim(msisdn, "+"), data) diff --git a/test/ussd_chw_rapidpro.test.js b/test/ussd_chw_rapidpro.test.js index 11c0102f..5469faa0 100644 --- a/test/ussd_chw_rapidpro.test.js +++ b/test/ussd_chw_rapidpro.test.js @@ -777,7 +777,8 @@ describe("ussd_chw app", function() { id_type: "sa_id", sa_id_number: "9001020005087", dob: "1990-01-02T00:00:00Z", - preferred_channel: "SMS" + preferred_channel: "SMS", + status_id: "status-id-uuid" } ) ); @@ -825,7 +826,8 @@ describe("ussd_chw app", function() { id_type: "sa_id", sa_id_number: "9001020005087", dob: "1990-01-02T00:00:00Z", - preferred_channel: "WhatsApp" + preferred_channel: "WhatsApp", + status_id: "status-id-uuid" } ) ); @@ -852,6 +854,7 @@ describe("ussd_chw app", function() { state_id_type: "state_sa_id_no", state_sa_id_no: "9001020005087", preferred_channel: "WhatsApp", + status_id: "status-id-uuid" }) .setup(function(api) { api.http.fixtures.add( @@ -869,6 +872,7 @@ describe("ussd_chw app", function() { sa_id_number: "9001020005087", dob: "1990-01-02T00:00:00Z", preferred_channel: "WhatsApp", + status_id: "status-id-uuid" } ) );