LoginSignup
1
0

More than 5 years have passed since last update.

HTTPでFCM Push通知送信方法(legacy http server protocol)

Posted at

Firebase Cloud Messaging HTTP Protocol
https://firebase.google.com/docs/cloud-messaging/http-server-ref

PowershellでFCM Push通知送信

$SERVER_KEY='abc...'
$DEVICE_TOKEN='123...'

$JSONBODY=@"
{
    "to": "${DEVICE_TOKEN}",
    "data": {
        "url": "https://yahoo.jp"
    },
    "notification": {
        "title": "a title",
        "body": "a test message"
    },
    "priority":10,
    "mutable_content":true
}
"@

$AuthHeader=@{'Authorization'="key=${SERVER_KEY}"}
$Url= 'https://fcm.googleapis.com/fcm/send'
$Response=Invoke-RestMethod -Verbose -Method Post -Uri $Url -Headers $AuthHeader -ContentType "application/json" -Body $JSONBODY

$Response
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0