Sending Push via Postman using Firebase Messaging

后端 未结 11 1212
-上瘾入骨i
-上瘾入骨i 2020-12-02 20:25

I\'m trying to use Postman to send a single Push Notification using Firebase Cloud Messaging service.

This is a working cURL command for th

相关标签:
11条回答
  • 2020-12-02 20:54

    The correct way to set up Authorization key at Header is

    key=<API_ACCESS_KEY>

    and not only

    <API_ACCESS_KEY>

    Silly mistake, but since this could be useful for someone for testing Firebase Messaging with Postman I'm leaving the question opened.

    0 讨论(0)
  • 2020-12-02 20:55

    Posting FCM through POSTMAN

    Body - to is token id (should be generated through instance token) write body in raw binary application/json

    {
       "to": "cpa8cZPjq-w:APA91bF122f1Rnhu9v47bL
       YMajaNTHAIU5SzItDwTy9o2MCIveG0PlK78VPvp3d
       CqjwnUKZ4
       ngi1trSyM3_aXttW62iknFfbPGtjRLhZr6wq-3qFdboz8gzdOGPz**********",
    
       "notification": {
    
        "body": "Hello",
        "title": "This is test message."
       }
       }
    

    header: should have authorization :server key

    Content type : application/json after posting here the success message:

    0 讨论(0)
  • 2020-12-02 20:55

    Look at below screenshot how Authorization key is set

    Authorization : **key=**abcdefghijklmnopr2qrst253uv124wxyz_9shg

    0 讨论(0)
  • 2020-12-02 20:57

    Steps to send FCM throw Postman:

    1. URL to send: https://fcm.googleapis.com/v1/projects/projectid-34543/messages:send
    2. Request Type: POST
    3. Headers: Content-Type -> application/json & Authorization -> Bearer
    4. In the body section enter APS payload with the right device token.
    5. Click send.

    More information here: https://stackoverflow.com/a/62670409/1151916

    0 讨论(0)
  • 2020-12-02 20:57

    Be sure to include the content-type : application/json header

    it fails with a misleading error if you don't include the content-type header saying: Error=MissingRegistration

    0 讨论(0)
提交回复
热议问题