[{"data":1,"prerenderedAt":1008},["Reactive",2],{"blog/gitlab-ci-telegram-notifications":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"draft":6,"external":6,"category":10,"tags":12,"date":16,"body":17,"_type":1002,"_id":1003,"_source":1004,"_file":1005,"_stem":1006,"_extension":1007},"/blog/gitlab-ci-telegram-notifications","blog",false,"","Gitlab CI Telegram Notifications","Better notifications for your pipeline with Telegram Bots",[11],"Tinkering",[13,14,15],"gitlab","ci","telegram","2023-02-12T00:00:00.000Z",{"type":18,"children":19,"toc":996},"root",[20,38,43,50,55,62,84,98,104,109,138,143,172,177,182,754,778,784,796,888,894,899,904,909,966,975,980,985,990],{"type":21,"tag":22,"props":23,"children":24},"element","p",{},[25,28,36],{"type":26,"value":27},"text","I keep most of my personal projects on ",{"type":21,"tag":29,"props":30,"children":34},"a",{"href":31,"rel":32},"https://gitlab.com",[33],"nofollow",[35],{"type":26,"value":31},{"type":26,"value":37},". While I love the ci-cd approach and how this can be defined, I hate that I cannot get an overall view of all the pipleines and their status.",{"type":21,"tag":22,"props":39,"children":40},{},[41],{"type":26,"value":42},"It happens quite often that I trigger deployments on multiple projects and I need to check the status for each. And the only way to do this is by navigating to each individual project and go to CI/CD -> Pipelines.",{"type":21,"tag":44,"props":45,"children":47},"h1",{"id":46},"telegram-bot-to-the-rescue",[48],{"type":26,"value":49},"Telegram Bot to the rescue",{"type":21,"tag":22,"props":51,"children":52},{},[53],{"type":26,"value":54},"As an active Telegram user, simplifying the process with a bot seemed natural. I'm looking for something simple: a conversion with the bot where \"it\"\ncan message me when a pipeline progesses.",{"type":21,"tag":56,"props":57,"children":59},"h2",{"id":58},"creating-the-bot",[60],{"type":26,"value":61},"Creating the bot.",{"type":21,"tag":22,"props":63,"children":64},{},[65,67,74,76,82],{"type":26,"value":66},"You can follow ",{"type":21,"tag":29,"props":68,"children":71},{"href":69,"rel":70},"https://learn.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-telegram?view=azure-bot-service-4.0#create-a-new-telegram-bot-with-botfather",[33],[72],{"type":26,"value":73},"this tutorial",{"type":26,"value":75}," to quickly get a bot up and running and get your bot ",{"type":21,"tag":77,"props":78,"children":79},"em",{},[80],{"type":26,"value":81},"access token",{"type":26,"value":83},". You will need this when calling the needed APIs",{"type":21,"tag":22,"props":85,"children":86},{},[87,89,96],{"type":26,"value":88},"With ",{"type":21,"tag":29,"props":90,"children":93},{"href":91,"rel":92},"https://telegram.me/botfather",[33],[94],{"type":26,"value":95},"@BotFather",{"type":26,"value":97}," you can also tweak other settings of your bot. You might want to change privacy regarding groups and so on, depending on how you plan to use it",{"type":21,"tag":56,"props":99,"children":101},{"id":100},"setting-up-the-conversion",[102],{"type":26,"value":103},"Setting up the conversion",{"type":21,"tag":22,"props":105,"children":106},{},[107],{"type":26,"value":108},"For the bot to be able to send messages you will need a chat id.",{"type":21,"tag":110,"props":111,"children":112},"ol",{},[113,126],{"type":21,"tag":114,"props":115,"children":116},"li",{},[117,119,124],{"type":26,"value":118},"Open a conversion with your newly created bot and send the ",{"type":21,"tag":77,"props":120,"children":121},{},[122],{"type":26,"value":123},"/start",{"type":26,"value":125}," command.",{"type":21,"tag":114,"props":127,"children":128},{},[129,131,136],{"type":26,"value":130},"Next we need to call the ",{"type":21,"tag":77,"props":132,"children":133},{},[134],{"type":26,"value":135},"getUpdates",{"type":26,"value":137}," endpoint of the bot to get the messages send to your bot. This will help us finding the chat id.",{"type":21,"tag":22,"props":139,"children":140},{},[141],{"type":26,"value":142},"Use your prefferred rest client (i'm using Insomnia) and execut a POST Request to",{"type":21,"tag":144,"props":145,"children":149},"pre",{"className":146,"code":147,"language":148,"meta":7,"style":7},"language-json shiki shiki-themes github-dark","POST https://api.telegram.org/bot$ACCESS_TOKEN/getUpdates\n","json",[150],{"type":21,"tag":151,"props":152,"children":153},"code",{"__ignoreMap":7},[154],{"type":21,"tag":155,"props":156,"children":159},"span",{"class":157,"line":158},"line",1,[160,166],{"type":21,"tag":155,"props":161,"children":163},{"style":162},"--shiki-default:#E1E4E8",[164],{"type":26,"value":165},"POST https:",{"type":21,"tag":155,"props":167,"children":169},{"style":168},"--shiki-default:#6A737D",[170],{"type":26,"value":171},"//api.telegram.org/bot$ACCESS_TOKEN/getUpdates\n",{"type":21,"tag":22,"props":173,"children":174},{},[175],{"type":26,"value":176},"Make sure you replace $ACCESS_TOKEN with your own.",{"type":21,"tag":22,"props":178,"children":179},{},[180],{"type":26,"value":181},"Response should look structuraly similar.",{"type":21,"tag":144,"props":183,"children":185},{"className":146,"code":184,"language":148,"meta":7,"style":7},"{\n  \"ok\": true,\n  \"result\": [\n    {\n      \"update_id\": 785513355,\n      \"message\": {\n        \"message_id\": 19,\n        \"from\": {\n          \"id\": 213456691,\n          \"is_bot\": false,\n          \"first_name\": \"**redacted**\",\n          \"last_name\": \"**redacted**\",\n          \"username\": \"**redacted**\",\n          \"language_code\": \"en\"\n        },\n        \"chat\": {\n          \"id\": 213456691,\n          \"first_name\": \"**redacted**\",\n          \"last_name\": \"Tere\",\n          \"username\": \"**redacted**\",\n          \"type\": \"private\"\n        },\n        \"date\": 1676219181,\n        \"text\": \"/start\",\n        \"entities\": [\n          {\n            \"offset\": 0,\n            \"length\": 6,\n            \"type\": \"bot_command\"\n          }\n        ]\n      }\n    }\n  ]\n}\n",[186],{"type":21,"tag":151,"props":187,"children":188},{"__ignoreMap":7},[189,197,222,236,245,267,281,303,316,338,360,383,404,425,443,452,465,485,505,526,546,564,572,594,616,629,638,660,682,700,709,718,727,736,745],{"type":21,"tag":155,"props":190,"children":191},{"class":157,"line":158},[192],{"type":21,"tag":155,"props":193,"children":194},{"style":162},[195],{"type":26,"value":196},"{\n",{"type":21,"tag":155,"props":198,"children":200},{"class":157,"line":199},2,[201,207,212,217],{"type":21,"tag":155,"props":202,"children":204},{"style":203},"--shiki-default:#79B8FF",[205],{"type":26,"value":206},"  \"ok\"",{"type":21,"tag":155,"props":208,"children":209},{"style":162},[210],{"type":26,"value":211},": ",{"type":21,"tag":155,"props":213,"children":214},{"style":203},[215],{"type":26,"value":216},"true",{"type":21,"tag":155,"props":218,"children":219},{"style":162},[220],{"type":26,"value":221},",\n",{"type":21,"tag":155,"props":223,"children":225},{"class":157,"line":224},3,[226,231],{"type":21,"tag":155,"props":227,"children":228},{"style":203},[229],{"type":26,"value":230},"  \"result\"",{"type":21,"tag":155,"props":232,"children":233},{"style":162},[234],{"type":26,"value":235},": [\n",{"type":21,"tag":155,"props":237,"children":239},{"class":157,"line":238},4,[240],{"type":21,"tag":155,"props":241,"children":242},{"style":162},[243],{"type":26,"value":244},"    {\n",{"type":21,"tag":155,"props":246,"children":248},{"class":157,"line":247},5,[249,254,258,263],{"type":21,"tag":155,"props":250,"children":251},{"style":203},[252],{"type":26,"value":253},"      \"update_id\"",{"type":21,"tag":155,"props":255,"children":256},{"style":162},[257],{"type":26,"value":211},{"type":21,"tag":155,"props":259,"children":260},{"style":203},[261],{"type":26,"value":262},"785513355",{"type":21,"tag":155,"props":264,"children":265},{"style":162},[266],{"type":26,"value":221},{"type":21,"tag":155,"props":268,"children":270},{"class":157,"line":269},6,[271,276],{"type":21,"tag":155,"props":272,"children":273},{"style":203},[274],{"type":26,"value":275},"      \"message\"",{"type":21,"tag":155,"props":277,"children":278},{"style":162},[279],{"type":26,"value":280},": {\n",{"type":21,"tag":155,"props":282,"children":284},{"class":157,"line":283},7,[285,290,294,299],{"type":21,"tag":155,"props":286,"children":287},{"style":203},[288],{"type":26,"value":289},"        \"message_id\"",{"type":21,"tag":155,"props":291,"children":292},{"style":162},[293],{"type":26,"value":211},{"type":21,"tag":155,"props":295,"children":296},{"style":203},[297],{"type":26,"value":298},"19",{"type":21,"tag":155,"props":300,"children":301},{"style":162},[302],{"type":26,"value":221},{"type":21,"tag":155,"props":304,"children":306},{"class":157,"line":305},8,[307,312],{"type":21,"tag":155,"props":308,"children":309},{"style":203},[310],{"type":26,"value":311},"        \"from\"",{"type":21,"tag":155,"props":313,"children":314},{"style":162},[315],{"type":26,"value":280},{"type":21,"tag":155,"props":317,"children":319},{"class":157,"line":318},9,[320,325,329,334],{"type":21,"tag":155,"props":321,"children":322},{"style":203},[323],{"type":26,"value":324},"          \"id\"",{"type":21,"tag":155,"props":326,"children":327},{"style":162},[328],{"type":26,"value":211},{"type":21,"tag":155,"props":330,"children":331},{"style":203},[332],{"type":26,"value":333},"213456691",{"type":21,"tag":155,"props":335,"children":336},{"style":162},[337],{"type":26,"value":221},{"type":21,"tag":155,"props":339,"children":341},{"class":157,"line":340},10,[342,347,351,356],{"type":21,"tag":155,"props":343,"children":344},{"style":203},[345],{"type":26,"value":346},"          \"is_bot\"",{"type":21,"tag":155,"props":348,"children":349},{"style":162},[350],{"type":26,"value":211},{"type":21,"tag":155,"props":352,"children":353},{"style":203},[354],{"type":26,"value":355},"false",{"type":21,"tag":155,"props":357,"children":358},{"style":162},[359],{"type":26,"value":221},{"type":21,"tag":155,"props":361,"children":363},{"class":157,"line":362},11,[364,369,373,379],{"type":21,"tag":155,"props":365,"children":366},{"style":203},[367],{"type":26,"value":368},"          \"first_name\"",{"type":21,"tag":155,"props":370,"children":371},{"style":162},[372],{"type":26,"value":211},{"type":21,"tag":155,"props":374,"children":376},{"style":375},"--shiki-default:#9ECBFF",[377],{"type":26,"value":378},"\"**redacted**\"",{"type":21,"tag":155,"props":380,"children":381},{"style":162},[382],{"type":26,"value":221},{"type":21,"tag":155,"props":384,"children":386},{"class":157,"line":385},12,[387,392,396,400],{"type":21,"tag":155,"props":388,"children":389},{"style":203},[390],{"type":26,"value":391},"          \"last_name\"",{"type":21,"tag":155,"props":393,"children":394},{"style":162},[395],{"type":26,"value":211},{"type":21,"tag":155,"props":397,"children":398},{"style":375},[399],{"type":26,"value":378},{"type":21,"tag":155,"props":401,"children":402},{"style":162},[403],{"type":26,"value":221},{"type":21,"tag":155,"props":405,"children":407},{"class":157,"line":406},13,[408,413,417,421],{"type":21,"tag":155,"props":409,"children":410},{"style":203},[411],{"type":26,"value":412},"          \"username\"",{"type":21,"tag":155,"props":414,"children":415},{"style":162},[416],{"type":26,"value":211},{"type":21,"tag":155,"props":418,"children":419},{"style":375},[420],{"type":26,"value":378},{"type":21,"tag":155,"props":422,"children":423},{"style":162},[424],{"type":26,"value":221},{"type":21,"tag":155,"props":426,"children":428},{"class":157,"line":427},14,[429,434,438],{"type":21,"tag":155,"props":430,"children":431},{"style":203},[432],{"type":26,"value":433},"          \"language_code\"",{"type":21,"tag":155,"props":435,"children":436},{"style":162},[437],{"type":26,"value":211},{"type":21,"tag":155,"props":439,"children":440},{"style":375},[441],{"type":26,"value":442},"\"en\"\n",{"type":21,"tag":155,"props":444,"children":446},{"class":157,"line":445},15,[447],{"type":21,"tag":155,"props":448,"children":449},{"style":162},[450],{"type":26,"value":451},"        },\n",{"type":21,"tag":155,"props":453,"children":455},{"class":157,"line":454},16,[456,461],{"type":21,"tag":155,"props":457,"children":458},{"style":203},[459],{"type":26,"value":460},"        \"chat\"",{"type":21,"tag":155,"props":462,"children":463},{"style":162},[464],{"type":26,"value":280},{"type":21,"tag":155,"props":466,"children":468},{"class":157,"line":467},17,[469,473,477,481],{"type":21,"tag":155,"props":470,"children":471},{"style":203},[472],{"type":26,"value":324},{"type":21,"tag":155,"props":474,"children":475},{"style":162},[476],{"type":26,"value":211},{"type":21,"tag":155,"props":478,"children":479},{"style":203},[480],{"type":26,"value":333},{"type":21,"tag":155,"props":482,"children":483},{"style":162},[484],{"type":26,"value":221},{"type":21,"tag":155,"props":486,"children":488},{"class":157,"line":487},18,[489,493,497,501],{"type":21,"tag":155,"props":490,"children":491},{"style":203},[492],{"type":26,"value":368},{"type":21,"tag":155,"props":494,"children":495},{"style":162},[496],{"type":26,"value":211},{"type":21,"tag":155,"props":498,"children":499},{"style":375},[500],{"type":26,"value":378},{"type":21,"tag":155,"props":502,"children":503},{"style":162},[504],{"type":26,"value":221},{"type":21,"tag":155,"props":506,"children":508},{"class":157,"line":507},19,[509,513,517,522],{"type":21,"tag":155,"props":510,"children":511},{"style":203},[512],{"type":26,"value":391},{"type":21,"tag":155,"props":514,"children":515},{"style":162},[516],{"type":26,"value":211},{"type":21,"tag":155,"props":518,"children":519},{"style":375},[520],{"type":26,"value":521},"\"Tere\"",{"type":21,"tag":155,"props":523,"children":524},{"style":162},[525],{"type":26,"value":221},{"type":21,"tag":155,"props":527,"children":529},{"class":157,"line":528},20,[530,534,538,542],{"type":21,"tag":155,"props":531,"children":532},{"style":203},[533],{"type":26,"value":412},{"type":21,"tag":155,"props":535,"children":536},{"style":162},[537],{"type":26,"value":211},{"type":21,"tag":155,"props":539,"children":540},{"style":375},[541],{"type":26,"value":378},{"type":21,"tag":155,"props":543,"children":544},{"style":162},[545],{"type":26,"value":221},{"type":21,"tag":155,"props":547,"children":549},{"class":157,"line":548},21,[550,555,559],{"type":21,"tag":155,"props":551,"children":552},{"style":203},[553],{"type":26,"value":554},"          \"type\"",{"type":21,"tag":155,"props":556,"children":557},{"style":162},[558],{"type":26,"value":211},{"type":21,"tag":155,"props":560,"children":561},{"style":375},[562],{"type":26,"value":563},"\"private\"\n",{"type":21,"tag":155,"props":565,"children":567},{"class":157,"line":566},22,[568],{"type":21,"tag":155,"props":569,"children":570},{"style":162},[571],{"type":26,"value":451},{"type":21,"tag":155,"props":573,"children":575},{"class":157,"line":574},23,[576,581,585,590],{"type":21,"tag":155,"props":577,"children":578},{"style":203},[579],{"type":26,"value":580},"        \"date\"",{"type":21,"tag":155,"props":582,"children":583},{"style":162},[584],{"type":26,"value":211},{"type":21,"tag":155,"props":586,"children":587},{"style":203},[588],{"type":26,"value":589},"1676219181",{"type":21,"tag":155,"props":591,"children":592},{"style":162},[593],{"type":26,"value":221},{"type":21,"tag":155,"props":595,"children":597},{"class":157,"line":596},24,[598,603,607,612],{"type":21,"tag":155,"props":599,"children":600},{"style":203},[601],{"type":26,"value":602},"        \"text\"",{"type":21,"tag":155,"props":604,"children":605},{"style":162},[606],{"type":26,"value":211},{"type":21,"tag":155,"props":608,"children":609},{"style":375},[610],{"type":26,"value":611},"\"/start\"",{"type":21,"tag":155,"props":613,"children":614},{"style":162},[615],{"type":26,"value":221},{"type":21,"tag":155,"props":617,"children":619},{"class":157,"line":618},25,[620,625],{"type":21,"tag":155,"props":621,"children":622},{"style":203},[623],{"type":26,"value":624},"        \"entities\"",{"type":21,"tag":155,"props":626,"children":627},{"style":162},[628],{"type":26,"value":235},{"type":21,"tag":155,"props":630,"children":632},{"class":157,"line":631},26,[633],{"type":21,"tag":155,"props":634,"children":635},{"style":162},[636],{"type":26,"value":637},"          {\n",{"type":21,"tag":155,"props":639,"children":641},{"class":157,"line":640},27,[642,647,651,656],{"type":21,"tag":155,"props":643,"children":644},{"style":203},[645],{"type":26,"value":646},"            \"offset\"",{"type":21,"tag":155,"props":648,"children":649},{"style":162},[650],{"type":26,"value":211},{"type":21,"tag":155,"props":652,"children":653},{"style":203},[654],{"type":26,"value":655},"0",{"type":21,"tag":155,"props":657,"children":658},{"style":162},[659],{"type":26,"value":221},{"type":21,"tag":155,"props":661,"children":663},{"class":157,"line":662},28,[664,669,673,678],{"type":21,"tag":155,"props":665,"children":666},{"style":203},[667],{"type":26,"value":668},"            \"length\"",{"type":21,"tag":155,"props":670,"children":671},{"style":162},[672],{"type":26,"value":211},{"type":21,"tag":155,"props":674,"children":675},{"style":203},[676],{"type":26,"value":677},"6",{"type":21,"tag":155,"props":679,"children":680},{"style":162},[681],{"type":26,"value":221},{"type":21,"tag":155,"props":683,"children":685},{"class":157,"line":684},29,[686,691,695],{"type":21,"tag":155,"props":687,"children":688},{"style":203},[689],{"type":26,"value":690},"            \"type\"",{"type":21,"tag":155,"props":692,"children":693},{"style":162},[694],{"type":26,"value":211},{"type":21,"tag":155,"props":696,"children":697},{"style":375},[698],{"type":26,"value":699},"\"bot_command\"\n",{"type":21,"tag":155,"props":701,"children":703},{"class":157,"line":702},30,[704],{"type":21,"tag":155,"props":705,"children":706},{"style":162},[707],{"type":26,"value":708},"          }\n",{"type":21,"tag":155,"props":710,"children":712},{"class":157,"line":711},31,[713],{"type":21,"tag":155,"props":714,"children":715},{"style":162},[716],{"type":26,"value":717},"        ]\n",{"type":21,"tag":155,"props":719,"children":721},{"class":157,"line":720},32,[722],{"type":21,"tag":155,"props":723,"children":724},{"style":162},[725],{"type":26,"value":726},"      }\n",{"type":21,"tag":155,"props":728,"children":730},{"class":157,"line":729},33,[731],{"type":21,"tag":155,"props":732,"children":733},{"style":162},[734],{"type":26,"value":735},"    }\n",{"type":21,"tag":155,"props":737,"children":739},{"class":157,"line":738},34,[740],{"type":21,"tag":155,"props":741,"children":742},{"style":162},[743],{"type":26,"value":744},"  ]\n",{"type":21,"tag":155,"props":746,"children":748},{"class":157,"line":747},35,[749],{"type":21,"tag":155,"props":750,"children":751},{"style":162},[752],{"type":26,"value":753},"}\n",{"type":21,"tag":110,"props":755,"children":756},{"start":224},[757],{"type":21,"tag":114,"props":758,"children":759},{},[760,762,768,770,776],{"type":26,"value":761},"Note down the value for ",{"type":21,"tag":151,"props":763,"children":765},{"className":764},[],[766],{"type":26,"value":767},"message.from.id",{"type":26,"value":769},". This is the ",{"type":21,"tag":151,"props":771,"children":773},{"className":772},[],[774],{"type":26,"value":775},"chat id",{"type":26,"value":777}," were gonna use for sending updates",{"type":21,"tag":56,"props":779,"children":781},{"id":780},"sending-messages-with-using-the-rest-api",[782],{"type":26,"value":783},"Sending messages with using the REST API",{"type":21,"tag":22,"props":785,"children":786},{},[787,789,794],{"type":26,"value":788},"To send a message to a chat you will need to call the ",{"type":21,"tag":77,"props":790,"children":791},{},[792],{"type":26,"value":793},"sendMessage",{"type":26,"value":795}," endpoint.",{"type":21,"tag":144,"props":797,"children":799},{"className":146,"code":798,"language":148,"meta":7,"style":7},"POST https://api.telegram.org/bot$ACCESS_TOKEN/sendMessage\n{\n    \"chat_id\": \"213456691\",\n    \"text\": \"hey from bot\",\n    \"disable_notification\": true\n}\n",[800],{"type":21,"tag":151,"props":801,"children":802},{"__ignoreMap":7},[803,815,822,843,864,881],{"type":21,"tag":155,"props":804,"children":805},{"class":157,"line":158},[806,810],{"type":21,"tag":155,"props":807,"children":808},{"style":162},[809],{"type":26,"value":165},{"type":21,"tag":155,"props":811,"children":812},{"style":168},[813],{"type":26,"value":814},"//api.telegram.org/bot$ACCESS_TOKEN/sendMessage\n",{"type":21,"tag":155,"props":816,"children":817},{"class":157,"line":199},[818],{"type":21,"tag":155,"props":819,"children":820},{"style":162},[821],{"type":26,"value":196},{"type":21,"tag":155,"props":823,"children":824},{"class":157,"line":224},[825,830,834,839],{"type":21,"tag":155,"props":826,"children":827},{"style":203},[828],{"type":26,"value":829},"    \"chat_id\"",{"type":21,"tag":155,"props":831,"children":832},{"style":162},[833],{"type":26,"value":211},{"type":21,"tag":155,"props":835,"children":836},{"style":375},[837],{"type":26,"value":838},"\"213456691\"",{"type":21,"tag":155,"props":840,"children":841},{"style":162},[842],{"type":26,"value":221},{"type":21,"tag":155,"props":844,"children":845},{"class":157,"line":238},[846,851,855,860],{"type":21,"tag":155,"props":847,"children":848},{"style":203},[849],{"type":26,"value":850},"    \"text\"",{"type":21,"tag":155,"props":852,"children":853},{"style":162},[854],{"type":26,"value":211},{"type":21,"tag":155,"props":856,"children":857},{"style":375},[858],{"type":26,"value":859},"\"hey from bot\"",{"type":21,"tag":155,"props":861,"children":862},{"style":162},[863],{"type":26,"value":221},{"type":21,"tag":155,"props":865,"children":866},{"class":157,"line":247},[867,872,876],{"type":21,"tag":155,"props":868,"children":869},{"style":203},[870],{"type":26,"value":871},"    \"disable_notification\"",{"type":21,"tag":155,"props":873,"children":874},{"style":162},[875],{"type":26,"value":211},{"type":21,"tag":155,"props":877,"children":878},{"style":203},[879],{"type":26,"value":880},"true\n",{"type":21,"tag":155,"props":882,"children":883},{"class":157,"line":269},[884],{"type":21,"tag":155,"props":885,"children":886},{"style":162},[887],{"type":26,"value":753},{"type":21,"tag":56,"props":889,"children":891},{"id":890},"integrating-into-gitlab-ciyml",[892],{"type":26,"value":893},"Integrating into .gitlab-ci.yml",{"type":21,"tag":22,"props":895,"children":896},{},[897],{"type":26,"value":898},"Now it's up to you on which stages you want to be notified one.",{"type":21,"tag":22,"props":900,"children":901},{},[902],{"type":26,"value":903},"In the stage's script you just need to execut the REST call with whatever text you want.",{"type":21,"tag":22,"props":905,"children":906},{},[907],{"type":26,"value":908},"For this I'm using curl and it looks something like this:",{"type":21,"tag":144,"props":910,"children":914},{"className":911,"code":912,"language":913,"meta":7,"style":7},"language-yaml shiki shiki-themes github-dark","build:\n  script:\n    - |\n      curl --request POST --url https://api.telegram.org/bot$ACCESS_TOKEN/sendMessage --header 'Content-Type: application/json' --data '{\"chat_id\": \"213456691\",\"text\": \"'\"Building  [${CI_PROJECT_NAME}] for environment: [${TARGET}] from branch: [${CI_COMMIT_BRANCH}] 🚀\"'\",\"disable_notification\": true}'\n","yaml",[915],{"type":21,"tag":151,"props":916,"children":917},{"__ignoreMap":7},[918,932,944,958],{"type":21,"tag":155,"props":919,"children":920},{"class":157,"line":158},[921,927],{"type":21,"tag":155,"props":922,"children":924},{"style":923},"--shiki-default:#85E89D",[925],{"type":26,"value":926},"build",{"type":21,"tag":155,"props":928,"children":929},{"style":162},[930],{"type":26,"value":931},":\n",{"type":21,"tag":155,"props":933,"children":934},{"class":157,"line":199},[935,940],{"type":21,"tag":155,"props":936,"children":937},{"style":923},[938],{"type":26,"value":939},"  script",{"type":21,"tag":155,"props":941,"children":942},{"style":162},[943],{"type":26,"value":931},{"type":21,"tag":155,"props":945,"children":946},{"class":157,"line":224},[947,952],{"type":21,"tag":155,"props":948,"children":949},{"style":162},[950],{"type":26,"value":951},"    - ",{"type":21,"tag":155,"props":953,"children":955},{"style":954},"--shiki-default:#F97583",[956],{"type":26,"value":957},"|\n",{"type":21,"tag":155,"props":959,"children":960},{"class":157,"line":238},[961],{"type":21,"tag":155,"props":962,"children":963},{"style":375},[964],{"type":26,"value":965},"      curl --request POST --url https://api.telegram.org/bot$ACCESS_TOKEN/sendMessage --header 'Content-Type: application/json' --data '{\"chat_id\": \"213456691\",\"text\": \"'\"Building  [${CI_PROJECT_NAME}] for environment: [${TARGET}] from branch: [${CI_COMMIT_BRANCH}] 🚀\"'\",\"disable_notification\": true}'\n",{"type":21,"tag":967,"props":968,"children":969},"blockquote",{},[970],{"type":21,"tag":22,"props":971,"children":972},{},[973],{"type":26,"value":974},"Make sure you replace the $ACCESS_TOKEN. Also chat_id value. You should even add them to your CI/CD Variables",{"type":21,"tag":22,"props":976,"children":977},{},[978],{"type":26,"value":979},"And that's it. Now you will have better view over your jobs.",{"type":21,"tag":22,"props":981,"children":982},{},[983],{"type":26,"value":984},"That's it 😌. Thank you",{"type":21,"tag":22,"props":986,"children":987},{},[988],{"type":26,"value":989},"🙏🏼",{"type":21,"tag":991,"props":992,"children":993},"style",{},[994],{"type":26,"value":995},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":199,"depth":199,"links":997},[998,999,1000,1001],{"id":58,"depth":199,"text":61},{"id":100,"depth":199,"text":103},{"id":780,"depth":199,"text":783},{"id":890,"depth":199,"text":893},"markdown","content:blog:5.gitlab-ci-telegram-notifications.md","content","blog/5.gitlab-ci-telegram-notifications.md","blog/5.gitlab-ci-telegram-notifications","md",1724422646759]