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

How to push a message by cURL #686

Closed
hiroto78 opened this issue Sep 28, 2018 · 1 comment
Closed

How to push a message by cURL #686

hiroto78 opened this issue Sep 28, 2018 · 1 comment

Comments

@hiroto78
Copy link

After getting access_token and InstanceId from SDK, tried to push a message by using cURL like below. This curl command is based on this site. The OS of target devise is Android.
https://firebase.google.com/docs/cloud-messaging/send-message

version:

implementation "com.google.firebase:firebase-messaging:17.3.0"
curl -X POST -H "Authorization: Bearer ya29.c.E...PCfhEE0" -H "Content-Type: application/json" -d '{
"message":{
  "notification": {
    "title": "FCM Message",
    "body": "This is an FCM Message",
  },
  "token": "fUSIYiaK1wQ:APA9....g"
  }
}' https://fcm.googleapis.com/v1/projects/{MY_PROJECT_ID}/messages:send

response:

{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}

Does anyone understand which part is INVALID_ARGUMENT or know how to get more error resopnse or message?

@hiroto78
Copy link
Author

hiroto78 commented Oct 1, 2018

I mistook MY_PROJECT_ID for Public-facing name . MY_PROJECT_ID doesn't always start from project-***.

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

1 participant