diff --git a/go-app-ussd_public_rapidpro.js b/go-app-ussd_public_rapidpro.js index aa4fffb9..b7312e2b 100644 --- a/go-app-ussd_public_rapidpro.js +++ b/go-app-ussd_public_rapidpro.js @@ -471,6 +471,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) { @@ -528,7 +529,7 @@ go.app = function() { mha: 6, swt: self.im.user.get_answer("preferred_channel") === "SMS" ? "1" : "7", preferred_channel: self.im.user.get_answer("preferred_channel"), - + status_id: self.im.user.answers.status_id, }; return self.rapidpro diff --git a/src/ussd_public_rapidpro.js b/src/ussd_public_rapidpro.js index 503be719..1827c89b 100644 --- a/src/ussd_public_rapidpro.js +++ b/src/ussd_public_rapidpro.js @@ -252,6 +252,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) { @@ -309,7 +310,7 @@ go.app = function() { mha: 6, swt: self.im.user.get_answer("preferred_channel") === "SMS" ? "1" : "7", preferred_channel: self.im.user.get_answer("preferred_channel"), - + status_id: self.im.user.answers.status_id, }; return self.rapidpro diff --git a/test/ussd_public_rapidpro.test.js b/test/ussd_public_rapidpro.test.js index e4a4f344..4155c90d 100644 --- a/test/ussd_public_rapidpro.test.js +++ b/test/ussd_public_rapidpro.test.js @@ -489,7 +489,8 @@ describe("ussd_public app", function() { "+27123456789", "test-welcome-template", null, - "Whatsapp" + "Whatsapp", + "status-id-uuid" ) ); api.http.fixtures.add( @@ -505,7 +506,8 @@ describe("ussd_public app", function() { "registered_by": "+27123456789", "mha": 6, "swt": "7", - "preferred_channel": "Whatsapp" + "preferred_channel": "Whatsapp", + "status_id": "status-id-uuid" } ) ); @@ -602,7 +604,8 @@ describe("ussd_public app", function() { "+27123456789", "test-welcome-template", null, - "Whatsapp" + "Whatsapp", + "status-id-uuid" ) ); api.http.fixtures.add( @@ -618,7 +621,8 @@ describe("ussd_public app", function() { "registered_by": "+27123456789", "mha": 6, "swt": "7", - "preferred_channel": "Whatsapp" + "preferred_channel": "Whatsapp", + "status_id": "status-id-uuid" } ) ); @@ -821,6 +825,7 @@ describe("ussd_public app", function() { mha: 6, swt: "1", preferred_channel: "SMS", + status_id: "status-id-uuid" } ) ); @@ -870,6 +875,7 @@ describe("ussd_public app", function() { mha: 6, swt: "7", preferred_channel: "Whatsapp", + status_id: "status-id-uuid" } ) );