Skip to content

idw111/slack-write

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM version dependencies Status

write on slack

Usage

  1. Add a slackbot integration, and get a token (https://your-team-name.slack.com/services/new/slackbot)
  2. Get a channel id from slack (https://api.slack.com/methods/channels.list/test)
  3. You can pass anything to username
  4. You can use slack message formatting (https://api.slack.com/docs/formatting)

Example

var slackWrite = require('slack-write');
var channel = {
	token: 'slack-bot-token',
	channel: 'CXXXXXXX',
	username: 'bot-name'
};
var slack = slackWrite(channel);

// write plain text
slack.write('Some text', function(err, result) {
	console.log(err, result);
});

// post a single attachment
slack.attach('ignored text', {
	pretext: 'pretext',
	title: 'attachment title',
	text: 'some texts following title'
}, function(err, result) {
	console.lgo(err, result);
});

License

MIT © Dongwon Lim

About

Post some contents to slack with a bot account

Resources

License

Stars

Watchers

Forks

Packages

No packages published