Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notifications Not Working in Custom Mobile App with Self-Hosted Server #778

Closed
avinash-marsdevs opened this issue May 3, 2024 · 20 comments
Assignees

Comments

@avinash-marsdevs
Copy link

avinash-marsdevs commented May 3, 2024

Describe the Bug
Push notifications are not working in our custom Chatwoot mobile app connected to a self-hosted Chatwoot server. Despite updating the ANDROID_BUNDLE_ID, setting the ENABLE_PUSH_RELAY_SERVER environment variable to true/false, and updating the FCM_SERVER_KEY and Google services JSON for Android, push notifications fail to be received.

To Reproduce
Steps to reproduce the behavior:

  1. Update the server with the new FCM_SERVER_KEY, ANDROID_BUNDLE_ID, and set ENABLE_PUSH_RELAY_SERVER to true.
  2. Update the mobile app with the new Google services JSON.
  3. Send a message to trigger a push notification.
  4. Notice that the notification does not appear on the device.

Expected Behavior
Expected that the push notifications would be received on the device whenever a new message is sent or received in the app.

Observed Behavior
No push notifications are received on the device. No relevant error messages appear in the server logs, indicating a silent failure or misconfiguration.

Environment

  • Chatwoot Self-Hosted Server Version: 3.4.0
  • Custom Chatwoot Mobile App Version: 1.10.38
  • OS Version: Android 14

Additional Context
All required configurations and environmental variables have been updated as per the documentation.

Copy link

linear bot commented May 3, 2024

@gicellamare
Copy link

Same problem here

@fabioginzel
Copy link

+1

@avinash-marsdevs
Copy link
Author

its started working fine after I did ENABLE_PUSH_RELAY_SERVER = false

then its started working fine. but now FCM was deprecated so need to upgrade 3.10.0. will have to check again anyhow

@muhsin-k
Copy link
Member

muhsin-k commented Jun 24, 2024

If you're using the official mobile app, push notifications should function without problems. Be sure that the environment variable ENABLE_PUSH_RELAY_SERVER is set to true. In the latest version 3.10, we've included FCM HTTP v1 updates. Additionally please upgrade the mobile app to version 1.0.41.

@laianeramos
Copy link

Hi! In version 3.10 and mobile app 1.0.41, do I just need to set ENABLE_PUSH_RELAY_SERVER to true? Or do I need do add FCM_SERVER_KEY and ANDROID_BUNDLE_ID too? Where can I get this ids/keys?
thank you

If you're using the official mobile app, push notifications should function without problems. Be sure that the environment variable ENABLE_PUSH_RELAY_SERVER is set to true. In the latest version 3.10, we've included FCM HTTP v1 updates. Additionally please upgrade the mobile app to version 1.0.41.

@muhsin-k
Copy link
Member

@laianeramos FCM changes are only necessary for users who have a custom-branded mobile app. A detailed guide for this will be created soon.

@laianeramos
Copy link

@laianeramos FCM changes are only necessary for users who have a custom-branded mobile app. A detailed guide for this will be created soon.

@muhsin-k I'm using the official mobile app, the environment variable ENABLE_PUSH_RELAY_SERVER is set to true, i'm using the latest versions of chatwoot web and mobile app, but push notifications are not working. I'm waiting for the guide to see if i'm doing anything wrong

@muhsin-k
Copy link
Member

@laianeramos https://www.chatwoot.com/docs/contributing-guide/mobile-app/custom-release-guide#setup-firebase-for-push-notification

Please check whether you have enabled the notification preferences in profile settings.
CleanShot 2024-07-10 at 08 40 24@2x

@muhsin-k
Copy link
Member

Closing this issue, for now. Please feel free to reopen this if it is still an issue.

@mayank-gc
Copy link

Hey @muhsin-k
We are using self-hosted chatwoot (v3.3.2) with an official android mobile app (v1.10.44)
We have set ENABLE_PUSH_RELAY_SERVER to true

After debugging we encountered these errors

1st error -
{\n "error": {\n "code": 400,\n "message": "Invalid JSON payload received. Unknown name \"sound\" at 'message.notification': Cannot find field.\nInvalid JSON payload received. Unknown name \"collapse_key\" at 'message': Cannot find field.",\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n "@type": "type.googleapis.com/google.rpc.BadRequest",\n "fieldViolations": [\n {\n "field": "message.notification",\n "description": "Invalid JSON payload received. Unknown name \"sound\" at 'message.notification': Cannot find field."\n },\n {\n "field": "message",\n "description": "Invalid JSON payload received. Unknown name \"collapse_key\" at 'message': Cannot find field."\n }\n ]\n }\n ]\n }\n}\n

After removing sound, collapse_key parameters from https://hub.2.chatwoot.com/send_push API.

We got another error -
{\n "error": {\n "code": 400,\n "message": "Recipient of the message is not set.",\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n "@type": "type.googleapis.com/google.rpc.BadRequest",\n "fieldViolations": [\n {\n "field": "message",\n "description": "Recipient of the message is not set."\n }\n ]\n },\n {\n "@type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",\n "errorCode": "INVALID_ARGUMENT"\n }\n ]\n }\n}\n

@mastermailgeral
Copy link

Same problem here. No notifications using the oficial mobile app with self host installation.

@muhsin-k
Copy link
Member

@mayank-gc It seems you're using an old version of Chatwoot. You need to upgrade to Chatwoot version 3.10.0. Push notifications won't work for earlier versions due to Firebase's API level changes.

@mastermailgeral
Copy link

@muhsin-k I have the 3.12.0 version and the problem persists.

@muhsin-k
Copy link
Member

muhsin-k commented Aug 28, 2024

It seems you're using an old version of Chatwoot. You need to upgrade to Chatwoot version 3.10.0. Push notifications won't work for earlier versions due to Firebase's API level changes.

@mayank-gc Did you make the changes?

@muhsin-k
Copy link
Member

@mastermailgeral Please check you have followed this guide properly or not.

@mastermailgeral
Copy link

@muhsin-k Yes, i follow the guide and i declare the variable ENABLE_PUSH_RELAY_SERVER=true, but only when i open the oficial mobile app, the app refresh and i see the new messages. I have installed Chatwood on docker.

@notridan
Copy link

I have the same problem, chatwoot self hosted and official app, variable set to true and push notifications don't work, has anyone solved it?

@natanaelece
Copy link

natanaelece commented Feb 5, 2025

I have the same problem, chatwoot self hosted and official app, variable set to true and push notifications don't work, has anyone solved it?

Chatwoot v4

@antoinesco
Copy link

I have exactly the same issue.
Selfhosted chatwoot + ENABLE_PUSH_RELAY_SERVER=true + official iOS app and notifications are not working + new messages are visible only when updating the app window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants