This event fires whenever a subscriber's benefits are changed on GameWisp.
This Event is Part of an Event Chain
Note, this event may fire independently, but it will at least always fire after a subscriber-new event.
Robust, Automated, Benefit Delivery is Complicated
This is easily the most important event in the entirety of the Singularity. It relies heavily on benefit-fulfillment pairs. Be sure to read about how they work if you haven't!
Using Socket.IO this event can be listened to as follows:
socket.on('subscriber-benefits-change', function(data){
//Do something
});
This event fires whenever a subscriber’s benefits change. A benefit change can be triggered by a user:
- Subscribing to a new channel
- Upgrading their subscription to a channel
- Downgrading their subscription to a channel.
This event can also fire if the channel makes changes to a tier that contains active subscribers. In this case, a subscriber-benefits-change event will fire for each subscriber currently in the modified tier.
{
event: "subscriber-benefits-change",
channel_id: "channel identifier",
channel: {
names: {
gamewisp: "GameWisp channel name",
twitch: "twitch channel name",
youtube: "youtube channel name"
},
ids: {
gamewisp: "channel identifier",
twitch: "12312312q",
youtube: "UCiqp4J8asdkssssssssdfae"
}
}
data: {
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: "54350",
benefit_id: "3",
tier_id: "8781",
channel_fulfillment_response: null,
fulfilled_at: "2015-12-30 21:29:07",
previously_fulfilled_at: null,
disabled_at: null,
user_input_provided_at: null,
recurring: true,
granted_at: {
date: "2015-12-30 21:29:07.000000",
timezone_type: 3,
timezone: "UTC"
},
channel_cancelled_at: null,
status: "active"
}
},
//...
],
ids: {
gamewisp: "111111",
twitch: "121212121212"
},
usernames: {
gamewisp: "gamewisp_username",
twitch: "twitch_username"
},
status: "active",
amount: "3.99",
subscribed_at: "2015-12-30 00:00:00",
end_of_access: "2016-01-30 23:59:00",
tier: {
id: "11112",
title: "Tier Title",
level: "1",
cost: "3.99",
description: "Tier description",
published: true
}
}
}
The benefits array contains an array of benefit-fulfillment pairs. The benefit object in the pair describes a single benefit for the subscriber. The fulfillment object in the pair provides information about whether or not the benefit has been fulfilled.
Additionally, this event contains information pertaining to the subscriber, their payment amount, etc. that can also be found in the subscriber-new event documentation.
Benefit-Fulfillment Pairs are Important
It is highly advised to read about benefit-fulfillment pairs and how benefits work on GameWisp if you haven't already.