Skip to content

Latest commit

 

History

History
60 lines (49 loc) · 1.55 KB

README.md

File metadata and controls

60 lines (49 loc) · 1.55 KB

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"
}