Used to request all of the subscribers for a channel. Can be filtered via input parameters
This event is used to return the current subscribers for a channel. It is used as follows:
socket.emit('channel-subscribers', {
access_token: "channel OAuth2 access token",
params: {
array: [<gamewisp-identifiers>],
status: 'all',
sort: 'newest',
benefits: true,
tier: true,
}
});
params is a JSON object of optional parameters that can be used to request particular subscriber data for the specified channel. Each element of params is described as follows:
Property | Type | Description |
---|---|---|
array | Array | An array of GameWisp user ids, twitch usernames, or GameWisp usernames or any combination thereof. If any of the specified elements belong to a subscriber of the particular channel, that subscriber’s information will be returned. Specifying a list of users in this parameter limits all other optional parameters to only the list of specified users. The default parameter is an empty array, which returns all of the subscribers for the channel. |
status | String | Filter by subscriber status. Options include: all - Default. Does not filter the list of subscribers by status. active: Only returns subscribers that are active. inactive: Only returns subscribers if they are inactive. twitch: Only returns subscribers if they are subscribed on Twitch. This only works for partnered channels. |
sort | String | Applies a sort to the returned results. Options include: newest - Default. Sort from newest subscriber to oldest oldest - Sort from oldest subscriber to newest. |
benefits | Boolean | Default is false. If true, returns the benefits for each subscriber. |
tier | Boolean | Default is false. If true, returns tier information for the subscriber. |
This event emits app-channel-subscribers back to your application upon completion. You can listen for this event using Socket.IO as follows:
socket.on('app-channel-subscribers', function(response){
// Do something with response.
});
The response object has the following structure:
{
result: {
status: 1,
message: "Channel Subscribers."
},
channel: {
names: {
gamewisp: "GameWisp channel name",
twitch: "twitch channel name",
youtube: "youtube channel name"
},
ids: {
gamewisp: "channel identifier",
twitch: "12312312q",
youtube: "UCiqp4J8asdkssssssssdfae"
}
},
data:
{
channel_id: "channel-identifier",
status: "authenticated",
subscribers: [
{
benefits: [
{
benefit: {
id: "3",
delivery: "delivery-messaging",
title: "Subscriber Messaging",
description: "Receive Subscriber-only messages from me.",
channel_data: null,
type: "unknown-type",
month_delay: null,
recurring: false,
recurring_input: false,
receieve_immediately: false,
removed_at: null,
subscriber_limit: null,
tier_bonus: false,
quantity: 1,
multiplier: 1
},
fulfillment: {
id: "49917",
benefit_id: "3",
tier_id: "856",
channel_fulfillment_response: null,
fulfilled_at: "2015-12-24 03:55:17",
previously_fulfilled_at: null,
disabled_at: null,
user_input_provided_at: null,
recurring: true,
granted_at: {
date: "2015-12-24 03:55:17.000000",
timezone_type: 3,
timezone: "UTC"
},
channel_cancelled_at: null,
status: "active",
user_input: null
}
},
//...
],
ids: {
gamewisp: "12323",
twitch: "455552422"
},
usernames: {
gamewisp: "gamewisp-user-name",
twitch: "twitch-user-name"
},
status: "active",
amount: "4.99",
subscribed_at: "2015-12-24 00:00:00",
end_of_access: "2016-01-24 23:59:00",
tier: {
id: "123",
title: "Tier Title",
level: "1",
cost: "4.99",
description: "Tier description",
published: true
}
},
//...
}
],
}
The response object contains subscriber information (described in detail in the subscriber-new event documentation), benefit-fulfillment pairs for the subscriber (see subscriber-benefits-change ), and the subscriber’s tier (see subscriber-status-change ). Note that you will only receive the full object for a subscriber if both the benefit and tier parameters of channel-subscribers are true.
This response may be very large
Depending on how you use this event, the resulting response object can be very large.
It is not recommended to grab all the benefit and tier information for every subscriber simultaneously.
It is preferred to use this event to get a full list of subscribers for a channel, and then check the benefits of individual subscribers through subsequent calls.