{"id":454186,"date":"2025-04-01T16:58:25","date_gmt":"2025-04-01T16:58:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=454186"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=454186","title":{"rendered":"<span>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u0448 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0447\u0435\u0440\u0435\u0437 Spring Boot<\/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<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e  \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u0412 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2728<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8b4\/6e8\/d47\/8b46e8d471108d227964948fc3077614.png\" width=\"1024\" height=\"1024\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8b4\/6e8\/d47\/8b46e8d471108d227964948fc3077614.png\"\/><\/figure>\n<h2>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0438\u0441\u0430\u043b \u0432 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/848502\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u0417\u0434\u0435\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u0440\u043e\u0431\u0435\u0433\u0443\u0441\u044c \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d<\/h3>\n<p>\u0414\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043c\u0435\u043d. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/ngrok.com\/blog-post\/free-static-domains-ngrok-users\" rel=\"noopener noreferrer nofollow\">ngrok<\/a>. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u0430, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 ngrok:<\/p>\n<pre><code class=\"yaml\">version: 2 authtoken: YOUR_NGROK_TOKEN tunnels:   httpbin:     proto: http     addr: 8080       hostname: needed-filly-suitable.ngrok-free.app<\/code><\/pre>\n<p>\u0418 docker-compose \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c ngrok:<\/p>\n<pre><code class=\"yaml\">services:   ngrok:     image: ngrok\/ngrok:latest     command:       - \"start\"       - \"--all\"       - \"--config\"       - \"\/etc\/ngrok.yml\"     volumes:       - .\/ngrok.yml:\/etc\/ngrok.yml     network_mode: host<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 <a href=\"http:\/\/localhost:4040\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:4040 <\/a>\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0434\u043e\u043c\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/017\/a55\/fbd\/017a55fbdb8b4500443fc167e1213e01.png\" width=\"960\" height=\"278\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/017\/a55\/fbd\/017a55fbdb8b4500443fc167e1213e01.png\"\/><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430<\/h3>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 <a href=\"https:\/\/t.me\/BotFather\" rel=\"noopener noreferrer nofollow\">BotFather<\/a>, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u043e\u0442\u0430 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ee9\/47f\/aa3\/ee947faa30d30d3de11cf326c8485a13.png\" width=\"695\" height=\"506\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ee9\/47f\/aa3\/ee947faa30d30d3de11cf326c8485a13.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/801\/703\/eac\/801703eace0723615df3f937e44ac203.png\" width=\"695\" height=\"640\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/801\/703\/eac\/801703eace0723615df3f937e44ac203.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f16\/447\/dd1\/f16447dd1fcaa3d23be83fb1c7e81e3d.png\" width=\"695\" height=\"627\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f16\/447\/dd1\/f16447dd1fcaa3d23be83fb1c7e81e3d.png\"\/><\/figure>\n<h2>\u0412\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/core.telegram.org\/widgets\/login#widget-configuration\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0436\u0435\u0442\u0430<\/a>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u0431\u043e\u0442\u0430 \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3fd\/732\/7ba\/3fd7327ba0ee7755066ec28f57d1ae06.png\" width=\"960\" height=\"992\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3fd\/732\/7ba\/3fd7327ba0ee7755066ec28f57d1ae06.png\"\/><\/figure>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u042d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/h3>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0443 <code>src\/main\/resources\/static<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/tg\") public class TelegramController {      @Value(\"classpath:static\/telegram-auth-widget.html\")     private Resource authWidget;      @GetMapping(value = \"\/auth\/widget\", produces = MediaType.TEXT_HTML_VALUE)     public ResponseEntity&lt;Resource&gt; getAuthWidget() {         return ResponseEntity.ok()                 .header(HttpHeaders.CONTENT_DISPOSITION, \"inline\")                 .body(authWidget);     } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440, \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 id<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/536\/a63\/68a\/536a6368a1269aea0fb75b961b56fa00.png\" width=\"962\" height=\"1056\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/536\/a63\/68a\/536a6368a1269aea0fb75b961b56fa00.png\"\/><\/figure>\n<h2>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f  \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <a href=\"https:\/\/mvnrepository.com\/artifact\/org.telegram\/telegrambots-client\" rel=\"noopener noreferrer nofollow\">telegrambots-client<\/a>. <br \/>\u0412 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0433 \u0431\u043e\u0442\u043e\u0432 \u0438 \u0432 <a href=\"https:\/\/rubenlagus.github.io\/TelegramBotsDocumentation\/telegram-bots.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439  \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044d\u0442\u043e\u0439.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0431\u043e\u0442\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"java\">private final TelegramClient tgClient = new OkHttpTelegramClient(\"YOUR_TELEGRAM_TOKEN\");  @PostMapping(value = \"\/{userId}\/notifications\", consumes = MediaType.TEXT_PLAIN_VALUE) public void sendMessageToTelegram(@PathVariable Long userId,  @RequestBody String text) throws TelegramApiException {   SendMessage message = SendMessage.builder()             .chatId(userId)             .text(text)             .build();        tgClient.execute(message); }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f40\/de5\/fb6\/f40de5fb619c0ad2fae5e5cdf4c5ce97.png\" width=\"494\" height=\"131\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f40\/de5\/fb6\/f40de5fb619c0ad2fae5e5cdf4c5ce97.png\"\/><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/14a\/05d\/943\/14a05d943618d72e502fe4c112e7e50e.png\" width=\"495\" height=\"627\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/14a\/05d\/943\/14a05d943618d72e502fe4c112e7e50e.png\"\/><\/figure>\n<p>\ud83d\udc68\u200d\ud83d\udcbb <a href=\"https:\/\/t.me\/life_of_junior_dev\" rel=\"noopener noreferrer nofollow\">\u0414\u0436\u0443\u043d\u0438\u043e\u0440<\/a><\/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\/871558\/\"> https:\/\/habr.com\/ru\/articles\/871558\/<\/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<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0438 \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e  \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f. \u0412 Spring Boot \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u2728<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0410\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f<\/h2>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043f\u0440\u043e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u0438\u0441\u0430\u043b \u0432 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/articles\/848502\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>. \u0417\u0434\u0435\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u043e \u043f\u0440\u043e\u0431\u0435\u0433\u0443\u0441\u044c \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<h3>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d<\/h3>\n<p>\u0414\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043e\u043c\u0435\u043d. \u0415\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/ngrok.com\/blog-post\/free-static-domains-ngrok-users\" rel=\"noopener noreferrer nofollow\">ngrok<\/a>. <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u043e\u043c\u0435\u043d\u0430, \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 ngrok:<\/p>\n<pre><code class=\"yaml\">version: 2 authtoken: YOUR_NGROK_TOKEN tunnels:   httpbin:     proto: http     addr: 8080       hostname: needed-filly-suitable.ngrok-free.app<\/code><\/pre>\n<p>\u0418 docker-compose \u0441 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u043c ngrok:<\/p>\n<pre><code class=\"yaml\">services:   ngrok:     image: ngrok\/ngrok:latest     command:       - \"start\"       - \"--all\"       - \"--config\"       - \"\/etc\/ngrok.yml\"     volumes:       - .\/ngrok.yml:\/etc\/ngrok.yml     network_mode: host<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430, \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043d\u0430 <a href=\"http:\/\/localhost:4040\" rel=\"noopener noreferrer nofollow\">http:\/\/localhost:4040 <\/a>\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0447\u0442\u043e \u0434\u043e\u043c\u0435\u043d \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d<\/p>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430<\/h3>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 <a href=\"https:\/\/t.me\/BotFather\" rel=\"noopener noreferrer nofollow\">BotFather<\/a>, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0431\u043e\u0442\u0430 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043a \u043d\u0435\u043c\u0443 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d<\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0412\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/h2>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f <a href=\"https:\/\/core.telegram.org\/widgets\/login#widget-configuration\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u0434\u0436\u0435\u0442\u0430<\/a>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u0431\u043e\u0442\u0430 \u0438 \u0441\u0442\u0430\u0432\u0438\u043c \u0433\u0430\u043b\u043e\u0447\u043a\u0443 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h3>\u042d\u043d\u0434\u043f\u043e\u0438\u043d\u0442 \u0434\u043b\u044f \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438<\/h3>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0443 <code>src\/main\/resources\/static<\/code> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u043d\u0430\u0448\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre><code class=\"java\">@RestController @RequestMapping(\"\/tg\") public class TelegramController {      @Value(\"classpath:static\/telegram-auth-widget.html\")     private Resource authWidget;      @GetMapping(value = \"\/auth\/widget\", produces = MediaType.TEXT_HTML_VALUE)     public ResponseEntity&lt;Resource&gt; getAuthWidget() {         return ResponseEntity.ok()                 .header(HttpHeaders.CONTENT_DISPOSITION, \"inline\")                 .body(authWidget);     } }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440, \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 id<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439<\/h2>\n<p>\u0414\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f  \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c <a href=\"https:\/\/mvnrepository.com\/artifact\/org.telegram\/telegrambots-client\" rel=\"noopener noreferrer nofollow\">telegrambots-client<\/a>. <br \/>\u0412 \u0441\u0442\u0430\u0442\u044c\u044f\u0445 \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0433 \u0431\u043e\u0442\u043e\u0432 \u0438 \u0432 <a href=\"https:\/\/rubenlagus.github.io\/TelegramBotsDocumentation\/telegram-bots.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0432\u044b \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0435\u0439  \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u044d\u0442\u043e\u0439.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0442\u043e\u043a\u0435\u043d \u0431\u043e\u0442\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439:<\/p>\n<pre><code class=\"java\">private final TelegramClient tgClient = new OkHttpTelegramClient(\"YOUR_TELEGRAM_TOKEN\");  @PostMapping(value = \"\/{userId}\/notifications\", consumes = MediaType.TEXT_PLAIN_VALUE) public void sendMessageToTelegram(@PathVariable Long userId,  @RequestBody String text) throws TelegramApiException {   SendMessage message = SendMessage.builder()             .chatId(userId)             .text(text)             .build();        tgClient.execute(message); }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"\"><\/figure>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435:<\/p>\n<figure class=\"\"><\/figure>\n<p>\ud83d\udc68\u200d\ud83d\udcbb <a href=\"https:\/\/t.me\/life_of_junior_dev\" rel=\"noopener noreferrer nofollow\">\u0414\u0436\u0443\u043d\u0438\u043e\u0440<\/a><\/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\/871558\/\"> https:\/\/habr.com\/ru\/articles\/871558\/<\/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-454186","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454186","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=454186"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/454186\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=454186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=454186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=454186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}