File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,34 @@ Content-Type: application/json
46
46
}
47
47
```
48
48
49
+ ### Fetch
50
+ ``` js
51
+ var key = ' YOUR-SERVER-KEY' ;
52
+ var to = ' YOUR-IID-TOKEN' ;
53
+ var notification = {
54
+ ' title' : ' Portugal vs. Denmark' ,
55
+ ' body' : ' 5 to 1' ,
56
+ ' icon' : ' firebase-logo.png' ,
57
+ ' click_action' : ' http://localhost:8081'
58
+ };
59
+
60
+ fetch (' https://fcm.googleapis.com/fcm/send' , {
61
+ ' method' : ' POST' ,
62
+ ' headers' : {
63
+ ' Authorization' : ' key=' + key,
64
+ ' Content-Type' : ' application/json'
65
+ },
66
+ ' body'
7FFE
span> : JSON .stringify ({
67
+ ' notification' : notification,
68
+ ' to' : to
69
+ })
70
+ }).then (function (response ) {
71
+ console .log (response);
72
+ }).catch (function (error ) {
73
+ console .error (error);
74
+ })
75
+ ```
76
+
49
77
### cURL
50
78
```
51
79
curl -X POST -H "Authorization: key=YOUR-SERVER-KEY" -H "Content-Type: application/json" -d '{
You can’t perform that action at this time.
0 commit comments