diff --git a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json index 06de925f5..77fb40565 100644 --- a/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json +++ b/app/javascript/dashboard/i18n/locale/en/inboxMgmt.json @@ -384,6 +384,7 @@ "ERRORS": { "IDS_REQUIRED": "Enter the Phone Number ID and WhatsApp Business Account ID.", "REQUIRED": "Enter the WABA ID, Phone Number ID, and permanent access token.", + "INVALID_TOKEN": "This access token is invalid or expired. Generate a new permanent token and try again.", "GENERIC": "We could not complete the WhatsApp setup. Check your details and try again." } }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/WhatsappManualSetup.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/WhatsappManualSetup.vue index a70714520..ff376cfff 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/WhatsappManualSetup.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/WhatsappManualSetup.vue @@ -133,9 +133,14 @@ const statusRows = computed(() => [ }, ]); -const apiErrorMessage = error => - error.response?.data?.message || - t('INBOX_MGMT.ADD.WHATSAPP.MANUAL_SETUP.ERRORS.GENERIC'); +const apiErrorMessage = error => { + const message = error.response?.data?.message || ''; + if (/invalid oauth access token|cannot parse access token/i.test(message)) { + return t('INBOX_MGMT.ADD.WHATSAPP.MANUAL_SETUP.ERRORS.INVALID_TOKEN'); + } + + return message || t('INBOX_MGMT.ADD.WHATSAPP.MANUAL_SETUP.ERRORS.GENERIC'); +}; const setStep = step => { errorMessage.value = ''; @@ -315,7 +320,7 @@ onBeforeUnmount(() => {
{{ errorMessage }} @@ -592,6 +597,9 @@ onBeforeUnmount(() => { 'INBOX_MGMT.ADD.WHATSAPP.MANUAL_SETUP.DETAILS.TOKEN_PLACEHOLDER' ) " + :message="errorMessage" + message-type="error" + @update:model-value="errorMessage = ''" />
-

+

{{ $t('INBOX_MGMT.ADD.WHATSAPP.MANUAL_SETUP.TOKEN.WARNING') }}