diff --git a/go-app-ussd_clinic_rapidpro.js b/go-app-ussd_clinic_rapidpro.js index c3aba3a2..1a5d183c 100644 --- a/go-app-ussd_clinic_rapidpro.js +++ b/go-app-ussd_clinic_rapidpro.js @@ -1262,6 +1262,7 @@ go.app = function() { .send_whatsapp_template_message(msisdn, template_name, media) .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) { @@ -1425,8 +1426,6 @@ go.app = function() { .get_whatsapp_template_status(status_id) .then(function(data) { self.im.user.set_answer("preferred_channel", data.preferred_channel); - self.im.user.set_answer("status", data.status); - return self.states.create("state_trigger_rapidpro_flow"); }).catch(function(e) { // Go to error state after 3 failed HTTP requests diff --git a/src/ussd_clinic_rapidpro.js b/src/ussd_clinic_rapidpro.js index e332c9a6..34a083bc 100644 --- a/src/ussd_clinic_rapidpro.js +++ b/src/ussd_clinic_rapidpro.js @@ -1001,6 +1001,7 @@ go.app = function() { .send_whatsapp_template_message(msisdn, template_name, media) .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) { @@ -1164,8 +1165,6 @@ go.app = function() { .get_whatsapp_template_status(status_id) .then(function(data) { self.im.user.set_answer("preferred_channel", data.preferred_channel); - self.im.user.set_answer("status", data.status); - return self.states.create("state_trigger_rapidpro_flow"); }).catch(function(e) { // Go to error state after 3 failed HTTP requests