{"id":15293491,"url":"https://github.com/iniva/slack-webhooks-handler","last_synced_at":"2025-10-07T06:30:49.495Z","repository":{"id":46939163,"uuid":"154746536","full_name":"iniva/slack-webhooks-handler","owner":"iniva","description":"Manage incoming webhooks to send messages to Slack","archived":true,"fork":false,"pushed_at":"2023-01-03T17:34:51.000Z","size":677,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-04T06:22:34.759Z","etag":null,"topics":["github","github-webhooks","slack","slack-webhook","webhooks"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iniva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-25T22:44:13.000Z","updated_at":"2023-01-07T08:42:48.000Z","dependencies_parsed_at":"2023-02-01T08:16:29.002Z","dependency_job_id":null,"html_url":"https://github.com/iniva/slack-webhooks-handler","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fslack-webhooks-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fslack-webhooks-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fslack-webhooks-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iniva%2Fslack-webhooks-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iniva","download_url":"https://codeload.github.com/iniva/slack-webhooks-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219877371,"owners_count":16554881,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github","github-webhooks","slack","slack-webhook","webhooks"],"created_at":"2024-09-30T16:48:57.004Z","updated_at":"2025-10-07T06:30:44.173Z","avatar_url":"https://github.com/iniva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/iniva/slack-webhooks-handler.svg?branch=master)](https://travis-ci.org/iniva/slack-webhooks-handler)\n[![Coverage Status](https://coveralls.io/repos/github/iniva/slack-webhooks-handler/badge.svg?branch=master)](https://coveralls.io/github/iniva/slack-webhooks-handler?branch=master)\n\n# Slack Webhooks Handler \u003c!-- omit in toc --\u003e\nManage incoming webhooks to send messages to Slack\n\n- [Installation](#installation)\n- [Options](#options)\n- [Usage](#usage)\n  - [Available Dispatcher Methods](#available-dispatcher-methods)\n- [Payload docs](#payload-docs)\n\n## Installation\n```\n# npm\nnpm install slack-webhooks-handler\n\n# yarn\nyarn add slack-webhooks-handler\n```\n\n## Options\n- **url**(*required*): Your Slack custom integration (*Incoming Webhook*) URL\n- **botName**(*optional*): The name of the bot that will appear when sending messages. Do this if you want/need to override the one you set on your custom integration.\n\n```javascript\n// options object\n{\n    url: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX',\n    botName: 'MyAPP-CI'\n}\n```\n\n## Usage\n\u003e All you need to do is prepare a POST endpoint in your API that will be used when configuring the webhook in your preferred version control hosting (Github, Gitlab, Bitbucket, etc.)\n\nAt the moment you have the main dispatcher (**Dispatcher**) and a **factory** function.\n\nYou can rely on the *factory* function (currently only supports Github's *release* and *issues* events, more on the way...), or you can use the dispatcher alone to send a simple message (just text) or a custom one following the [attachments structure](https://api.slack.com/docs/message-attachments#attachment_structure)\n```javascript\nconst { Dispatcher, factory } = require('slack-webhooks-handler')\n\nconst dispatcher = new Dispatcher(options);\nconst hook = factory('github');\nconst { attachments } = hook(payload);\n\ndispatcher.withAttachments(attachments);\n\n(async () =\u003e {\n    try {\n        await dispatcher.send();\n    }\n    catch (error) {\n        console.log(error);\n    }\n})();\n```\n\n### Available Dispatcher Methods\n* **setMessage**: Use it when you intend to send a simple message.\n* **setChannel**: Even if you set your Slack Webhook to a specific channel, you can use this method to change the target channel for specific messages.\n* **withAttachments**: Use it to set [attachments](https://api.slack.com/docs/message-attachments#attachment_structure) for messages.\n* **preparePayload**: Use it to preview the payload you will send to Slack.\n\n## Payload docs\nFor more info about event payloads take a look at:\n- **Github**: [Event Types \u0026 Payloads](https://developer.github.com/v3/activity/events/types)\n- **Bitbucket**: [Event payload](https://confluence.atlassian.com/bitbucketserver/event-payload-938025882.html)\n- **Gitlab**: [Events](https://docs.gitlab.com/ee/user/project/integrations/webhooks.html#events)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finiva%2Fslack-webhooks-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finiva%2Fslack-webhooks-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finiva%2Fslack-webhooks-handler/lists"}