More than wrapping Slack's Web APIs, this module adds quite a few methods to build-up complex services in no time.
/*
As for now, no npm repo has been open.
npm install https://github.com/phelpstream/slack.git --save
or
yarn add https://github.com/phelpstream/slack.git
*/
const Slack = require('slack');
let slack = new Slack( /* Slack API OAuth Access Token */);
// Post a message
slack.chat
.postMessage("general", "Welcome to our slack, sent from Node!")
.then(response => {
console.log("Response:", response)
}).catch(err => console.error(err))
// Update it (not a native method)
slack.chat
.updateLastMessageByChannelName("general", "Welcome to our slack, updated from Node!")
.then(response => {
console.log("Response:", response)
}).catch(err => console.error(err))
// Update it (not a native method)
slack.chat
.deleteLastMessageStartingWithByChannelName("general", "Welcome to our slack")
.then(response => {
console.log("Response:", response)
}).catch(err => console.error(err))
Checks API calling code.
See native api: api.test
Returns list of permissions this app has on a team.
See native api: apps.permissions.info
Allows an app to request additional scopes
See native api: apps.permissions.request
Revokes a token.
See native api: auth.revoke
Checks authentication & identity.
See native api: auth.test
Gets information about a bot user.
See native api: bots.info
Archives a channel.
See native api: channels.archive
Archives a channel by a channel name.
Custom method
Creates a channel.
See native api: channels.create
Fetches history of messages and events from a channel.
See native api: channels.history
Fetches history of messages and events from a channel by its name.
Custom method
Fetches last message of a channel
Custom method
Fetches last message of a channel by its name.
Custom method
Get timestamp of last message of a channel
Custom method
Get timestamp of last message of a channel by channel name
Custom method
Fetches last message starting by a text.
Custom method
Fetches last message starting by a text by a channel name.
Custom method
Get timestamp of last message of a channel by channel name.
Custom method
Gets information about a channel.
See native api: channels.info
Invites a user to a channel.
See native api: channels.invite
Invites a user from a channel by channel name.
Custom method
Invites a user from a channel by channel name.
Custom method
Invites a user by user name from a channel by channel name.
Custom method
Joins a channel, creating it if needed.
See native api: channels.join
Removes a user from a channel.
See native api: channels.kick
Removes a user from a channel by channel name.
Custom method
Removes a user by user name from a channel.
Custom method
Removes a user by user name from a channel by channel name.
Custom method
Leaves a channel.
See native api: channels.leave
Lists all channels in a Slack team.
See native api: channels.list
Return a channel object from a given name.
Custom method
Return an id from a given channel name.
Custom method
Sets the read cursor in a channel.
See native api: channels.mark
Sets the read cursor in a channel by a channel name.
Custom method
Sets the read cursor in a channel by a channel name and the latest message by channel name.
Custom method
Renames a channel.
See native api: channels.rename
Renames a channel by a channel name.
Custom method
Retrieve a thread of messages posted to a channel
See native api: channels.replies
Retrieve a thread of messages posted to a channel by a channel name.
Custom method
Retrieve a thread of from the last message starting with a text and posted to a channel by a channel name.
Custom method
Sets the purpose for a channel. See native api: channels.setPurpose
Sets the purpose for a channel by a channel name.
Custom method
Sets the topic for a channel.
See native api: channels.setTopic
Sets the topic for a channel by a channel name.
Custom method
Unarchives a channel.
See native api: channels.unarchive
Unarchives a channel by a channel name.
Custom method
Archives a group.
See native api: groups.archive
Archives a group by a group name.
Custom method
Creates a group.
See native api: groups.create
Fetches history of messages and events from a group.
See native api: groups.history
Fetches history of messages and events from a group by its name.
Custom method
Fetches last message of a group
Custom method
Fetches last message of a group by its name.
Custom method
Get timestamp of last message of a group
Custom method
Get timestamp of last message of a group by group name
Custom method
Fetches last message starting by a text.
Custom method
Fetches last message starting by a text by a group name.
Custom method
Get timestamp of last message of a group by group name.
Custom method
Gets information about a group.
See native api: groups.info
Invites a user to a group.
See native api: groups.invite
Invites a user from a group by group name.
Custom method
Invites a user from a group by group name.
Custom method
Invites a user by user name from a group by group name.
Custom method
Joins a group, creating it if needed.
See native api: groups.join
Removes a user from a group.
See native api: groups.kick
Removes a user from a group by group name.
Custom method
Removes a user by user name from a group.
Custom method
Removes a user by user name from a group by group name.
Custom method
Leaves a group.
See native api: groups.leave
Lists all groups in a Slack team.
See native api: groups.list
Return a group object from a given name.
Custom method
Return an id from a given group name.
Custom method
Sets the read cursor in a group.
See native api: groups.mark
Sets the read cursor in a group by a group name.
Custom method
Sets the read cursor in a group by a group name and the latest message by group name.
Custom method
Renames a group.
See native api: groups.rename
Renames a group by a group name.
Custom method
Retrieve a thread of messages posted to a group
See native api: groups.replies
Retrieve a thread of messages posted to a group by a group name.
Custom method
Retrieve a thread of from the last message starting with a text and posted to a group by a group name.
Custom method
Sets the purpose for a group. See native api: groups.setPurpose
Sets the purpose for a group by a group name.
Custom method
Sets the topic for a group.
See native api: groups.setTopic
Sets the topic for a group by a group name.
Custom method
Unarchives a group.
See native api: groups.unarchive
Unarchives a group by a group name.
Custom method
Deletes a message.
See native api: chat.delete
Deletes a message by channel name.
Custom method
Deletes last message of channel by channel name.
Custom method
Deletesthe last message starting with a text by channel name
Custom method
Share a me message into a channel.
See native api: chat.meMessage
Share a me message into a channel by channel name.
Custom method
Share a me message into a channel by group name.
Custom method
Sends an ephemeral message to a user in a channel. See native api: chat.postEphemeral
Sends an ephemeral message to a user name in a channel.
Custom method
Sends an ephemeral message to a user name in a channel by its name.
Custom method
Sends a message to a channel.
See native api: chat.postMessage
Provide custom unfurl behavior for user-posted URLs
See native api: chat.unfurl
Provide custom unfurl behavior for user-posted URLs by channel name
Custom method
Provide custom unfurl behavior for user-posted URLs by channel name for last message starting by a text
Custom method
Updates a message.
See native api: chat.update
Updates a message by channel name
Custom method
Updates a message by channel name
Custom method
Updates last message of a channel by channel name
Custom method
Lists all users in a Slack team. See native api: users.list
Get a user by user name.
Custom method
Get user id by user name.
Custom method
Retrieves a user's profile information.
See native api: users.profile.get
Set the profile information for a user.
See native api: users.profile.set
Build the url for the request.
Custom method
Post a request to the slack API.
Custom method
Handle error globally.
Custom method