slack-webhooks-handler
Version:
Manage incoming webhooks to send messages to Slack
31 lines (25 loc) • 649 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getEventFromHeaders = exports.getAuthorDetails = void 0;
const getAuthorDetails = author => {
const {
login,
html_url,
avatar_url
} = author;
return {
author_name: login,
author_link: html_url,
author_icon: avatar_url
};
};
exports.getAuthorDetails = getAuthorDetails;
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'];
};
exports.getEventFromHeaders = getEventFromHeaders;