slack-webhooks-handler
Version:
Manage incoming webhooks to send messages to Slack
18 lines (14 loc) • 435 B
JavaScript
export const getAuthorDetails = author => {
const { login, html_url, avatar_url } = author;
return {
author_name: login,
author_link: html_url,
author_icon: avatar_url
};
};
export const getEventFromHeaders = (headers = {}) => {
if (!Object.keys(headers).includes('x-github-event')) {
throw new Error('Event is not present in headers');
}
return headers['x-github-event'];
};