Go to file
2018-01-10 21:45:25 +01:00
dist feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
test feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
ts feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
.gitignore initial 2017-09-14 07:20:26 +02:00
.gitlab-ci.yml initial 2017-09-14 07:20:26 +02:00
defaults.yml initial 2017-09-14 07:20:26 +02:00
npmextra.json initial 2017-09-14 07:20:26 +02:00
package-lock.json feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
package.json feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
qenv.yml update to first properly working version 2017-09-17 14:53:00 +02:00
readme.md feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00
tslint.json initial 2017-09-14 07:20:26 +02:00
yarn.lock feat(Update the way SlackMessage works and create a proper readme): 2018-01-10 21:45:25 +01:00

slackme

API abstraction for mojoio

Availabililty

npm git git docs

Status for master

build status coverage report npm downloads per month Dependency Status bitHound Dependencies bitHound Code TypeScript node JavaScript Style Guide

Usage

Use TypeScript for best in class instellisense.

import * as slackme from 'slackme'

// First setup the hook
const mySlackme = new Slackme('https://some.slack.webhook.url')
mySlackme.sendMessage:{{
  // MessageOptions here
}, 'myAwesomeChannel'}

The message interface looks like this:

interface IAttachmentField {
  title: string
  value: string
  short?: boolean
}

interface IMessageOptions {
  /**
   * "Required plain-text summary of the attachment."
   */
  fallback?: string,
  /**
   * a side color
   */
  color?: string,
  /**
   * a message to show above
   */
  pretext?: string,
  /**
   * author name of the attachment
   */
  author_name?: string,
  /**
   * a link to the author
   */
  author_link?: string,
  /**
   * a string to the author
   */
  author_icon?: string,
  /**
   * a title for the attachment
   */
  title?: string,
  /**
   * a link for the title
   */
  title_link?: string,
  /**
   * the main text of the message
   */
  text?: string,
  fields?: IAttachmentField[],
  image_url?: string,
  thumb_url?: string,
  footer?: string,
  footer_icon?: string,
  /**
   * timestamp as epoch time
   */
  ts?: number
}

Alternatively, there is the option of specifying a SlackMessage class


const mySlackMessage = new SlackMessage({ /* message options here } */, mySlackme)
mySlackMessage.title = 'new Title' // modify message options
mySlackMessage.sendToRoom('general')
mySlackMessage.title = 'another Title'
mySlackMessage.sendToRoom('anotherroom')

For further information read the linked docs at the top of this README.

MIT licensed | © Lossless GmbH | By using this npm module you agree to our privacy policy

repo-footer