Choose a different Template

Post to Slack when a GitHub issue is created or modified

When a GitHub issue is created or modified, post a message and link to the issue in a specific Slack channel.



Help and guides

Get started

Run this command in your terminal to create a new project using this template.

npx create-trigger github-issues-to-slack

This template contains a GitHub IssueEvent Trigger that will run whenever an issue action is performed in a GitHub repository:

import { Trigger } from "";
import * as github from "";
import * as slack from "";

// Change "triggerdotdev/github-issues-to-slack" to the repo you want to track e.g. "yourorg/yourrepo"
//NB: GitHub org / usernames are case sensitive.
const repo =
  process.env.GITHUB_REPOSITORY ?? "triggerdotdev/github-issues-to-slack";

new Trigger({
  // Give your Trigger a stable ID
  id: "github-issues-to-slack",
  name: "Posts to Slack when a GitHub Issue is created or modified",
  // This will register a webhook with the repo
  // and trigger whenever a new issue is created or modified
  // The run function will get called once per "issue" event
  // See
  run: async (event, ctx) => {
    // Posts a new message to the "github-issues" slack channel.
    // See
    // If the channel is private, you'll need to add the bot to the channel first.
    const response = await slack.postMessage("send-to-slack", {
      channelName: "github-issues",
      // If you include blocks, this text will be used in any notifications.
      text: `GitHub issue, *${event.issue.title}* has been *${event.action}*. `,
      // Blocks allow you to create richly formatted messages.
      // See
      blocks: [
          type: "section",
          text: {
            type: "mrkdwn",
            text: `GitHub issue, *${event.issue.title}* has been *${event.action}*.`,
          accessory: {
            type: "button",
            text: {
              type: "plain_text",
              text: "View Issue",
              emoji: true,
            value: "View Issue",
            url: event.issue.html_url,
            action_id: "button-action",

An example of the message posted to Slack:

GitHub Issue to Slack

✍️ Customize

  1. Make sure and update the repo parameter to point to a GitHub repository you manage by setting the GITHUB_REPOSITORY environment variable.
  2. Feel free to customize postMessage call with more data from the GitHub IssueEvent and change the channel name.

You can also do this with comments , pull requests, and more.