<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nikhil Vemula</title>
    <description>The latest articles on DEV Community by Nikhil Vemula (@nikhilvemula).</description>
    <link>https://dev.to/nikhilvemula</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F218062%2Fab74be74-1a47-4543-b4a3-c52e49f20081.png</url>
      <title>DEV Community: Nikhil Vemula</title>
      <link>https://dev.to/nikhilvemula</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nikhilvemula"/>
    <language>en</language>
    <item>
      <title>Get notified via telegram when pull request is raised</title>
      <dc:creator>Nikhil Vemula</dc:creator>
      <pubDate>Sun, 20 Sep 2020 13:33:56 +0000</pubDate>
      <link>https://dev.to/nikhilvemula/get-notified-via-telegram-when-pull-request-is-raised-4ha4</link>
      <guid>https://dev.to/nikhilvemula/get-notified-via-telegram-when-pull-request-is-raised-4ha4</guid>
      <description>&lt;p&gt;Telegram is cool messaging platform with lot of developer friendly capabilities. I wondered if i could get a notification whenever a pull request is raised to my GitHub public repository.&lt;/p&gt;

&lt;h1&gt;
  
  
  Leveraging git hub actions
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://github.com/features/actions" rel="noopener noreferrer"&gt;GitHub Actions&lt;/a&gt; can be used to do all sorts of automation on your GitHub repositories.&lt;/p&gt;

&lt;p&gt;Quickly doing some google search found an action which I can use to send telegram notifications when ever a pull request is raised.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create new a GitHub workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Under your repository home page, create a new workflow&lt;/li&gt;
&lt;li&gt;Select the simple workflow later we can modify this accordingly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmv01afkgumc2yd4e137k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmv01afkgumc2yd4e137k.png" alt="New GitHub Workflow"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# This is a basic workflow to help you get started with Actions

name: Telegram notification

# Controls when the action will run. Triggers the workflow on pull request
on:
  pull_request:
    branches: [ develop ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs the telegram notify action to send a notification
      - name: Telegram Notify
        uses: appleboy/telegram-action@master
        with:
          to: ${{ secrets.TELEGRAM_TO }}
          token: ${{ secrets.TELEGRAM_TOKEN }}
          format: markdown
          message: |
            A new PR is raised [View all PR's](https://github.com/&amp;lt;user&amp;gt;/&amp;lt;repo&amp;gt;/pulls)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Getting the telegram bot token and group unique id
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;a href="https://core.telegram.org/bots#6-botfather" rel="noopener noreferrer"&gt;Telegram Bot Father&lt;/a&gt; to create a new bot.&lt;/li&gt;
&lt;li&gt;When a bot is created it returns token, save it.&lt;/li&gt;
&lt;li&gt;Create a telegram group and add this bot to the group.&lt;/li&gt;
&lt;li&gt;Add a test message to this group.&lt;/li&gt;
&lt;li&gt;To get a unique id of the group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;https://api.telegram.org/bot&amp;lt;token&amp;gt;/getUpdates&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find the group unique id under &lt;code&gt;chat.id&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Create the necessary secrets required for the workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to settings under repository&lt;/li&gt;
&lt;li&gt;Under &lt;code&gt;secrets&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Create a new secret called &lt;code&gt;TELEGRAM_TOKEN&lt;/code&gt; with the token value from above.&lt;/li&gt;
&lt;li&gt;Create a new secret called &lt;code&gt;TELEGRAM_TO&lt;/code&gt; with unique id of the group.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yipeyy!! When a pull request is raised a notification is sent to the group.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/appleboy" rel="noopener noreferrer"&gt;
        appleboy
      &lt;/a&gt; / &lt;a href="https://github.com/appleboy/telegram-action" rel="noopener noreferrer"&gt;
        telegram-action
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      GitHub Action that sends a Telegram message.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
