Useful Custom APIs

I’m having a problem with the Sub Age command, its saying someone has been subbed for 2 months when they have been subbed for 9 in a row.

Please PM me the Twitch token and the subscriber’s Twitch name so I can look into it. Thanks!

There was one of these at some point that I saw, however it seems the site has gone down. I’d love to make one of these for fun some day but unfortunately right now I don’t have the time as it’s such an extensive project. If I do end up making one I’ll tag you.

2 Likes

Yea I saw that sadly the site is down. Thanks a lot the command isn’t needed straight away if you ever create the command for fun in a couple of months or a couple of years I’ll be very thankful

I am trying to integrate the latest subscriber name in my HTML5 overlay through Javascript/AJAX and looking for an API to retrieve the latest/newest subscriber rather than a random subscriber any possibility to realize this?

Curious thing is when I try to retrieve the information through javascript/AJAX and set the datatype to any other acceptable type than json it returns nothing in the .done() section. However if I set json as expected datatype it returns the data I need (msg.responseText) however it always triggers the .fail() of the AJAX call.

$.ajax({
  type: "GET",
  url: "https://apis.rtainc.co/twitchbot/randomsub",
  data: {
    "token": "<MY TOKEN>",
  },
  crossDomain: true,
  dataType: "json",
})
  .done( function(msg){
    console.log("done");
    console.log(msg);
  })
  .fail( function(msg){
    console.log("fail");
    console.log(msg);
  });

I’d recommend using Twitch’s API directly for this, which supports CORS requests.

$.get("https://api.twitch.tv/kraken/channels/<CHANNEL>/subscriptions?direction=DESC&limit=1&oauth_token=<TOKEN>").done(function(sub) {
    console.log(data.subscriptions[0].created_at); // "2015-10-14T19:56:06Z"
    console.log(data.subscriptions[0].user.display_name); // "rtainc"
});
1 Like

Yea I have looked into that of course but my problem was the oauth_token that I could not generate myself just for my own HTML overlay. But I am using now the token generated by the link above the main post and it works, so thanks :smiley:

Any idea how long the oauth_token stays valid before I have to change it in my overlay code?

As far as I know, Twitch doesn’t follow oauth2 spec, so the token will stay valid forever. Glad it worked!

1 Like

Is there a custom api to show the current time a command is used. I’d like to use it in a command for taking breaks

Sorry, I don’t quite understand what you mean. Can you explain a bit more?

1 Like

Hello,

I took the code of the Jaden Smith tweet generator (http://jadensmithtweetgenerator.tumblr.com/), and made it into an API ready to use by Nightbot.

I’m hosting it on a free webhost at the moment, so the domain might be seen as untrusted, so I’m sorry about that.

Kind regards,
Freitbot

I just want to let you know that the thing your checking with https://apis.rtainc.co/twitchbot/subbed?token=TOKEN&user=USER is not how long someone has been subscribing to a channel. It will only check how long you have been contiguously subscribed to a channel. So if you disable your subscription for one month it will be reset.

I think that is by design, otherwise a data base would be needed to retain values. Unless I’m mistaken either sub days or months in a row are taken from the Twitch API.

1 Like

Can someone please make a custom api which shows rocket league leaderboards in chat?

Can you make a magic conch shell version of your magic 8 ball? With quotes like “Maybe some day” “No” “Yes” “No~”

One already exists! Will have a post up describing it as soon as I lose my “new user” restrictions on the forum ^^

This would work for your problem:

1 Like

As @Aaron128l stated, you can achieve this with the /random endpoint. Example:

https://api.rtainc.co/twitch/random?choices=Maybe+someday,Neither,I+don't+think+so,Try+asking+again,Yes

As far as I know, Spotify doesn’t expose any “Currently Playing” APIs. Last FM is, at the moment, our only option. Sorry.

1 Like

Thank you @Aaron128l and @rtainc for your awesome replies. This is definitely something I needed. Keep up the good work!

1 Like

Hi all, newby here.
Been searching this corner of the web some and are looking for a sound alert on a chat command.
I tend to forget to switch the stream to the active game window.
I am looking for a way to have a command, say !overlay, trigger a sound to alert me to switch off the overlay.
Any help would be appreciated.

Thanks.

hello,
is possible that link is not working fine?

Because i made command for subscribers, but when someone use it so for examle he is subscriber 8 months but nightbot wrote 2 months…
or for good working i need have activated this for correct working? Nightbot
many thanks for response and sorry for my grammar, this is not my main language