Skip to content
A Probot extension to add message attachments to comments on GitHub
Branch: master
Clone or download
Brandon Keepers
Brandon Keepers Create stale.yml
Latest commit 1e2ddf0 Apr 5, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Create stale.yml Apr 5, 2018
test Support attaching to PR Mar 14, 2018
.gitignore MVP Oct 26, 2017
.travis.yml Travis config Mar 14, 2018 Update README example Mar 14, 2018
index.js Support attaching to PR Mar 14, 2018
package.json Add probot as development dependency Mar 13, 2018

Probot: attachments

A Probot extension to add message attachments to comments on GitHub.


const attachments = require('probot-attachments')

module.exports = robot => {
  const events = ['issues.opened', 'pull_request.opened', 'issue_comment.created']
  robot.on(events, context => {
    return attachments(context).add({
      'title': 'Hello World',
      'title_link': ''


Here is a probot app that listens for a comment that matches bobby tables and adds an attachment to the comment.

const attachments = require('probot-attachments');

module.exports = robot => {
  robot.on('issue_comment.created', context => {
    if(context.payload.comment.body.match(/bobby tables/i)) {
      return attachments(context).add({
        'pretext': 'Let us all heed the lessons of little bobby tables:',
        'author_name': 'Bobby Tables',
        'author_link': '',
        'author_icon': '',
        'title': 'Exploits of a Mom',
        'title_link': '',
        'text': 'Her daughter is named Help I\'m trapped in a driver\'s license factory.',
        'image_url': '',
        'thumb_url': '',
        'footer': 'Probot the Trollbot',
        'footer_icon': '',

How it works

This extension is what you might call "a hack". GitHub doesn't have an API for adding attachments on comments, but it does have rather large comment fields that support some HTML. This extension renders the attachment as a blockquote and appends it to the original comment body.

This extension is inspired by Slack's message attachments.

You can’t perform that action at this time.