DEV Community

Cover image for FluffyChat push notification with sygnal!!
Taher Fattahi
Taher Fattahi

Posted on • Edited on

FluffyChat push notification with sygnal!!

How you can add FluffyChat messenger to your custom application with your package name or your unique bundle id?

FluffyChat source code => Link

In my new project development, I realized some information about FluffyChat Messenger.

You can add all of the FluffyChat source code to your new project but absolutely your push notification not working,
if you want to use Firebase Cloud Messaging in FluffyChat for sending a push notification in your new application.

Plz follow these steps:

1) Create new app in https://console.firebase.google.com/ and add google-serices.json to your project

2) Setup and install sygnal in your server

3) In FluffyChat source code plz change pushNotificationsAppId and pushNotificationsGatewayUrl in app_config.dart file

4) Add this line of code in sygnal source code:
in gcmpushkin.py add bottom line of code to _build_data function:

data["devices"] = [{"pushkey": device.pushkey,"data": device.data,"pushkey_ts": device.pushkey_ts,"app_id": device.app_id}]
Enter fullscreen mode Exit fullscreen mode

You can see this repository:
https://github.com/taherfattahi/sygnal

5) Add FCM Server key to sygnal.yaml in sygnal project

If you have any problem you can get in touch with me, my email address: taherfattahi11@gmail.com 😉

Top comments (12)

Collapse
 
robinwesterik profile image
Robin Westerik

Thanks Taher for sharing your findings. As it seems that FluffyChat's own push gateway hasn't been kept public, using the matrix reference gateway indeed seems like the way to go.

I'd like to add one thing however. In background_push.dart, FluffyChat seems to add a .data_message suffix to the app id. This could cause issues with sygnal not finding the right app id.

I fixed this by removing ".data_message" in FluffyChat's code, but adding .data_message to the app_id in the sygnal.yaml might work just as well.

Collapse
 
vinayak_dev01 profile image
vinayak dev

Are you mentioning SYGNAL as a matrix reference gateway? if so, can you provider any more resourse on how to set up?

Collapse
 
taherfattahi profile image
Taher Fattahi • Edited

yes, you can use sygnal as a push gateway for fluffychat or any matrix client platform but you need to set configurations and modify some sections of the source code so it's not easy for everyone.
anyway you can use this push gateway instead of sygnal
famedly-push-gateway

Thread Thread
 
vinayak_dev01 profile image
vinayak dev

Yeah.. Thanks for the quickie response. Actually, we are building our own Chat Application and we have tried famedly-push-gateway. When running the famedlyPushGateway.js file.. nothing happens and we don't know what we are missing and how to proceed then.. How can we make sure everything fits in place?

Thread Thread
 
taherfattahi profile image
Taher Fattahi

You need to set this variable in fluffychat:
static const String pushNotificationsGatewayUrl =

because synapse or any matrix home server needs to know about your push notification URL for sending notifications to the push gateway microservice

Image description

Thread Thread
 
vinayak_dev01 profile image
vinayak dev

Thanks, Taher.. Will Try That!

Collapse
 
vinayak_dev01 profile image
vinayak dev

Hey Taher... Can you please explain Step 2 on how to install and set up Sygnal? I have found this repo, but don't know how to configure.

Collapse
 
taherfattahi profile image
Taher Fattahi

If you want my recommendation I suggest you that use this service: gitlab.com/famedly/company/backend...

because Sygnal configuration and compatibility with fluffychat is not easy, you need to modify the source code of Sygnal besides of configuration

Collapse
 
taherfattahi profile image
Taher Fattahi

But anyway, you need to configure this file sygnal.yaml and put some keys for instance FCM keys on that

Collapse
 
vinayak_dev01 profile image
vinayak dev

Thanks, Taher!! It's working as expected.

Thread Thread
 
taherfattahi profile image
Taher Fattahi

you're welcome

Collapse
 
taherfattahi profile image
Taher Fattahi

and also configure and uncomment every line of that code base of your OS (android/ios) in sygnal.yaml file,