capcom6 / android-sms-gateway

An Android SMS Gateway app that enables sending SMS messages via a local or cloud server API
https://sms.capcom.me
Apache License 2.0
122 stars 32 forks source link

Why no data displayed in firebase? #84

Open faiz106 opened 3 days ago

faiz106 commented 3 days ago

I have setup everything successfully and also able to send SMS from postman and in my app i can see messages in logs as well.

Also i have correctly put google-services.json in app folder correctly.

But i am still not getting data in console

![Uploading Screenshot 2024-06-26 at 12.48.11 AM.png…]()

capcom6 commented 3 days ago

I'm not entirely sure why no data is being displayed in Firebase. However, there is post on StackOverflow indicating that only messages with analytics labels are included in reports. The "Important" section of the official documentation corroborates this. However, the app does not add analytics labels to FCM messages because I do not use analytics in the app, respecting privacy concerns.

To see analytics, you would first need to modify internal/sms-gateway/modules/push/fcm/client.go to send messages like this:

_, err := c.client.Send(ctx, &messaging.Message{
    Data: payload,
    Android: &messaging.AndroidConfig{
        Priority: "high",
        FCMOptions: &messaging.AndroidFCMOptions{
            AnalyticsLabel: "message", // Add analytics label here
        },
    },
    Token: address,
})

You might also need to enable Firebase Analytics in the Android part of the project.

However, a more straightforward approach would be to integrate independent analytics into the backend. I am considering Prometheus metrics, which can be viewed in Grafana with graphs. This solution offers greater flexibility.

umerHasan commented 1 day ago

When I am building the code with docker compose up --build

it gives me this error

2.583 go: github.com/capcom6/go-helpers@v0.0.0-20240521035030-5f57bddeecee: invalid version: unknown revision 5f57bddeecee

failed to solve: process "/bin/sh -c go mod download" did not complete successfully: exit code: 1

Is the docker compose up really using the updated code? It seems it is just downloading a pre built container, etc. Can you please tell me how to rebuild after the above modification?

faiz106 commented 1 day ago

if we write AnalyticsLabel from capital casing ... then can this cause issue ?

faiz106 commented 1 day ago

HI

When i sent push notifications using firebase console then i recieved push and also i can see them in reports

Screenshot 2024-06-28 at 1 47 05 AM

but when i send SMS using post api using postman . and send Successful SMS then i don't get any reporting in the dashboard

capcom6 commented 1 day ago

Hello, @faiz106

Unfortunately, this question isn't directly related to the app; it's more about Firebase. Therefore, I recommend consulting the official Firebase Cloud Messaging (FCM) documentation for more detailed information. Since analytics are not utilized within the app, I'm unable to provide further assistance on this matter. Sorry for any inconvenience.

capcom6 commented 1 day ago

Hello, @umerHasan . I moved your question to https://github.com/capcom6/sms-gateway/issues/74