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

Not able to send Notificaton #218

Open
sreenumalae opened this issue Jul 6, 2020 · 5 comments
Open

Not able to send Notificaton #218

sreenumalae opened this issue Jul 6, 2020 · 5 comments

Comments

@sreenumalae
Copy link

sreenumalae commented Jul 6, 2020

Hello Everyone !!

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

  • I created a app in Firebase and when i tried to send a notification using cloud message it works. It means my firebase and app are perfect

  • In airnotifier i created a app and i gave project id and json key in Firebase Cloud Messaging settings.

  • Then i tried to send a broadcast message and i didn't receive any.

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
Copy link

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

@silversufer
Copy link

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

@timothydillan
Copy link

timothydillan commented Nov 14, 2020

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
Copy link

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

@maudrid
Copy link

maudrid commented Nov 30, 2020

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.

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

4 participants