{"id":406402,"date":"2024-06-29T18:55:14","date_gmt":"2024-06-29T18:55:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=406402"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=406402","title":{"rendered":"<span>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 remote push notifications \u043d\u0430 iOS, \u043a\u043e\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Firebase Cloud Messaging<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/373\/6f1\/314\/3736f13144edc3d03dacd31578893e65.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/373\/6f1\/314\/3736f13144edc3d03dacd31578893e65.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c \u0422\u043e\u043b\u0441\u0442\u0438\u043a\u043e\u0432 \u0438 \u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0423\u0447\u0438.\u0440\u0443. \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<em> <\/em><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\"><em><u>Firebase Cloud Messaging<\/u><\/em><\/a>. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0443\u0448\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u044d\u043a\u0435\u043d\u0434\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u00a0 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c payload, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0443\u0448\u0435\u0439. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e Cloud Messaging \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043f\u0440\u043e\u0441\u0442 \u2014 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u0430\u043b\u043e \u043f\u043e\u0442\u0440\u0443\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043d\u0430\u0448\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438 \u0441\u0438\u043b\u044b.<\/p>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0432\u044b\u043a\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 iOS, \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 Firebase \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0443\u0448\u0435\u0439 \u0438\u0437 Firebase<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0443\u0448\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/ios\/send-with-console\"><u>Notifications composer<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0448 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 <a href=\"https:\/\/console.firebase.google.com\/\"><u>Firebase Console<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/server#firebase-admin-sdk-for-fcm\"><u>Admin SDK<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/reference\/fcm\/rest\/v1\/projects.messages\"><u>FCM HTTP v1 API<\/u><\/a><u>;<\/u><\/p>\n<\/li>\n<li>\n<p>Legacy <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/http-server-ref\"><u>HTTP protocol<\/u><\/a><u>;<\/u><\/p>\n<\/li>\n<li>\n<p>Legacy <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/xmpp-server-ref\"><u>XMPP \u00a0protocol<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong><em>Notifications composer<\/em><\/strong> \u043f\u0440\u043e\u0441\u0442. \u041d\u043e \u043e\u043d \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0433\u0438\u0431\u043a\u0438\u0439, \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u0435\u043b. <strong><em>Admin SDK<\/em><\/strong> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u043f\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e, \u0438 \u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. <strong><em>XMPP Protocol<\/em><\/strong> \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c: \u0432 \u0441\u0435\u0442\u0438 <a href=\"https:\/\/stackoverflow.com\/questions\/68636099\/can-you-still-use-xmpp-with-firebase-cloud-messaging-in-a-new-project\"><u>\u043f\u0438\u0448\u0443\u0442<\/u><\/a>, \u0447\u0442\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c.\u00a0<\/p>\n<p>\u041e\u0441\u0442\u0430\u044e\u0442\u0441\u044f <strong><em>Cloud Messaging API (Legacy)<\/em><\/strong> \u0438 <strong><em>Firebase Cloud Messaging API (V1)<\/em><\/strong><em>, <\/em>\u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441. \u0418\u0445 \u043c\u044b \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c.<\/p>\n<h3>FCM Token<\/h3>\n<p>\u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 API \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f<em> FCM Token<\/em>. \u042d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 Firebase. \u0422\u043e\u043a\u0435\u043d \u0441\u043b\u0443\u0436\u0438\u0442 \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0443\u0448. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043a\u0435\u043d\u0435 \u0438 \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u0435\u0433\u043e \u0432\u0437\u044f\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432<a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/ios\/client#swift\"> <u>Set up a Firebase Cloud Messaging client app on<\/u><\/a> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 API \u0438 \u043a\u0430\u043a \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439.<\/p>\n<h3>API (Legacy)<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u0448 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u00ab\u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f API (Legacy) \u2014 \u0441 \u043d\u0438\u043c \u043b\u0435\u0433\u0447\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<pre><code class=\"php\">'{   'aps': {     'alert': {       'title': 'Title text',       'body': 'Body text'  },     'sound': 'default',     'badge': 1,     'mutable-content': 1   },   'custom_key': 'custom_value' }'<\/code><\/pre>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c <strong>Server key<\/strong> \u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0445\u0435\u0434\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.\u00a0<\/p>\n<pre><code class=\"php\">--header 'Authorization: key=Server key'<\/code><\/pre>\n<p>\u041d\u0430\u0439\u0442\u0438 Server key \u043c\u043e\u0436\u043d\u043e <strong>\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Firebase<\/strong>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 <strong>Cloud Messaging<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412 \u043f\u043e\u043b\u0435 Server key<\/strong> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u043d\u0438\u0436\u0435. <\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/396\/705\/5fa\/3967055faa4ae6dd2f96d22c438d077a.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/396\/705\/5fa\/3967055faa4ae6dd2f96d22c438d077a.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/812\/b4e\/64c\/812b4e64cc07732171040f91a030f6f9.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/812\/b4e\/64c\/812b4e64cc07732171040f91a030f6f9.png\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0430 \u2014 FCM Token \u0438 Server key, \u043c\u044b \u043c\u043e\u0436\u0435\u043c <strong>\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f http-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432<a href=\"https:\/\/www.postman.com\/downloads\/\"> <u>Postman<\/u><\/a> (\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430). \u041d\u043e \u0434\u043b\u044f \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f<a href=\"https:\/\/curl.se\/\"> <u>curl<\/u><\/a> (\u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430). \u00a0 <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/http-server-ref\"><u>Cloud Messaging API (Legacy)<\/u><\/a>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">curl --location  --request POST 'https:\/\/fcm.googleapis.com\/fcm\/send' \\ --header 'Authorization: key=Server key' \\ --header 'Content-Type: application\/json' \\ --data-raw '{     'to': 'fcmToken',     'notification': {         'mutable_content': true,   'sound' 'default',         'title': 'Title',   'body': 'Body',     }, }'<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435. \u041b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0443, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443. \u0418 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u0443\u0434\u0430\u0447\u0438. <\/p>\n<h3>API (V1)<\/h3>\n<p>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043f\u0443\u0448\u0430 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u00ab\u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0430 <strong>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 <strong>API (V1)<\/strong>. \u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e<strong> <\/strong>\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u0437\u0430\u043f\u0440\u043e\u0441 V1 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 OAuth2 Access Token). \u0412 \u0446\u0435\u043b\u043e\u043c, \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/migrate-v1\"><u>from legacy to v1<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e API.<\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d<\/strong> \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0443 <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/auth-server\"><u>Authorize send requests<\/u><\/a>, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/server#firebase-admin-sdk-for-fcm\"><u>Admin SDK<\/u><\/a>. \u041d\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0449\u0435 \u0438 <strong>\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c <\/strong><a href=\"https:\/\/developers.google.com\/oauthplayground\/?code=4\/0AWtgzh4dPZU65kCCMT17upJ6dgoJXtCWojBdO8hp5FPp3P5-LnC6Cpu9qetaq3OIh_HW5Q&amp;scope=https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><strong><u>OAuth 2.0 Playground<\/u><\/strong><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 Firebase.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/developers.google.com\/oauthplayground\/?code=4\/0AWtgzh4dPZU65kCCMT17upJ6dgoJXtCWojBdO8hp5FPp3P5-LnC6Cpu9qetaq3OIh_HW5Q&amp;scope=https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><u>OAuth 2.0 Playground<\/u><\/a> \u0438 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<h4>\u0428\u0430\u0433 1<\/h4>\n<p>\u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong><em>Firebase Cloud Messaging API v1<\/em><\/strong> \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0443\u043d\u043a\u0442 <a href=\"https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><strong><em>https:\/\/www.googleapis.com\/auth\/firebase.messaging<\/em><\/strong><\/a><em> <\/em>\u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443 <em>Authorize APIs.<\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3bd\/b56\/811\/3bdb56811191899c5af03a4d952678c7.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3bd\/b56\/811\/3bdb56811191899c5af03a4d952678c7.png\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 Firebase. \u041d\u0443\u0436\u043d\u043e <strong>\u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043c\u043e\u0433 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 Access Token.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b4a\/8be\/a89\/b4a8bea89c8cd3351c6b02fd23d99cbd.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b4a\/8be\/a89\/b4a8bea89c8cd3351c6b02fd23d99cbd.png\"\/><\/figure>\n<h4>\u0428\u0430\u0433 2<\/h4>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0436\u0430\u0442\u044c \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443<strong> <em>Exchange authorization code for tokens<\/em><\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435. \u041b\u0438\u0431\u043e \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0448\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0a7\/489\/b36\/0a7489b36b32085521a784c83ca66a18.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0a7\/489\/b36\/0a7489b36b32085521a784c83ca66a18.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/78a\/e93\/044\/78ae930449fddf71e4cdd5678db3564d.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/78a\/e93\/044\/78ae930449fddf71e4cdd5678db3564d.png\"\/><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d, \u043d\u0443\u0436\u043d\u043e <strong>\u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 URL<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <strong>Project ID<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 General \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 Project ID \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 URL, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6fe\/1ad\/84b\/6fe1ad84b12944958b9e2df2b3914eab.png\" width=\"1920\" height=\"1080\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6fe\/1ad\/84b\/6fe1ad84b12944958b9e2df2b3914eab.png\"\/><\/figure>\n<pre><code class=\"php\">https:\/\/fcm.googleapis.com\/v1\/Project ID\/messages:send<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 OAuth Token \u0438 URL, \u043c\u043e\u0436\u043d\u043e <strong>\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/strong> <a href=\"https:\/\/firebase.google.com\/docs\/reference\/fcm\/rest\/v1\/projects.messages\"><strong><u>FCM REST API<\/u><\/strong><\/a> \u0438 <strong>\u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 json<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u043b\u0435 \u043f\u0443\u0448\u0430 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 nested_struct, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441: <\/p>\n<pre><code class=\"php\">curl -X POST -H 'Authorization: Bearer oauth_access_token'    -H 'Content-Type: application\/json'    -d '{        'message': {            'token':'fcmToken',           'apns': {               'headers': {                   'apns-priority': '10',                   'apns-id': 'uuid',                   'apns-push-type': 'alert',                },                'payload': {                    'aps': {                       'mutable-content': 1,                        'sound' 'default',                      'alert': {                            'title': 'Title',                            'body': Body',                        },                        'nested_struct': {                            'type': 'notification_type',                            'uchi_unique_key': 'uuid',                            'another': 'another',                         },                     },                 },             },         },    }' https:\/\/fcm.googleapis.com\/v1\/projects\/project-id\/messages:send HTTP\/1.1<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0434\u0443\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"php\">struct PushEntity: Codable {   let googleSenderId: String   let gcmMessageId: String   let google: String   let aps: Aps    enum CodingKeys: String, CodingKey {     case googleSenderId = \"google.c.sender.id\"     case gcmMessageId = \"gcm.message_id\"     case google = \"google.c.a.e\"     case aps   } }  extension PushEntity {   struct Aps: Codable {     let alert: Alert     let nestedStruct: [String: String?]       enum CodingKeys: String, CodingKey {         case alert         case nestedStruct = \"nested_struct\"     }   } }  extension PushEntity.Aps {   struct Alert: Codable {     let body: String     let title: String   } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c <strong>payload \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442<\/strong>? \u041c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0443\u0448\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u043e\u0433\u0434\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0443\u0448\u0435\u0439 \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0443\u0448\u0435\u0439 \u0434\u043b\u044f iOS \u0438 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b API \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0433\u0447\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u0432\u0430\u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0432\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438!<\/p>\n<hr\/>\n<p>\u0425\u043e\u0447\u0435\u0448\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0439 EdTech \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0430\u043c\u0438 \u2014\u00a0<a href=\"https:\/\/careers.uchi.ru\/?utm_source=habr&amp;utm_medium=links&amp;utm_campaign=pr_fire_base_23\"><u>\u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0441\u044f<\/u><\/a>\u00a0\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0423\u0447\u0438.\u0440\u0443!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/725634\/\"> https:\/\/habr.com\/ru\/articles\/725634\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u041c\u0430\u043a\u0441\u0438\u043c \u0422\u043e\u043b\u0441\u0442\u0438\u043a\u043e\u0432 \u0438 \u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432 \u0423\u0447\u0438.\u0440\u0443. \u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442<em> <\/em><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\"><em><u>Firebase Cloud Messaging<\/u><\/em><\/a>. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0443\u0448\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0431\u044d\u043a\u0435\u043d\u0434\u0430. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u043c \u0432\u0430\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c\u00a0 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c payload, \u0447\u0442\u043e\u0431\u044b \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0443\u0448\u0435\u0439. \u0412 \u0445\u043e\u0434\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e Cloud Messaging \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043f\u0440\u043e\u0441\u0442 \u2014 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u0430\u043b\u043e \u043f\u043e\u0442\u0440\u0443\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u043c \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043d\u0430\u0448\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u0438 \u0441\u0438\u043b\u044b.<\/p>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u0442\u0435\u0445, \u043a\u0442\u043e \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0432\u044b\u043a\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 iOS, \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0441\u044f \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 Firebase \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u043a\u0430\u043a \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0443\u0448\u0435\u0439 \u0438\u0437 Firebase<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0443\u0448\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/ios\/send-with-console\"><u>Notifications composer<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0443\u0448 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 <a href=\"https:\/\/console.firebase.google.com\/\"><u>Firebase Console<\/u><\/a>.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/server#firebase-admin-sdk-for-fcm\"><u>Admin SDK<\/u><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/firebase.google.com\/docs\/reference\/fcm\/rest\/v1\/projects.messages\"><u>FCM HTTP v1 API<\/u><\/a><u>;<\/u><\/p>\n<\/li>\n<li>\n<p>Legacy <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/http-server-ref\"><u>HTTP protocol<\/u><\/a><u>;<\/u><\/p>\n<\/li>\n<li>\n<p>Legacy <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/xmpp-server-ref\"><u>XMPP \u00a0protocol<\/u><\/a>.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong><em>Notifications composer<\/em><\/strong> \u043f\u0440\u043e\u0441\u0442. \u041d\u043e \u043e\u043d \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0433\u0438\u0431\u043a\u0438\u0439, \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u0435\u043b. <strong><em>Admin SDK<\/em><\/strong> \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0438\u043b\u0438\u0439 \u043f\u043e \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044e, \u0438 \u043c\u044b \u043d\u0435 \u0431\u044b\u043b\u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u0441 \u043d\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. <strong><em>XMPP Protocol<\/em><\/strong> \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0438\u043c: \u0432 \u0441\u0435\u0442\u0438 <a href=\"https:\/\/stackoverflow.com\/questions\/68636099\/can-you-still-use-xmpp-with-firebase-cloud-messaging-in-a-new-project\"><u>\u043f\u0438\u0448\u0443\u0442<\/u><\/a>, \u0447\u0442\u043e \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043d\u0438\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438 \u043e\u0442 \u043d\u0435\u0433\u043e \u043e\u0442\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c.\u00a0<\/p>\n<p>\u041e\u0441\u0442\u0430\u044e\u0442\u0441\u044f <strong><em>Cloud Messaging API (Legacy)<\/em><\/strong> \u0438 <strong><em>Firebase Cloud Messaging API (V1)<\/em><\/strong><em>, <\/em>\u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441. \u0418\u0445 \u043c\u044b \u0438 \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c.<\/p>\n<h3>FCM Token<\/h3>\n<p>\u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 API \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c, \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f<em> FCM Token<\/em>. \u042d\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u043d\u0430\u043c \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 Firebase. \u0422\u043e\u043a\u0435\u043d \u0441\u043b\u0443\u0436\u0438\u0442 \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0443\u0448. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0442\u043e\u043a\u0435\u043d\u0435 \u0438 \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u0435\u0433\u043e \u0432\u0437\u044f\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432<a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/ios\/client#swift\"> <u>Set up a Firebase Cloud Messaging client app on<\/u><\/a> \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 API \u0438 \u043a\u0430\u043a \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439.<\/p>\n<h3>API (Legacy)<\/h3>\n<p>\u0415\u0441\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u0448 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u00ab\u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f API (Legacy) \u2014 \u0441 \u043d\u0438\u043c \u043b\u0435\u0433\u0447\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<pre><code class=\"php\">'{   'aps': {     'alert': {       'title': 'Title text',       'body': 'Body text'  },     'sound': 'default',     'badge': 1,     'mutable-content': 1   },   'custom_key': 'custom_value' }'<\/code><\/pre>\n<p>\u041f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c <strong>Server key<\/strong> \u0432 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0445\u0435\u0434\u0435\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.\u00a0<\/p>\n<pre><code class=\"php\">--header 'Authorization: key=Server key'<\/code><\/pre>\n<p>\u041d\u0430\u0439\u0442\u0438 Server key \u043c\u043e\u0436\u043d\u043e <strong>\u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 Firebase<\/strong>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0443 <strong>Cloud Messaging<\/strong>.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412 \u043f\u043e\u043b\u0435 Server key<\/strong> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445 \u043d\u0438\u0436\u0435. <\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0430 \u2014 FCM Token \u0438 Server key, \u043c\u044b \u043c\u043e\u0436\u0435\u043c <strong>\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f http-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432<a href=\"https:\/\/www.postman.com\/downloads\/\"> <u>Postman<\/u><\/a> (\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430). \u041d\u043e \u0434\u043b\u044f \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u043c\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f<a href=\"https:\/\/curl.se\/\"> <u>curl<\/u><\/a> (\u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430). \u00a0 <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/http-server-ref\"><u>Cloud Messaging API (Legacy)<\/u><\/a>, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">curl --location  --request POST 'https:\/\/fcm.googleapis.com\/fcm\/send' \\ --header 'Authorization: key=Server key' \\ --header 'Content-Type: application\/json' \\ --data-raw '{     'to': 'fcmToken',     'notification': {         'mutable_content': true,   'sound' 'default',         'title': 'Title',   'body': 'Body',     }, }'<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435. \u041b\u0438\u0431\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0443, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443. \u0418 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0430\u043c \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0430. \u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u043d\u0430\u0439\u0442\u0438 \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043d\u0435\u0443\u0434\u0430\u0447\u0438. <\/p>\n<h3>API (V1)<\/h3>\n<p>\u0414\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043f\u0443\u0448\u0430 \u0432\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0432\u0438\u0434\u0435 \u00ab\u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u00bb, \u0430 <strong>\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438<\/strong>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 <strong>API (V1)<\/strong>. \u042d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e<strong> <\/strong>\u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0447\u0430\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 (\u0437\u0430\u043f\u0440\u043e\u0441 V1 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 OAuth2 Access Token). \u0412 \u0446\u0435\u043b\u043e\u043c, \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/migrate-v1\"><u>from legacy to v1<\/u><\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e API.<\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d<\/strong> \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0443 <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/auth-server\"><u>Authorize send requests<\/u><\/a>, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0438\u043b\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/firebase.google.com\/docs\/cloud-messaging\/server#firebase-admin-sdk-for-fcm\"><u>Admin SDK<\/u><\/a>. \u041d\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0449\u0435 \u0438 <strong>\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c <\/strong><a href=\"https:\/\/developers.google.com\/oauthplayground\/?code=4\/0AWtgzh4dPZU65kCCMT17upJ6dgoJXtCWojBdO8hp5FPp3P5-LnC6Cpu9qetaq3OIh_HW5Q&amp;scope=https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><strong><u>OAuth 2.0 Playground<\/u><\/strong><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043c \u043a\u0440\u0430\u0442\u043a\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 Firebase.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/developers.google.com\/oauthplayground\/?code=4\/0AWtgzh4dPZU65kCCMT17upJ6dgoJXtCWojBdO8hp5FPp3P5-LnC6Cpu9qetaq3OIh_HW5Q&amp;scope=https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><u>OAuth 2.0 Playground<\/u><\/a> \u0438 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<h4>\u0428\u0430\u0433 1<\/h4>\n<p>\u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <strong><em>Firebase Cloud Messaging API v1<\/em><\/strong> \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0443\u043d\u043a\u0442 <a href=\"https:\/\/www.googleapis.com\/auth\/firebase.messaging\"><strong><em>https:\/\/www.googleapis.com\/auth\/firebase.messaging<\/em><\/strong><\/a><em> <\/em>\u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443 <em>Authorize APIs.<\/em><\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u0438\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0443 Firebase. \u041d\u0443\u0436\u043d\u043e <strong>\u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043c\u043e\u0433 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 Access Token.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h4>\u0428\u0430\u0433 2<\/h4>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u043a\u0435\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0436\u0430\u0442\u044c \u0441\u0438\u043d\u044e\u044e \u043a\u043d\u043e\u043f\u043a\u0443<strong> <em>Exchange authorization code for tokens<\/em><\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432 \u043e\u0442\u0432\u0435\u0442\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d, \u043a\u0430\u043a \u043e\u0442\u043c\u0435\u0447\u0435\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0435. \u041b\u0438\u0431\u043e \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0448\u0435\u0442, \u0447\u0442\u043e \u043f\u043e\u0448\u043b\u043e \u043d\u0435 \u0442\u0430\u043a.<\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0442\u043e\u043a\u0435\u043d, \u043d\u0443\u0436\u043d\u043e <strong>\u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 URL<\/strong> \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <strong>Project ID<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0431\u0435\u0440\u0435\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438.\u00a0<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 General \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 Project ID \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u0432 URL, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442\u0430\u0445.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<pre><code class=\"php\">https:\/\/fcm.googleapis.com\/v1\/Project ID\/messages:send<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 OAuth Token \u0438 URL, \u043c\u043e\u0436\u043d\u043e <strong>\u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f<\/strong> <a href=\"https:\/\/firebase.google.com\/docs\/reference\/fcm\/rest\/v1\/projects.messages\"><strong><u>FCM REST API<\/u><\/strong><\/a> \u0438 <strong>\u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 json<\/strong>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0432 \u0442\u0435\u043b\u0435 \u043f\u0443\u0448\u0430 \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 nested_struct, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441: <\/p>\n<pre><code class=\"php\">curl -X POST -H 'Authorization: Bearer oauth_access_token'    -H 'Content-Type: application\/json'    -d '{        'message': {            'token':'fcmToken',           'apns': {               'headers': {                   'apns-priority': '10',                   'apns-id': 'uuid',                   'apns-push-type': 'alert',                },                'payload': {                    'aps': {                       'mutable-content': 1,                        'sound' 'default',                      'alert': {                            'title': 'Title',                            'body': Body',                        },                        'nested_struct': {                            'type': 'notification_type',                            'uchi_unique_key': 'uuid',                            'another': 'another',                         },                     },                 },             },         },    }' https:\/\/fcm.googleapis.com\/v1\/projects\/project-id\/messages:send HTTP\/1.1<\/code><\/pre>\n<p>\u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u0434\u0443\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443:<\/p>\n<pre><code class=\"php\">struct PushEntity: Codable {   let googleSenderId: String   let gcmMessageId: String   let google: String   let aps: Aps    enum CodingKeys: String, CodingKey {     case googleSenderId = \"google.c.sender.id\"     case gcmMessageId = \"gcm.message_id\"     case google = \"google.c.a.e\"     case aps   } }  extension PushEntity {   struct Aps: Codable {     let alert: Alert     let nestedStruct: [String: String?]       enum CodingKeys: String, CodingKey {         case alert         case nestedStruct = \"nested_struct\"     }   } }  extension PushEntity.Aps {   struct Alert: Codable {     let body: String     let title: String   } }<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c \u0438\u0437 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>\u0417\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c <strong>payload \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442<\/strong>? \u041c\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043f\u0443\u0448\u0430 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u043e\u0433\u0434\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0443\u0448\u0435\u0439 \u0443 \u043d\u0430\u0441 \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0449\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0418\u0442\u0430\u043a, \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u043a\u0430\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u0443\u0448\u0435\u0439 \u0434\u043b\u044f iOS \u0438 \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0438\u0434\u044b API \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043b\u0435\u0433\u0447\u0435 \u043d\u0430\u0439\u0442\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u0434\u043b\u044f \u0432\u0430\u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 \u043f\u0443\u0448-\u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>\u0423\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0432\u0430\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438!<\/p>\n<hr\/>\n<p>\u0425\u043e\u0447\u0435\u0448\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0448\u043a\u043e\u043b\u044c\u043d\u044b\u0439 EdTech \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0430\u043c\u0438 \u2014\u00a0<a href=\"https:\/\/careers.uchi.ru\/?utm_source=habr&amp;utm_medium=links&amp;utm_campaign=pr_fire_base_23\"><u>\u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0439\u0441\u044f<\/u><\/a>\u00a0\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0423\u0447\u0438.\u0440\u0443!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/725634\/\"> https:\/\/habr.com\/ru\/articles\/725634\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-406402","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=406402"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406402\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}