getUserProfile Documentation
Purpose
The node is designed to retrieve user profile information from a Slack workspace based on a specified user ID. This integration allows users to access and manipulate user data efficiently within the context of the broader Vantage platform, enabling enhanced analytics and user management capabilities.
Settings
The following settings are integral to the node.
1. inputs.userId
- Input Type: String
- Description: This setting accepts a user ID that corresponds to a specific user within the Slack workspace. When calling the node, this value determines which user profile is retrieved. If this input is provided, it takes precedence over the
config.userIdsetting during the execution of the logic. - Default Value:
undefined(if not provided, the function will attempt to use the config value).
2. config.userId
- Input Type: String
- Description: This setting is a fallback for the user ID in case it is not provided in the
inputs. It serves to still allow function execution without explicitly passing the user ID in the inputs. This is especially useful in scenarios where a default user is often queried. - Default Value:
undefined(if not set in the configuration, the function requires an input value).
3. context
- Input Type: Object
- Description: The context object encompasses contextual data related to the execution environment. This can include user authentication, session data, and other relevant information that may be utilized when establishing a connection to external services like Slack.
- Default Value:
undefined(this is usually passed automatically based on the execution context of the logic).
4. Error Handling
- Input Type: None
- Description: If an error occurs during the execution of the Slack integration or when attempting to retrieve the user profile, the function will return an error message. This is handled within the
try-catchblock and alerts the user of potential integration malfunctions. - Default Value: N/A (the error message is dynamically created based on the caught exception).
How It Works
-
Connection Initialization: The function begins by executing the integration connection to establish a connection to Slack, using the provided
context. This effectively initializes the necessary credentials and session for interacting with the Slack API. -
User Profile Retrieval: After establishing the connection, the function attempts to fetch the user profile by calling the
getUserProfilemethod from the integration object, passing in the identified user ID (inputs.userIdorconfig.userId). -
Error Management: In case of an error during this process, the function catches that error and returns a structured object containing an error message. This prevents crashing and provides feedback for debugging.
-
Return Output: Upon successful retrieval, the user profile data is returned in an object under the key
output1, making it accessible for further processing or display within the Vantage platform.
Expected Data
The node expects specific data to execute successfully:
- A valid user ID that exists in the Slack workspace.
- A valid context that provides the necessary credentials and session information for the Slack integration.
Use Cases & Examples
Use Case 1: User Management in a Team Dashboard
A project management team may want to display user profiles on a dashboard, allowing team leads to see specific details about team members, such as their names, roles, and contact information directly from Slack.
Use Case 2: Integrating Slack User Data into Employee Performance Reviews
An HR team can leverage the node to pull user data from Slack for employee performance review sessions, helping managers to make informed assessments based on user interactions and feedback.
Configuration Example
To configure the node for retrieving user data for a team dashboard, the configuration data might look as follows:
{
"inputs": {
"userId": "U123456789"
},
"config": {
"userId": "U987654321" // This acts as a fallback
},
"context": {
"userToken": "xoxb-1234567890-0987654321-ABCDEFGHIJK"
}
}Explanation
In this configuration:
inputs.userId: Specifies the user whose profile needs to be fetched from Slack. Here, the IDU123456789corresponds to a particular user.config.userId: This is a secondary user ID that would be used ifinputs.userIdwere absent; in this case, it would fetch details for another user,U987654321.context: Contains an authentication token necessary for connecting to the Slack API, which is essential for executing the node.
This configuration allows the dashboard to dynamically pull user data from Slack, enabling real-time updates and improved team visibility.