Skip to content

Commit

Permalink
Merge branch 'master' into feature-imchannels
Browse files Browse the repository at this point in the history
  • Loading branch information
mishk0 committed Sep 15, 2017
2 parents 7d2211a + 7a4d280 commit 4ab352f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ npm install slackbots
- `getGroupId(name)` (return: promise) - gets group ID by name,
- `getUserId(name)` (return: promise) - gets user ID by name,
- `getChatId(name)` (return: promise) - it returns or opens and returns a direct message channel ID,
- `postEphemeral(id, user, text, params)` (return: promise) - posts an ephemeral message to channel and user by ID,
- `postMessage(id, text, params)` (return: promise) - posts a message to channel | group | user by ID,
- `updateMessage(channelId, timestamp, text, params)` (return: promise) - updates a message in a channel,
- `postTo(name, message [, params, callback])` (return: promise) - posts a message to channel | group | user by name,
Expand Down
19 changes: 19 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,25 @@ class Bot extends EventEmitter {
}
return this._api('im.list');
}

/**
* Posts an ephemeral message to a channel and user
* @param {string} id - channel ID
* @param {string} user - user ID
* @param {string} text
* @param {object} params
* @returns {vow.Promise}
*/
postEphemeral(id, user, text, params) {
params = extend({
text: text,
channel: id,
user: user,
username: this.name
}, params || {});

return this._api('chat.postEphemeral', params);
}

/**
* Posts a message to a channel by ID
Expand Down

0 comments on commit 4ab352f

Please sign in to comment.