moderation - YoYoGames/GMEXT-Twitch GitHub Wiki

Moderation

Functions

These are the functions of this module:



Back To Top

twitch_moderation_check_automod_status

Twitch Endpoint: Check AutoMod Status

This function checks whether AutoMod would flag the specified message for review.

AutoMod is a moderation tool that holds inappropriate or harassing chat messages for moderators to review. Moderators approve or deny the messages that AutoMod flags; only approved messages are released to chat. AutoMod detects misspellings and evasive language automatically. For information about AutoMod, see How to Use AutoMod.

Rate Limits: Rates are limited per channel based on the account type rather than per access token.

Account Type Limit per minute Limit per hour
Normal 5 50
Affiliate 10 100
Partner 30 300

The above limits are in addition to the standard Twitch API rate limits. The rate limit headers in the response represent the Twitch rate limits and not the above limits.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATION_READ.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_check_automod_status(broadcaster_id, data, msg_id, msg_text, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose AutoMod settings and list of blocked terms are used to check the message. This ID must match the user ID in the access token.
data Array The list of messages to check. The list must contain at least one message and may contain up to a maximum of 100 messages.
msg_id String A caller-defined ID used to correlate this message with the same message in the response.
msg_text String The message to check.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of messages and whether Twitch would approve them for chat.
 ├── msg_id String The caller-defined ID passed in the request.
 └── is_permitted Boolean A Boolean value that indicates whether Twitch would approve the message for chat or hold it for moderator review or block it from chat. Is true if Twitch would approve the message; otherwise, false if Twitch would hold the message for moderator review or block it from chat.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_manage_held_automod_messages

Twitch Endpoint: Manage Held AutoMod Messages

This function allows or denies the message that AutoMod flagged for review. For information about AutoMod, see How to Use AutoMod.

To get messages that AutoMod is holding for review, subscribe to the automod-queue.<moderator_id>.<channel_id> topic using PubSub. PubSub sends a notification to your app when AutoMod holds a message for review.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_AUTOMOD.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_manage_held_automod_messages(user_id, msg_id, action, callback_success, callback_failed)
Argument Type Description
user_id String The moderator who is approving or denying the held message. This ID must match the user ID in the access token.
msg_id String The ID of the message to allow or deny.
action String The action to take for the message. Possible values are: "ALLOW", "DENY"
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_automod_settings

Twitch Endpoint: Get AutoMod Settings

This function gets the broadcaster's AutoMod settings. The settings are used to automatically block inappropriate or harassing messages from appearing in the broadcaster's chat room.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_READ_AUTOMOD_SETTINGS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_automod_settings(broadcaster_id, moderator_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose AutoMod settings you want to get.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of AutoMod settings. The list contains a single struct that contains all the AutoMod settings.
 ├── broadcaster_id String The broadcaster's ID.
 ├── moderator_id String The moderator's ID.
 ├── overall_level Real The default AutoMod level for the broadcaster. This field is undefined if the broadcaster has set one or more of the individual settings.
 ├── disability Real The Automod level for discrimination against disability.
 ├── aggression Real The Automod level for hostility involving aggression.
 ├── sexuality_sex_or_gender Real The AutoMod level for discrimination based on sexuality, sex, or gender.
 ├── misogyny Real The Automod level for discrimination against women.
 ├── bullying Real The Automod level for hostility involving name calling or insults.
 ├── swearing Real The Automod level for profanity.
 ├── race_ethnicity_or_religion Real The Automod level for racial discrimination.
 └── sex_based_terms Real The Automod level for sexual content.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_update_automod_settings

Twitch Endpoint: Update AutoMod Settings

This function updates the broadcaster's AutoMod settings. The settings are used to automatically block inappropriate or harassing messages from appearing in the broadcaster's chat room.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_AUTOMOD_SETTINGS.

You must include all the fields that you want set after the operation completes. Typically, you'll call twitch_moderation_get_automod_settings, update the fields you want to change in the sturct, and then pass the struct to this function.

You may set either overall_level or the individual settings like aggression, but not both.

Setting overall_level applies default values to the individual settings. However, setting overall_level to 4 does not necessarily mean that it applies 4 to all the individual settings. Instead, it applies a set of recommended defaults to the rest of the settings. For example, if you set overall_level to 2, Twitch provides some filtering on discrimination and sexual content, but more filtering on hostility.

If overall_level is currently set and you update swearing to 3, overall_level will be set to undefined and all settings other than swearing will be set to 0. The same is true if individual settings are set and you update overall_level to 3 — all the individual settings are updated to reflect the default level.

Note that if you set all the individual settings to values that match what overall_level would have set them to, Twitch changes AutoMod to use the default AutoMod level instead of using the individual settings.

Valid values for all levels are from 0 (no filtering) through 4 (most aggressive filtering). These levels affect how aggressively AutoMod holds back messages for moderators to review before they appear in chat or are denied (not shown).

Field Type Description
aggression Real The Automod level for hostility involving aggression.
bullying Real The Automod level for hostility involving name calling or insults.
disability Real The Automod level for discrimination against disability.
misogyny Real The Automod level for discrimination against women.
overall_level Real The default AutoMod level for the broadcaster.
race_ethnicity_or_religion Real The Automod level for racial discrimination.
sex_based_terms Real The Automod level for sexual content.
sexuality_sex_or_gender Real The AutoMod level for discrimination based on sexuality, sex, or gender.
swearing Real The Automod level for profanity.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_update_automod_settings(broadcaster_id, moderator_id, settings, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose AutoMod settings you want to update.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
settings Struct The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of AutoMod settings. The list contains a single struct that contains all the AutoMod settings.
 ├── broadcaster_id String The broadcaster's ID.
 ├── moderator_id String The moderator's ID.
 ├── overall_level Real The default AutoMod level for the broadcaster. This field is undefined if the broadcaster has set one or more of the individual settings.
 ├── disability Real The Automod level for discrimination against disability.
 ├── aggression Real The Automod level for hostility involving aggression.
 ├── sexuality_sex_or_gender Real The AutoMod level for discrimination based on sexuality, sex, or gender.
 ├── misogyny Real The Automod level for discrimination against women.
 ├── bullying Real The Automod level for hostility involving name calling or insults.
 ├── swearing Real The Automod level for profanity.
 ├── race_ethnicity_or_religion Real The Automod level for racial discrimination.
 └── sex_based_terms Real The Automod level for sexual content.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_banned_users

Twitch Endpoint: Get Banned Users

This function gets all users that the broadcaster banned or put in a timeout.

Note

Requires a user access token that includes the TWITCH_SCOPE_MODERATION_READ or TWITCH_SCOPE_MODERATOR_MANAGE_BANNED_USERS scope.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_banned_users(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose list of banned users you want to get. This ID must match the user ID in the access token.
optionals Struct The optional parameters to be passed into the function:

- user_id : Real or Array of Real : A list of user IDs used to filter the results. To specify more than one ID, pass an array with the ID of each user you want to get. You may specify a maximum of 100 IDs. The returned list includes only those users that were banned or put in a timeout. The list is returned in the same order that you specified the IDs.
- first : Real : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 20.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read more
- before : String : The cursor used to get the previous page of results. The Pagination struct in the response contains the cursor's value. Read more
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of users that were banned or put in a timeout.
 ├── user_id String The ID of the banned user.
 ├── user_login String The banned user's login name.
 ├── user_name String The banned user's display name.
 ├── expires_at String The UTC date and time (in RFC3339 format) of when the timeout expires, or an empty string if the user is permanently banned.
 ├── created_at String The UTC date and time (in RFC3339 format) of when the user was banned.
 ├── reason String The reason the user was banned or put in a timeout if the moderator provided one.
 ├── moderator_id String The ID of the moderator that banned the user or put them in a timeout.
 ├── moderator_login String The moderator's login name.
 └── moderator_name String The moderator's display name.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_ban_user

Twitch Endpoint: Ban User

This function bans a user from participating in the specified broadcaster's chat room or puts them in a timeout.

For information about banning or putting users in a timeout, see Ban a User and Timeout a User.

If the user is currently in a timeout, you can call this endpoint to change the duration of the timeout or ban them altogether. If the user is currently banned, you cannot call this method to put them in a timeout instead.

To remove a ban or end a timeout, see Unban user.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_BANNED_USERS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_ban_user(broadcaster_id, moderator_id, data, user_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose chat room the user is being banned from.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
data Struct Identifies the user and type of ban.
user_id String The ID of the user to ban or put in a timeout.
optionals Struct The optional parameters to be passed into the function:

- duration : Real : To ban a user indefinitely, don't include this field. To put a user in a timeout, include this field and specify the timeout period, in seconds. The minimum timeout is 1 second and the maximum is 1,209,600 seconds (2 weeks). To end a user's timeout early, set this field to 1, or use the twitch_moderation_unban_user endpoint.
- reason : String : The reason the you're banning the user or putting them in a timeout. The text is user defined and is limited to a maximum of 500 characters.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains the user you successfully banned or put in a timeout.
 ├── broadcaster_id String The broadcaster whose chat room the user was banned from chatting in.
 ├── moderator_id String The moderator that banned or put the user in the timeout.
 ├── user_id String The user that was banned or put in a timeout.
 ├── created_at String The UTC date and time (in RFC3339 format) that the ban or timeout was placed.
 └── end_time String The UTC date and time (in RFC3339 format) that the timeout will end. Is undefined if the user was banned instead of being put in a timeout.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_unban_user

Twitch Endpoint: Unban User

This function removes the ban or timeout that was placed on the specified user.

To ban a user, see twitch_moderation_ban_user.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_BANNED_USERS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_unban_user(broadcaster_id, moderator_id, user_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose chat room the user is banned from chatting in.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
user_id String The ID of the user to remove the ban or timeout from.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_unban_requests

Twitch Endpoint: Get Unban Requests

This function gets a list of unban requests for a broadcaster's channel.

Note

Requires a user access token that includes the TWITCH_SCOPE_MODERATOR_READ_UNBAN_REQUESTS or TWITCH_SCOPE_MODERATOR_MANAGE_UNBAN_REQUESTS scope.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_unban_requests(broadcaster_id, moderator_id, status, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose channel is receiving unban requests.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's unban requests. This ID must match the user ID in the user access token.
status String Filter by a status: "pending", "approved", "denied", "acknowledged", "canceled"
optionals Struct The optional parameters to be passed into the function:

- user_id : String : The ID used to filter what unban requests are returned.
- after : String : Cursor used to get next page of results. Pagination struct in response contains cursor value.
- first : Real : The maximum number of items to return per page in response
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains information about the channel's unban requests.
 ├── id String Unban request ID.
 ├── broadcaster_id String User ID of broadcaster whose channel is receiving the unban request.
         └── broadcaster_name String The broadcaster's display name.
 ├── broadcaster_login String The broadcaster's login name.
 ├── moderator_id String User ID of moderator who approved/denied the request.
 ├── moderator_login String The moderator's login name.
 ├── moderator_name String The moderator's display name.
 ├── user_id String User ID of the requestor who is asking for an unban.
 ├── user_login String The user's login name.
 ├── user_name String The user's display name.
 ├── text String Text of the request from the requesting user.
 ├── status String Status of the request. One of: "pending", "approved", "denied", "acknowledged", "canceled"
 ├── created_at String Timestamp of when the unban request was created.
 ├── resolved_at String Timestamp of when moderator/broadcaster approved or denied the request.
 └── resolution_text String Text input by the resolver (moderator) of the unban request.
pagination Struct Contains information used to page through a list of results. The struct is empty if there are no more pages left to page through.
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_resolve_unban_requests

Twitch Endpoint: Resolve Unban Requests

This function resolves an unban request by approving or denying it.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_UNBAN_REQUESTS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_resolve_unban_requests(broadcaster_id, moderator_id, unban_request_id, status, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose channel is approving or denying the unban request.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's unban requests. This ID must match the user ID in the user access token.
unban_request_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's unban requests. This ID must match the user ID in the user access token.
status String Resolution status: "approved", "denied"
optionals Struct The optional parameters to be passed into the function:

- resolution_text : String : Message supplied by the unban request resolver. The message is limited to a maximum of 500 characters.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array
 ├── id String Unban request ID.
 ├── broadcaster_id String User ID of broadcaster whose channel is receiving the unban request.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── moderator_id String User ID of moderator who approved/denied the request.
 ├── moderator_login String The moderator's login name.
 ├── moderator_name String The moderator's display name.
 ├── user_id String User ID of the requestor who is asking for an unban.
 ├── user_login String The user's login name.
 ├── user_name String The user's display name.
 ├── text String Text of the request from the requesting user.
 ├── status String Status of the request. One of: "approved", "denied"
 ├── created_at String Timestamp of when the unban request was created.
 ├── resolved_at String Timestamp of when moderator/broadcaster approved or denied the request.
 └── resolution_text String Text input by the resolver (moderator) of the unban request.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_blocked_terms

Twitch Endpoint: Get Blocked Terms

This function gets the broadcaster's list of non-private, blocked words or phrases. These are the terms that the broadcaster or moderator added manually or that were denied by AutoMod.

Note

Requires a user access token that includes the TWITCH_SCOPE_MODERATOR_READ_BLOCKED_TERMS or TWITCH_SCOPE_MODERATOR_MANAGE_BLOCKED_TERMS scope.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_blocked_terms(broadcaster_id, moderator_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose blocked terms you're getting.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
optionals Struct The optional parameters to be passed into the function:

- first : Real : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 20.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of blocked terms. The list is in descending order of when they were created (see the created_at timestamp).
 ├── broadcaster_id String The broadcaster that owns the list of blocked terms.
 ├── moderator_id String The moderator that blocked the word or phrase from being used in the broadcaster's chat room.
 ├── id String An ID that identifies this blocked term.
 ├── text String The blocked word or phrase.
 ├── created_at String The UTC date and time (in RFC3339 format) that the term was blocked.
 ├── updated_at String The UTC date and time (in RFC3339 format) that the term was updated. When the term is added, this timestamp is the same as created_at. The timestamp changes as AutoMod continues to deny the term.
 └── expires_at String The UTC date and time (in RFC3339 format) that the blocked term is set to expire. After the block expires, users may use the term in the broadcaster's chat room.This field is undefined if the term was added manually or was permanently blocked by AutoMod.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_add_blocked_term

Twitch Endpoint: Add Blocked Term

This function adds a word or phrase to the broadcaster's list of blocked terms. These are the terms that the broadcaster doesn't want used in their chat room.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_BLOCKED_TERMS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_add_blocked_term(broadcaster_id, moderator_id, text, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the list of blocked terms.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
text String The word or phrase to block from being used in the broadcaster's chat room. The term must contain a minimum of 2 characters and may contain up to a maximum of 500 characters. Terms may include a wildcard character (*). The wildcard character must appear at the beginning or end of a word or set of characters. For example, *foo or foo*. If the blocked term already exists, the response contains the existing blocked term.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains the single blocked term that the broadcaster added.
 ├── broadcaster_id String The broadcaster that owns the list of blocked terms.
 ├── moderator_id String The moderator that blocked the word or phrase from being used in the broadcaster's chat room.
 ├── id String An ID that identifies this blocked term.
 ├── text String The blocked word or phrase.
 ├── created_at String The UTC date and time (in RFC3339 format) that the term was blocked.
 ├── updated_at String The UTC date and time (in RFC3339 format) that the term was updated. When the term is added, this timestamp is the same as created_at. The timestamp changes as AutoMod continues to deny the term.
 └── expires_at String The UTC date and time (in RFC3339 format) that the blocked term is set to expire. After the block expires, users may use the term in the broadcaster's chat room. This field is undefined if the term was added manually or was permanently blocked by AutoMod.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_remove_blocked_term

Twitch Endpoint: Remove Blocked Term

This function removes the word or phrase from the broadcaster's list of blocked terms.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_BLOCKED_TERMS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_remove_blocked_term(broadcaster_id, moderator_id, id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the list of blocked terms.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
id String The ID of the blocked term to remove from the broadcaster's list of blocked terms.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_delete_chat_messages

Twitch Endpoint: func_name

This function removes a single chat message or all chat messages from the broadcaster's chat room.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_CHAT_MESSAGES.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_delete_chat_messages(broadcaster_id, moderator_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the chat room to remove messages from.
moderator_id String The ID of the broadcaster or a user that has permission to moderate the broadcaster's chat room. This ID must match the user ID in the user access token.
optionals Struct The optional parameters to be passed into the function:

- message_id : String : The ID of the message to remove. The id tag in the PRIVMSG tag contains the message's ID. Restrictions: The message must have been created within the last 6 hours. The message must not belong to the broadcaster. The message must not belong to another moderator. If not specified, the request removes all messages in the broadcaster's chat room.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_moderated_channels

Twitch Endpoint: Get Moderated Channels

This function gets a list of channels that the specified user has moderator privileges in.

Note

Requires TWITCH_SCOPE TWITCH_SCOPE_USER_READ_MODERATED_CHANNELS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_moderated_channels(user_id, optionals, callback_success, callback_failed)
Argument Type Description
user_id String A user's ID. Returns the list of channels that this user has moderator privileges in. This ID must match the user ID in the user OAuth token
optionals Struct The optional parameters to be passed into the function:

- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value.
- first : Real : The maximum number of items to return per page in the response. Minimum page size is 1 item per page and the maximum is 100. The default is 20.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of channels that the user has moderator privileges in.
 ├── broadcaster_id String An ID that uniquely identifies the channel this user can moderate.
 ├── broadcaster_login String The channel's login name.
 └── broadcaster_name String The channels' display name.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through.
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_moderators

Twitch Endpoint: Get Moderators

This function gets all users allowed to moderate the broadcaster's chat room.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATION_READ. If your app also adds and removes moderators, you can use the TWITCH_SCOPE TWITCH_SCOPE_CHANNEL_MANAGE_MODERATORSinstead.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_moderators(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose list of moderators you want to get. This ID must match the user ID in the access token.
optionals Struct The optional parameters to be passed into the function:

- user_id : Real or Array of Real : A list of user IDs used to filter the results. To specify more than one ID, pass an array with the user ID of each moderator you want to get. You may specify a maximum of 100 IDs. The returned list includes only the users from the list who are moderators in the broadcaster's channel. The list is returned in the same order as you specified the IDs.
- first : String : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 20.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read more
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of moderators.
 ├── user_id String The ID of the user that has permission to moderate the broadcaster's channel.
 ├── user_login String The user's login name.
 └── user_name String The user's display name.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_add_channel_moderator

Twitch Endpoint: Add Channel Moderator

This function adds a moderator to the broadcaster's chat room.

Rate Limits: The broadcaster may add a maximum of 10 moderators within a 10-second window.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_MODERATORS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_add_channel_moderator(broadcaster_id, user_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token.
user_id String The ID of the user to add as a moderator in the broadcaster's chat room.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_remove_channel_moderator

Twitch Endpoint: Remove Channel Moderator

This function removes a moderator from the broadcaster's chat room.

Rate Limits: The broadcaster may remove a maximum of 10 moderators within a 10-second window.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_MODERATORS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_remove_channel_moderator(broadcaster_id, user_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token.
user_id String The ID of the user to remove as a moderator from the broadcaster's chat room.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_vips

Twitch Endpoint: Get VIPs

This function gets a list of the broadcaster's VIPs.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_VIPS. If your app also adds and removes VIP status, you can use the TWITCH_SCOPE TWITCH_SCOPE_CHANNEL_MANAGE_VIPS instead.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_vips(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose list of VIPs you want to get. This ID must match the user ID in the access token.
optionals Struct The optional parameters to be passed into the function:

- user_id : Real or Array of Real : Filters the list for specific VIPs. To specify more than one user, pass an array with the ID of each user to get. The maximum number of IDs that you may specify is 100. Ignores the ID of those users in the list that aren't VIPs.
- first : Real : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100. The default is 20.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read More
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of VIPs. The list is empty if the broadcaster doesn't have VIP users.
 ├── user_id String An ID that uniquely identifies the VIP user.
 ├── user_name String The user's display name.
 └── user_login String The user's login name.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_add_channel_vip

Twitch Endpoint: Add Channel VIP

This function adds the specified user as a VIP in the broadcaster's channel.

Rate Limits: The broadcaster may add a maximum of 10 VIPs within a 10-second window.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_VIPS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_add_channel_vip(user_id, broadcaster_id, callback_success, callback_failed)
Argument Type Description
user_id String The ID of the user to give VIP status to.
broadcaster_id String The ID of the broadcaster that's adding the user as a VIP. This ID must match the user ID in the access token.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_remove_channel_vip

Twitch Endpoint: Remove Channel VIP

This function removes the specified user as a VIP in the broadcaster's channel.

If the broadcaster is removing the user's VIP status, the ID in the broadcaster_id parameter must match the user ID in the access token; otherwise, if the user is removing their VIP status themselves, the ID in the user_id parameter must match the user ID in the access token.

Rate Limits: The broadcaster may remove a maximum of 10 VIPs within a 10-second window.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_VIPS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_remove_channel_vip(user_id, broadcaster_id, callback_success, callback_failed)
Argument Type Description
user_id String The ID of the user to remove VIP status from.
broadcaster_id String The ID of the broadcaster who owns the channel where the user has VIP status.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_update_shield_mode_status

Twitch Endpoint: Update Shield Mode Status

This function activates or deactivates the broadcaster's Shield Mode.

Twitch's Shield Mode feature is like a panic button that broadcasters can push to protect themselves from chat abuse coming from one or more accounts. When activated, Shield Mode applies the overrides that the broadcaster configured in the Twitch UX. If the broadcaster hasn't configured Shield Mode, it applies default overrides.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_SHIELD_MODE.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_update_shield_mode_status(broadcaster_id, moderator_id, is_active, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose Shield Mode you want to activate or deactivate.
moderator_id String The ID of the broadcaster or a user that is one of the broadcaster's moderators. This ID must match the user ID in the access token.
is_active Boolean A Boolean value that determines whether to activate Shield Mode. Set to true to activate Shield Mode; otherwise, false to deactivate Shield Mode.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains a single struct with the broadcaster's updated Shield Mode status.
 ├── is_active Boolean A Boolean value that determines whether Shield Mode is active. Is true if Shield Mode is active; otherwise, false.
 ├── moderator_id String An ID that identifies the moderator that last activated Shield Mode.
 ├── moderator_login String The moderator's login name.
 ├── moderator_name String The moderator's display name.
 └── last_activated_at String The UTC timestamp (in RFC3339 format) of when Shield Mode was last activated.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_get_shield_mode_status

Twitch Endpoint: Get Shield Mode Status

This function gets the broadcaster's Shield Mode activation status.

To receive notification when the broadcaster activates and deactivates Shield Mode, subscribe to the channel.shield_mode.begin and channel.shield_mode.end subscription types.

Note

Requires a user access token that includes the TWITCH_SCOPE_MODERATOR_READ_SHIELD_MODE or TWITCH_SCOPE_MODERATOR_MANAGE_SHIELD_MODE scope.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_get_shield_mode_status(broadcaster_id, moderator_id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose Shield Mode activation status you want to get.
moderator_id String The ID of the broadcaster or a user that is one of the broadcaster's moderators. This ID must match the user ID in the access token.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains a single struct with the broadcaster's Shield Mode status.
 ├── is_active Boolean A Boolean value that determines whether Shield Mode is active. Is true if the broadcaster activated Shield Mode; otherwise, false.
 ├── moderator_id String An ID that identifies the moderator that last activated Shield Mode. Is an empty string if Shield Mode hasn't been previously activated.
 ├── moderator_login String The moderator's login name. Is an empty string if Shield Mode hasn't been previously activated.
 ├── moderator_name String The moderator's display name. Is an empty string if Shield Mode hasn't been previously activated.
 └── last_activated_at String The UTC timestamp (in RFC3339 format) of when Shield Mode was last activated. Is an empty string if Shield Mode hasn't been previously activated.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_moderation_warn_chat_user

Twitch Endpoint: Warn Chat User

This function warns a user in the specified broadcaster's chat room, preventing them from chat interaction until the warning is acknowledged. New warnings can be issued to a user when they already have a warning in the channel (new warning will replace old warning).

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_MODERATOR_MANAGE_WARNINGS.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_moderation_warn_chat_user(broadcaster_id, moderator_id, data, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the channel in which the warning will take effect.
moderator_id String The ID of the twitch user who requested the warning.
data Struct A list that contains information about the warning.

- user_id : String : The ID of the twitch user to be warned.
- reason : String : A custom reason for the warning. Max 500 chars.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array An array that contains information about the warning.
broadcaster_id String The ID of the channel in which the warning will take effect.
user_id String The ID of the warned user.
moderator_id String The ID of the user who applied the warning.
reason String The reason provided for warning.

Failure Callback

This method is triggered on failure.



⚠️ **GitHub.com Fallback** ⚠️