service/apiwrappers.js
const { SlackError } = require("./errors");
async function userInfo(client, userId) {
const response = await client.users.info({ user: userId });
if (response.ok) {
return response.user;
}
throw new SlackError(
"users.info",
response.error,
`Something went wrong while sending recognition. When retreiving user information from Slack, the API responded with the following error: ${response.message} \n Recognition has not been sent.`,
);
}
module.exports = {
userInfo,
};