Can I use Twitch API for the following?

Hello! First time here.

I’m thinking about getting into streaming and I’d like to implement pop-up notifications on stream when someone follows/hosts my channel (similar to what http://www.twitchalerts.com/ offers). I would use TwitchAlerts, but the thing is, I want a little more control over how the alerts/notifications are executed on my stream and I also don’t want to be constricted by file-size limitations.

I’m looking to make a C++ application that can execute callback algorithms when someone hosts or follows my channel.

So my questions are:

  1. Is Twitch API what I’m looking for? Can I use it to discover new follower / host events?
    2 a) Is Twitch API directly compatible with C++?
    2 b) I’m reading a lot of descriptions about JavaScript and web-development. Will I have to make some kind of wrapper before I can access Twitch API with C++?
  2. Do any such applications already exist that are freely available to the dev community?

Thanks!
Quezacotl

You can use the API to request followers of a channel. There is no official API for hosts, there might be an unsupported one, but I’m not sure what it is. Alternatively you can also connect to chat with your broadcaster account and listen for messages that tell you about hosts.

To use the Twitch API you need to make HTTPS requests and parse JSON.

1 Like

Thank you for the reply!

Sounds good!

I’m assuming that in order to stay up-to-date with new followers, I will have to send a request on regular intervals? Will I get disconnected/ignored/blocked if I send too many requests in a short amount of time? Any idea what a safe time interval might be?

Sounds good!

I’ve never touched this stuff before. I have no problem doing research and finding my way, but I was wondering if I might get lucky:

  1. Does anyone know of any basic (“getting started”) tutorials for making HTTPS requests using C++? Any good libraries?
  2. Samething with JSON parsing, does anyone know of any good tutorials for use with C++? Are there any good pre-existing readers out there?

Again, thanks for your reply tduva. I can get started!

A quick google for a C++ HTTPS/SSL Client delivers this: http://www.example-code.com/vcpp/ssl_client.asp

You send the request, you get the reply. The reply, as stated, is in JSON. A quick google for JSON parser in C++ leads me to: https://github.com/miloyip/rapidjson

Add in a dash of: https://github.com/justintv/Twitch-API and you should be on your way.

Thank you so much!

Cheers guys

For hosts you can also use: https://tmi.twitch.tv/hosts?include_logins=1&target={user_id}

{user_id} is the _id field which you can retrieve using the /users/ or /channels/ endpoints (for example).

1 Like

Whereas the TMI API linked by Decicus can/will work right now, I’d like to point out that as tduva has said “There is no official API for hosts”

As per: Tmi.twitch.tv API documentation?tmi.twitch.tv API is unsupported/undocumented and might go away or change without any notice.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.