Skip to content

Get realtime events from Twitch Pub/Sub and Streamlabs SocketIO and pub it to MQTT for a easier use

License

Notifications You must be signed in to change notification settings

KraccoonTwitch/twitch_mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitch MQTT

Get realtime events from Twitch Pub/Sub and Streamlabs SocketIO and pub it to MQTT for a easier use

Diagram showing the link between the APIs and the MQTT server

Requirements

1. You need to install a MQTT broker on the same server that will run this scripts.

I used Mosquitto

2. Create a python virtenv and run pip install -r requirements.txt

3. You have to add several envirnement variables:

  • TWITCH_NAME: your twitch username
  • TWITCH_ID: your twitch id (only needed for the "twitch_pubsub" script)
  • TWITCH_TOKEN: twitch token with access of this scopes: channel:read:redemptions+bits:read+channel_subscriptions (only needed for the "twitch_pubsub" script)
  • SLABS_SOCKET_TOKEN: streamlabs socket token (only needed for the "streamlans_socketio" script)

Format of MQTT messages

/{streamernanme}/bits Topic

{
    "amount": 0,
    "username": "name",
    "message": "message"
}

username is None for anonymous cheer

/{streamernanme}/channelpoints Topic

{
    "reward_id": 0,
    "username": "name",
    "message": "message"
}

/{streamernanme}/sub Topic

{
    "tier": 1,
    "username": "name",
    "recipient_name": "name",
    "message": "message"
}

recipient_name if different of username ifthis is a gift

username is None for anonymous gift sub

/{streamernanme}/donation Topic

{
    "amount": 1,
    "username": "name",
    "currency": "EUR"
}

About

Get realtime events from Twitch Pub/Sub and Streamlabs SocketIO and pub it to MQTT for a easier use

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages