Этой публикации нет на вашем языке. Вам доступны следующие варианты:
We’ve added a number of exciting and often-requested features to the Twitch API in the past three months. There’s something for everyone — ease of some developer pain points, previously unavailable Twitch functionality, and a new mechanism to ingest subscription data.
Imagine you built a new Extension — it’s fun, entertaining, and it leverages Bits as a monetization mechanism. It’s getting traction among broadcasters, but its popularity is also its downfall — your Extension Backend Service experiences a temporary outage due to high load. In this scenario, it is difficult to retroactively fulfill the benefits to viewers who have already used Bits via the Extension.
The Bits Transaction API is a new way to retrieve a list of historical transactions that have occurred within your Extension across all of the channels where it was installed. The API is comprised of a single endpoint and a corresponding Webhooks topic; you can use the latter to be notified of transactions as they are processed.
By using this API, you can “replay” the missing transactions and fulfill the relevant benefits to viewers who were affected by the outage.
Moderators play a crucial role in making sure a channel is a welcoming place. To bridge the gap between the tooling at their disposal and what’s available programmatically, we recently released the first iteration of the Moderation API.
You can now retrieve the list of channel moderators, determine a user’s moderator status, and get notified when a broadcaster adds or removes a moderator. Similar functionality is offered with respect to banned users, as well as those on a timeout. Finally, an additional endpoint allows you to check the compliance of a string against the channel’s AutoMod settings.
This API is particularly useful if you’re building an Extension that facilitates user-generated content. For example, if your overlay Extension displays alerts based on viewer-submitted text, it would be a good pattern to first check if the user should be able to use the Extension at all (e.g., if they are banned in chat or not) and second whether their submission is acceptable with regards to the channel’s AutoMod.
Last year, we’ve added the ability to retrieve the list of broadcaster’s subscribers to the Helix namespace. To further flesh out this functionality, we recently released an additional subscriptions-specific endpoint which in turn powers the relevant Webhooks topic.
By subscribing to this new topic, you can immediately get notified when viewers subscribe, unsubscribe, and share their subscription status with the broadcaster in chat. You can also determine the subscription tier, as well as whether the subscription was a gift or not.
Subscriptions are a powerful signal that you can use as a trigger in your integrations. For example, you could avoid aggressively polling the API to determine whether a viewer has access to functionality available only to channel subscribers.
We’re continuing to invest in the Twitch API and are looking forward to seeing you at TwitchCon 2019 in San Diego.