EVENTS API! - Chaturbate- Overlay

izbunz

New Member
Hey everyone!

I’ve recently discovered a Events API which is given to my via my log in > settings > Events API AS JSON.

Can someone help with the code how to make it work? All I’m wanting is a pop up saying “{user} has joined fanclub” - Black text, Green background.

If anyone knows anyone who could do this please let me know
 

strabbit

New Member
Old thread, but I was looking for an answer myself and put this together:


On the
JavaScript:
const cbe = new ChaturbateEvents( 'USERNAME', 'TOKEN' );
line, you need to replace username and token with your username and token. The token is found in the URL that you can get from the bottom of the chat page.

The example just logs to the console when a tip comes in, but you could instead display something on the screen as a result.

It should be said that whatever you create with this should probably be a local html file, and not hosted on the web, as anyone with your token can subscribe to any of the events provided (including private messages).

A full list of events that can be subscribed to is the same as the method types listed here: https://chaturbate.com/apps/api/docs/index.html#method-types

For example, if you wanted to do something when somebody joins your fanclub instead of when somebody tips (as in the example), you'd subscribe to the fanclubJoin event:

JavaScript:
cbe.addEventListener( 'fanclubJoin', ( { user } ) => {
     // Code here that uses the `user` object
} );

The callback receives the objects documented in each method within a containing object, and can be destructured as shown int he examples.
 
Top