Members
_default
This schema represents the data you receive from Slack when a User uses a slash command.
- Source:
_default
A Schema of the User class.
- Source:
- See:
-
- {User}
_default
A Winston logger which logs to multiple transports based off of the log level. File logs are separated into info and error and logged in a JSON format, whereas console logs depend on the NODE_ENV and provide a simplified view of each log.
- Source:
- See:
(constant) fsReqLogger
Logs requests to the file system. This uses daily log rotation.
- Source:
fsReqLogger
Logs requests to the console.
- Source:
(constant) List :List
A list of Tasks.
Type:
- Source:
(constant) LoginInput :LoginInput
Input for user login.
Type:
- Source:
(constant) NewUserRegistration
NewUserRegistration: {
description: Contains arguments for associating a Zevere user to his account on a chat platform
username:
type: string
description: ID of the Zevere user account
chatUserId:
type: string
description: Unique identifier of the user on the chat platform
}
Example:
{
"username": "string",
"chatUserId": "string"
}
(constant) Options
A type representing the Options object sent from Slack.
- Source:
- See:
SlackClient
Tests if you are able to access the API.
- Source:
(constant) Task :Task
A task item.
Type:
- Source:
(constant) TaskInput :TaskInput
Input model for creating a new task.
Type:
- Source:
(constant) User :User
A Zevere user account.
Type:
- Source:
(constant) UserProfile
UserProfile: {
description: Profile of a Zevere user
id:
type: string
description: User ID
firstName:
type: string
description: User first name
lastName:
type: string
description: User last name
joinedAt:
type: string($date-time)
description: The date account was created in UTC
}
(constant) UserRegistration
UserRegistration: {
description: Contains information of a user and the bot connected to him on a specific chat platform
platform:
type: string
description: Name of the chat platform
botId:
type: string
description: Unique identifier of the bot that registered that user
chatUserId:
type: string
description: Unique identifier of the user on that chat platform
}
(constant) UserRegistrationsResponse
UserRegistrationsResponse: {
description: Contains a list of associations of a Zevere account with chat platforms
username:
type: string
description: ID of the Zevere user account
registrations: [
type: UserRegistration
description: List of user registrations
minLength: 1
uniqueItems: false
]
}
(constant) VividError
Error: {
description: Represents an operation error
code:
type: string
description: Machine-readable error code
message:
type: string
description: Human-readable error message
hint:
type: string
description: A hint to the user for correcting the error
}
- Source:
Methods
apiRouter() → {Router}
Router to handle API routes. Has nested routers for the routes that branch off of it.
- Source:
Returns:
- Type
- Router
buildServer() → {Express}
Assigns middleware to an express server and returns it.
- Source:
Returns:
- Type
- Express
(async) confirmListDeletion(web, responseUrl) → {Promise.<any>}
Sends a message to confirm that a list has been deleted.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
responseUrl |
string | A response URL given from Slack which you may use to reply back to within 5 to 30 minutes. |
Returns:
- Type
- Promise.<any>
(async) createAccount(zevereId, slackId)
Attempts to save a link a Zevere account to a Slack account.
Parameters:
Name | Type | Description |
---|---|---|
zevereId |
string | The ID of a Zevere account. |
slackId |
string | The ID of a Slack account. |
Throws:
Error when there is an issue creating the document in the database.
(async) createList(web, text, triggerId) → {Promise.<WebAPICallResult>}
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | |
text |
string | |
triggerId |
string |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) createTask(web, text, triggerId) → {Promise.<WebAPICallResult>}
Shows a Dialog for task creation.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | |
text |
string | |
triggerId |
string |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) dbconnection() → {mongoose.Connection}
This function creates a connection to a MongoDB and loads the schemas for mongoose.
- Source:
Returns:
- Type
- mongoose.Connection
(async) deleteMessage(web, responseUrl) → {Promise.<any>}
Deletes a message using the response url.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
responseUrl |
string | A response URL given from Slack which you may use to reply back to within 5 to 30 minutes. |
- Source:
Returns:
- Type
- Promise.<any>
(async) getUserProfileByUsername(zevereUsername) → {Promise.<UserProfile>}
Gets a User's profile based off of their Zevere Username. Helpful for retrieving their name and the date they joined.
Parameters:
Name | Type | Description |
---|---|---|
zevereUsername |
string | The User's Zevere username. |
- Source:
Returns:
A promise containing the User's profile.
- Type
- Promise.<UserProfile>
(async) getUserRegistrationsByUsername(username)
Get registrations for a Zevere user.
[GET] /api/v1/user-registrations/{username}
Parameters:
Name | Type | Description |
---|---|---|
username |
The username of the Zevere User |
Throws:
When there are no registrations found or if the ID is invalid.
(async) handleInteractiveRequest(req, res, next)
This endpoint is used by Slack when using interactive components.
Parameters:
Name | Type | Description |
---|---|---|
req |
Request | |
res |
Response | |
next |
NextFunction |
- Source:
- See:
inspect(obj) → {string}
Makes objects more readable from logs or CLI.
Handles circular dependencies.
Note: This should only be used for debugging.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Any object. |
- Source:
Returns:
A representation of that object in a prettified string.
- Type
- string
(async) loginPrompt(web, userId, url) → {Promise.<WebAPICallResult>}
Provides a Login button to the user.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
userId |
string | The Slack ID or Slack username of whom to send the message to. |
url |
string | The URL that you wish to redirect a user to after logging in. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) messageGeneralChat(web, message) → {Promise.<WebAPICallResult>}
Sends the supplied message to the #General channel.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack Web Client. |
message |
string | The message you wish to send to #General. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) messageUser(web, userId, message) → {Promise.<WebAPICallResult>}
Sends a direct message to a user.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack Web Client. |
userId |
string | The Slack ID or Slack username of whom the message should be sent to. |
message |
string | The message you wish to send to the aforementioned user. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) messageUserEphemeral(web, userId, channelId, message) → {Promise.<WebAPICallResult>}
Sends an ephemeral message to the user.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack Web Client. |
userId |
string | The Slack ID or Slack username of whom the message should be sent to. |
channelId |
string | The ID of the channel you wish to send the message to. |
message |
string | The message you wish to send to the aforementioned user. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
prettyJson(obj) → {string}
Makes objects more readable from logs or CLI.
Note: This should only be used for logging.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | Any object. |
- Source:
Returns:
A representation of that object in a prettified JSON string.
- Type
- string
(async) promptLogin(req, res, next)
Prompts the user with a message to login to Zevere if they have not connected their account yet.
Parameters:
Name | Type | Description |
---|---|---|
req |
Request | |
res |
Response | |
next |
NextFunction |
Returns:
(async) registerUser(zevereId, slackId) → {Promise.<boolean>}
Attempts to register a Zevere account with a Slack account.
Parameters:
Name | Type | Description |
---|---|---|
zevereId |
string | The ID of a Zevere account. |
slackId |
string | The ID of a Slack account. |
Returns:
A promise containing true if the user is registered successfully, or false if they were already registered before.
- Type
- Promise.<boolean>
(async) registerUser(zevereUsername, slackId)
Register a Slack user with their Zevere account.
[POST] /api/v1/user-registrations
Parameters:
Name | Type | Description |
---|---|---|
zevereUsername |
The Username of the user's Zevere account |
|
slackId |
The ID of the user in Slack |
resolveLogDirectory(dirname) → {string}
Determines the directory to place the logs in. Gives precedence to an APP_LOGS environment variable. If it does not exist, the logs will be placed relative to the dist.
Parameters:
Name | Type | Description |
---|---|---|
dirname |
string | The name of the log directory. |
- Source:
Returns:
A full path to the logging directory.
- Type
- string
(async) showList(web, userId, channelId, listId) → {Promise}
Shows the list details to a user.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
userId |
string | The Slack ID or Slack username of whom to send the message to. |
channelId |
string | The ID of the channel you wish to send the message to. |
listId |
string | The ID of the List that the task belongs to. |
- Source:
Returns:
Awaitable.
- Type
- Promise
(async) showListsForDeletion(web, userId, channelId) → {Promise.<WebAPICallResult>}
Displays a select menu of the user's lists so that the user may choose to delete one.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
userId |
string | The Slack ID or Slack username of whom to send the message to. |
channelId |
string | The ID of the channel you wish to send the message to. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) showListsForSelection(web, userId, channelId) → {Promise.<WebAPICallResult>}
Displays a select menu of the user's lists so they may view one.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
userId |
string | The Slack ID or Slack username of whom to send the message to. |
channelId |
string | The ID of the channel you wish to send the message to. |
- Source:
Returns:
- Type
- Promise.<WebAPICallResult>
(async) showTask(web, userId, channelId, listId, taskId) → {Promise}
Displays a message of a User's task, as well as the functionality to delete it.
Parameters:
Name | Type | Description |
---|---|---|
web |
WebClient | The instance of the Slack WebClient. |
userId |
string | The Slack ID or Slack username of whom to send the message to. |
channelId |
string | The ID of the channel you wish to send the message to. |
listId |
string | The ID of the List that the task belongs to. |
taskId |
string | The ID of the task that you wish to display. |
- Source:
Returns:
- Type
- Promise
throwIfGraphqlErrorPresent(axiosResponse)
This function checks an AxiosResponse for an Errors array provided by GraphQL. If found, this function will throw.
Parameters:
Name | Type | Description |
---|---|---|
axiosResponse |
AxiosResponse |
- Source:
(async) unregisterUser(slackId) → {Promise.<boolean>}
Attempts to unregister a Zevere account from a Slack account.
Parameters:
Name | Type | Description |
---|---|---|
slackId |
string | The ID of the user's Slack account. |
Returns:
A promise containing true if the user was successfully unregistered, or false if they were already unregistered.
- Type
- Promise.<boolean>
(async) unregisterUserByUsername(username)
Unregister a Zevere user from Slack.
[DELETE] /api/v1/user-registrations/{username}
Parameters:
Name | Type | Description |
---|---|---|
username |
The username of the Zevere User |
(async) userIsRegistered(slackId) → {Promise.<boolean>}
Checks if user is registered on Vivid by scouring for a registration with Slack as well as checking the database.
Parameters:
Name | Type | Description |
---|---|---|
slackId |
string | The ID of a Slack account. |
Returns:
A promise containing true if the user is registered with Slack, false if not.
- Type
- Promise.<boolean>
(async) validateSlack()
Validate that requests are coming from Slack using the Slack Signing Secret.