Slack Developer Kit for Node.js
Go to GitHub

SlackDataStore

Kind: global class

new SlackDataStore(opts)

Param Type Description
opts Object  
[opts.logLevel] string The log level for the logger.
[opts.logger] function Function to use for log calls, takes (logLevel, logString) params.

slackDataStore.logger : function

The logger function attached to this client.

Kind: instance property of [SlackDataStore](#SlackDataStore)

slackDataStore.registerMessageHandler(event, handler)

Sets a handler to save RTM event data to the data-store.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
event string
handler function

slackDataStore.clear()

Clears the data store and re-sets it to the required starting state.

Kind: instance method of [SlackDataStore](#SlackDataStore)

slackDataStore.getUserById(userId) ⇒ Object

Returns the User object matching the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
userId string

slackDataStore.getUserByName(name) ⇒ Object

Returns the User object matching the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
name string

slackDataStore.getUserByEmail(email) ⇒ Object

Returns the User object matching the supplied email.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
email string

slackDataStore.getUserByBotId(botId) ⇒ Object

Returns the User object matching the supplied bot ID.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
botId string

slackDataStore.getChannelById(channelId) ⇒ Object

Returns the Channel object matching the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
channelId

slackDataStore.getChannelByName(name) ⇒ Object

Returns the Channel object matching the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
name

slackDataStore.getGroupById(groupId) ⇒ Object

Returns the Group object matching the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
groupId

slackDataStore.getGroupByName(name) ⇒ Object

Returns the Group object matching the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
name

slackDataStore.getDMById(dmId) ⇒ Object

Returns the DM object matching the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
dmId

slackDataStore.getDMByName(name) ⇒ Object

Returns the DM object between the registered user and the user with the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
name

slackDataStore.getDMByUserId(id) ⇒ Object

Returns the DM object between the registered user and the user with the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
id

slackDataStore.getBotById(botId) ⇒ Object

Returns the bot object matching the supplied id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
botId

slackDataStore.getBotByName(name) ⇒ Object

Returns the bot object matching the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
name string

slackDataStore.getBotByUserId(userId) ⇒ Object

Returns the bot object matching the supplied user ID.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
userId

slackDataStore.getTeamById(name) ⇒ Object

Returns the bot object matching the supplied name.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
name string

slackDataStore.getUnreadCount()

Returns the unread count for all objects: channels, groups etc.

Kind: instance method of [SlackDataStore](#SlackDataStore)

slackDataStore.setChannel(channel)

Stores a channel object in the data store.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
channel Object

slackDataStore.setGroup(group)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
group Object

slackDataStore.setDM(dm)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
dm Object

slackDataStore.setUser(user)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
user Object

slackDataStore.setBot(bot)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
bot Object

slackDataStore.setTeam(team)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
team Object

slackDataStore.upsertChannel(channel)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
channel

slackDataStore.upsertGroup(group)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
group

slackDataStore.upsertDM(dm)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
dm

slackDataStore.upsertUser(user)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
user

slackDataStore.upsertBot(bot)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
bot

slackDataStore.upsertTeam(team)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
team

slackDataStore.upsertChannelGroupOrDMById(id, obj)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
id
obj

slackDataStore.getChannelGroupOrDMById(objId) ⇒ Object

Returns the channel, group or DM object matching the supplied Id.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
objId

slackDataStore.getChannelOrGroupByName(objId) ⇒ Object

Returns the channel or group object matching name, finding by channel, then group then DM.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param
objId

slackDataStore.cacheRtmStart(data)

Caches an rtm.start response to the datastore.

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
data Object

slackDataStore.handleRtmMessage(activeUserId, activeTeamId, messageType, message)

Kind: instance method of [SlackDataStore](#SlackDataStore)

Param Type
activeUserId string
activeTeamId string
messageType string
message Object