Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links in Websockets.md are dead #9

Open
francislavoie opened this issue Oct 6, 2024 · 11 comments
Open

Links in Websockets.md are dead #9

francislavoie opened this issue Oct 6, 2024 · 11 comments

Comments

@francislavoie
Copy link

See https://github.com/StreamElements/api-docs/blob/main/docs/Websockets.md, the link at the top, and the links in the socket.on comments are all broken.

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

Unfortunately, this documentation is outdated and completely abandoned.
A new documentation try can be seen in https://docs.streamelements.com. It doesn't have the API nor socket.io instructions so far, but it is more open for suggestions and improvements (it accepts issues and pull requests).

The events can be found here:
https://docs.streamelements.com/overlays/custom-widget-events

@francislavoie
Copy link
Author

francislavoie commented Oct 8, 2024

Ah, you mean https://docs.streamelements.com/websockets ?

Shouldn't the old one be taken offline then? That's all I could find from some google searches.

I'm not looking to write an overlay/widget. What I'm looking for is documentation on writing a tool which can get real-time events from a channel's tips/bits (to write a Discord bot which writes information about the event to a particular channel, but that part isn't relevant to this)

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

Ah, you mean https://docs.streamelements.com/websockets ?

Shouldn't the old one be taken offline then? That's all I could find from some google searches.

I'm not looking to write an overlay/widget. What I'm looking for is documentation on writing a tool which can get real-time events from a channel's tips/bits (to write a Discord bot which writes information about the event to a particular channel, but that part isn't relevant to this)

Well, you can use Astro Websockets or Socket.io. They are different implementations. Astro Websockets is still in development, whereas the socket.io version shouldn't receive anything new probably (it still uses version 2.x of socket.io).
Probably the dev page will be removed (or replaced) once the documentation on the docs page is finished (the docs page doesn't have any information about API endpoints, for example).

@francislavoie
Copy link
Author

In that case, could you please document what the topics look like for tips/bits/subs? I'd much rather use the new thing rather than the old thing (plus I'd rather not depend on socket.io)

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

According to the documentation, channel.activities should be enough. Then you can filter it checking data.type.

@francislavoie
Copy link
Author

The list of types aren't documented though.

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

Yeah, Astro websockets development is still in progress, so the documentation should lack some info as well. But you can try something like follow, subscriber, tip, cheer, raid and check if they work for you.

@francislavoie
Copy link
Author

I don't see how I could test without receiving real events though. I can't reasonably send tips every time I need to test. If the documentation had examples, I could simply write mocks to test the other end of my code.

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

Yeah, I agree with you about the examples and the lack of info on the documentation. Just to be clear, I'm not part of the staff, I'm just a user like you, ok?!

Well, as regards to test, you have some options, the easiest one is going to your overlays (https://streamelements.com/dashboard/overlays), create an empty one (or editing an existent one) and Emulate the event you want. Just remember to keep the option "Preview LIVE on stream" checked. Once you emulate it, it will appear for you on the websockets connection.

I can try to look for a way to trigger test events on Astro Websockets, if I find anything I will send it here.

@c4ldas
Copy link
Contributor

c4ldas commented Oct 8, 2024

To trigger test events on Astro (sub, follow, tip, etc), you can use the info below:

Request type: POST

URL: https://api.streamelements.com/kappa/v2/activities/ACCOUNT_ID/mock

Headers:
Accept: application/json
Content-Type: application/json
Authorization: Bearer JWT_TOKEN

Body:
(I tried to put all possible values, but some of them are not needed for some types. I.e.: amount, tier, gifted, message and sender are not needed for follower events for obvious reasons)

{
  "provider": "twitch",
  "isMock": true,
  "type": "subscriber",
  "data": {
    "username": "usertest",
    "amount": 1,
    "tier": "3000"              // 1000, 2000, 3000 or prime (Tier 1, 2 and 3, respectively)
    "message": "Test message",  // User message from resub or cheers
    "gifted": true,             // Only when using for gifted subscription
    "sender": "johnny"          // only when using for gifted subscription
    "avatar": "https://a.png"   // Optional, user avatar
    "displayName": "userTest"   // Optional, displayed username
  }
}

type must be one of below:
follow, tip, sponsor, superchat, host, raid, subscriber, cheer, redemption, merch, fan, supporter, follower, stars, share, videolike, sparks, elixir, purchase, communityGiftPurchase, charityCampaignDonation, giveaway.

Let me know if you need any help ;)

@francislavoie
Copy link
Author

Awesome, thanks! I'll play around with that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants