Home Assistant Twitch Server written on node.
This server forwards Twitch events to the home assistant server to trigger custom actions.
- Support for Twitch oauth and api tokens.
- Support for self signed certificates on your home assistant server.
- Proxy Twitch events from EventSub to your home assistant server.
- node: https://nodejs.org/
- yarn: https://yarnpkg.com/
- Twitch dev account: https://dev.twitch.tv/
We are working with the following environment for best support:
- running home assistant server: https://www.home-assistant.io/
- node-red recommended: https://nodered.org/
First you need to checkout the git project.
For a production deployment we highly recommend to work with git tags only.
Then you need to install the project dependencies with yarn:
yarn install
Now you have to setup the .env
file on root with your configuration:
SECRET=
HOME_ASSISTANT_WEBHOOK_URL=
TWITCH_CLIENT_ID=
TWITCH_CLIENT_SECRET=
TWITCH_CLIENT_LOGIN=
LT_SUBDOMAIN=
PROXY_PORT=
PROXY_URL=http://localhost:
As an alternative to the file you could just use environment variables.
To start the proxy server call this command:
yarn dev
We recommend to use pm2
(https://pm2.keymetrics.io/) for server deployments:
yarn start
With the following command you can restart the instance after updating the code:
yarn restart
With the following command you can stop the instance from pm:
yarn stop
With the following command you can delete the instance from pm:
yarn delete
And to make your server running persistently, use following command:
pm2 startup
and to store the current configuration you can use:
pm2 save
-
Enforce env local tunnel id - Implement redemption support: https://dev.twitch.tv/docs/api/reference#update-redemption-status
- Alive-webhook ping to ensure this server is still running
- Auto-fetch tokens
- Implement scope verification
- Implement config to remove unknown webhooks
- Complete readme file
- Implement health check
- Implement status page
- Implement doctor command to support with the setup process
- Use vendor logger
- Clean up files and file structure
- Improve architecture
- Implement JSDoc or TypeScript
- Notification spam protection against outside
- Graceful start and stop support: https://pm2.keymetrics.io/docs/usage/signals-clean-restart/
- Verify security
Initial code was based on: https://github.com/twitchdev/eventsub-webhooks-node-sample
Also thanks a lot to all the developers of node, yarn, home assistant and node-red!