dcai / airnotifier

Push Notifications Server for Human Beings.
Other
593 stars 187 forks source link

Not able to send Notificaton #218

Open sreenumalae opened 4 years ago

sreenumalae commented 4 years ago

Hello Everyone !!

I just hosted airnotifier (Version 3.X) in my azure virtual machine. And i'm trying send a broadcast message from airnotifier.

Here is my JSON key { "type": "service_account", "project_id": "*", "private_key_id": "**", "private_key": "-----BEGIN PRIVATE KEY-----\n***\n-----END PRIVATE KEY-----\n", "client_email": "***@appspot.gserviceaccount.com", "client_id": "**", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/************%40appspot.gserviceaccount.com" }

silversufer commented 4 years ago

We have the same problem. Broadcast messages are not delivered.

silversufer commented 4 years ago

Dear @contributors, is there really no solution to this problem?

timothydillan commented 3 years ago

Bump. Having the same issue.

What I've done so far:

VPS/SERVER SIDE: Installed Python: sudo apt-get install python3-pip build-essential git pip3 install pipenv --user

Installed and started MongoDB: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/ sudo systemctl unmask mongod sudo service mongod start

Downloaded and ran Airnotifier: cd ~ git clone -b master git://github.com/airnotifier/airnotifier.git airnotifier cd airnotifier pipenv install --deploy mv config.py-sample config.py sudo python3 -m pipenv run ./app.py

Created an App: orgID = 0 Name of app = CHClassroom Entered FCM Project ID and Json Key, APN and WNS empty.

Moodle Integration: Airnotifier URL: https://[my_airnotifier_ip_addr] Airnotifier Port: 8801 Mobile app name: com.ch.moodlemobile Airnotifier app name: CHClassroom Airnotifier Access Key: generated an access key with all permissions given, and pasted it into the airnotifier access key field in Moodle.

APP SIDE: Building the App: Downloaded https://github.com/moodlehq/moodleapp/tree/integration Changed the App name Changed the App id Changed the siteurl Build using -> ionic cordova build android Run using -> npm run dev:android App successfully executed and I'm able to log in

Testing Airnotifier: Went to broadcast, and entered a message Clicked sent No notifications, no logs, no tokens.

Only thing that worked was to directly send broadcasts through Cloud Messaging from Firebase.

Any help is appreciated.

Edit: Turns out there was a https parameter that was commented in config.py, as I am using https I'm thinking that's the reason why it's not sending anything. I'll try and update once I set the https parameters.

timothydillan commented 3 years ago

Still having the same issue, even though my website isn't using https.

maudrid commented 3 years ago

I think I had the same issue and this is what I have found:

  1. I set up my Firebase account
  2. I added an app and created the corresponding web page (self hosted) using the 'getting started' tutorial on github.
  3. Once I got all the settings correct, the page was displaying my Registration Token.
  4. I set up AirNotifier with my Firebase json file.
  5. I tried broadcast and nothing happened.
  6. Then I found this issue while searching for a solution.
  7. Next I tried sending a message to my browser page with the registration token that it was displaying:
    
    curl -XPOST -H 'Accept: application/json' -H 'X-AN-APP-NAME: apptest' -H 'X-AN-APP-KEY: My App key from AirNotifier' -H "Content-type: application/json" -d '{
    "device": "fcm",
    "token": "The registration token from the test page",
    "alert": "Hello from AirNotifier",
    "sound": "Submarine.aiff",
    "badge": 1
    }' 'http://localhost:8801/api/v2/push'

This worked.
8. Then I check in AirNotifier and saw that the token I used was now added to the list of tokens for the app.
9. Then I tried the broadcast again, and this time it worked.

So I think you can only broadcast to known devices, so tokens that is already known to AirNotifier.