Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/doarakko/release-party
Trigger the Slack message to light up the SwitchBot Color Bulb.
https://github.com/doarakko/release-party
deno slack slack-platform switchbot
Last synced: 9 days ago
JSON representation
Trigger the Slack message to light up the SwitchBot Color Bulb.
- Host: GitHub
- URL: https://github.com/doarakko/release-party
- Owner: Doarakko
- License: mit
- Created: 2023-11-11T13:02:55.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-10T08:53:28.000Z (about 1 year ago)
- Last Synced: 2024-05-01T16:38:09.249Z (10 months ago)
- Topics: deno, slack, slack-platform, switchbot
- Language: TypeScript
- Homepage:
- Size: 77.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# release-party
Trigger the Slack message to light up the SwitchBot Color Bulb.
## Requirements
- Slack with paid plan
- Slack CLI
- [SwitchBot Color Bulb](https://www.switch-bot.com/products/switchbot-color-bulb)
- SwitchBot API Key
- [SwitchBot Help Center: How to obtain a Token?](https://support.switch-bot.com/hc/en-us/articles/12822710195351-How-to-obtain-a-Token-)
- SwitchBot device id## Usage
1. Setup
```sh
git clone https://github.com/Doarakko/release-party
cd release-party
```2. Enter your release message and channel ids to `triggers/trigger.ts`
```ts
event: {
event_type: TriggerEventTypes.MessagePosted,
filter: {
version: 1.0,
root: {
operator: "AND",
inputs: [
{
// triggers only bot messages
statement: "{{data.user_id}} == null",
},
{
operator: "OR",
inputs: [
{
statement: "{{data.text}} CONTAINS 'deploy'",
},
{
statement: "{{data.text}} CONTAINS 'test'",
},
],
},
],
},
},
channel_ids: [_test_channel_id],
},
```3. Deploy
```sh
slack deploy
slack trigger create# SwitchBot
slack env add SWITCHBOT_API_KEY
slack env add SWITCHBOT_DEVICE_ID
```When updating the trigger, run the following command.
```sh
slack trigger update --trigger-id=yyyy
```## Hints
### Run on local
1. Enter your environmental variables to `.env`
```sh
cp .env.example .env
```2. Run
```sh
slack run
slack trigger create
```### Check using Slack incoming webhook
```sh
curl -X POST -H 'Content-type: application/json' --data '{"text":"test"}' "https://hooks.slack.com/services/xxxx/yyyy/zzzz"
```### SwitchBot: get device id
```sh
curl "https://api.switch-bot.com/v1.0/devices" -H "Authorization: "
```### SwitchBot: check if you can turn on the light via API
```sh
# on
curl -X POST -H 'Content-type: application/json' --data '{"command": "turnOn"}' "https://api.switch-bot.com/v1.0/devices//commands" -H "Authorization: "# off
curl -X POST -H 'Content-type: application/json' --data '{"command": "turnOff"}' "https://api.switch-bot.com/v1.0/devices//commands" -H "Authorization: "
```