{"_id":"56ad33b21a7ee417009ced1a","parentDoc":null,"project":"56acd71213ac890d001c3c7a","__v":1,"user":"56acd6caa040860d00ac94a2","version":{"_id":"56acd71213ac890d001c3c7d","project":"56acd71213ac890d001c3c7a","__v":15,"createdAt":"2016-01-30T15:30:26.928Z","releaseDate":"2016-01-30T15:30:26.928Z","categories":["56acd71313ac890d001c3c7e","56acd8f113ac890d001c3c81","56acd8f95ac4060d0027865e","56acd93a13ac890d001c3c82","56ad20660ab3c00d00ce3347","56ad356a2a7860170013f714","56ad47eb0ab3c00d00ce334f","56afd523bc304a0d00ace1df","56b29a019621f20d00efb37e","56b657e11bc6970d009feee7","5845cc3c39950c1b002afe77","5845cde163c11b250037967e","5846efd45d064323007b17b4","588604da4674e32300efd160","588627882393d50f00f1322c"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"56ad20660ab3c00d00ce3347","__v":11,"pages":["56ad21651c09150d00a183a0","56ad235c693f0a0d0085f0c3","56ad24afd21f1b0d00fd2f86","56ad2e5b1c09150d00a183a6","56ad305879011b0d00c32aaa","56ad30c81a7ee417009ced18","56ad31432a7860170013f711","56ad33b21a7ee417009ced1a","56ad34a0b9ac5517006b6962","56ad35503fc1020d009776e1","56e7266bdbc36117006a41ff"],"project":"56acd71213ac890d001c3c7a","version":"56acd71213ac890d001c3c7d","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-30T20:43:18.400Z","from_sync":false,"order":9,"slug":"singularity-real-time-events","title":"Singularity: Real-Time Events"},"githubsync":"","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-01-30T22:05:38.286Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":8,"body":"Using Socket.IO this benefit can be listened to as follows:\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socket.on('tier-published', function(data){\\n    //Do stuff.\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe tier published event is fired whenever a channel publishes a subscriber tier. The tier may be new, or it may a tier that was unpublished and then published again by the channel. The JSON structure of the event is as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   event: \\\"tier-published\\\",\\n   channel_id: \\\"channel-id\\\",\\n   channel: {\\n      names: {\\n         gamewisp: \\\"GameWisp channel name\\\",\\n         twitch: \\\"twitch channel name\\\",\\n         youtube: \\\"youtube channel name\\\"\\n      },\\n      ids: {\\n         gamewisp: \\\"channel identifier\\\",\\n         twitch: \\\"12312312q\\\",\\n         youtube: \\\"UCiqp4J8asdkssssssssdfae\\\"\\n      }  \\n   },\\n   data: {\\n      id: \\\"12345\\\",\\n      title: \\\"Tier Title\\\",\\n      level: \\\"1\\\",\\n      cost: \\\"4.00\\\",\\n      description: \\\"Tier description.\\\",\\n      published: true,\\n      subscribers: 0,\\n      benefits: [\\n         {\\n            id: \\\"3\\\",\\n            delivery: \\\"delivery-messaging\\\",\\n            title: \\\"Subscriber Messaging\\\",\\n            description: \\\"Receive Subscriber-only messages from me.\\\",\\n            channel_data: null,\\n            type: \\\"unknown-type\\\",\\n            month_delay: null,\\n            recurring: false,\\n            recurring_input: false,\\n            receieve_immediately: false,\\n            removed_at: null,\\n            subscriber_limit: null,\\n            tier_bonus: false,\\n            quantity: 1,\\n            multiplier: 1\\n         },\\n         //...\\n      ]\\n   }\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThe **tier-published** event contains the following **data** Object:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"Integer\",\n    \"0-2\": \"The unique identifier of the tier.\",\n    \"1-2\": \"The title of the tier.\",\n    \"2-2\": \"The level of the tier. Minimum: 1, Maximum:6. This value is null for Twitch tiers.\",\n    \"3-2\": \"The cost of the tier.\",\n    \"4-2\": \"The text description of the tier.\",\n    \"5-2\": \"The published state of the tier.\",\n    \"6-2\": \"The count of subscribers currently in the tier.\",\n    \"7-2\": \"An array of benefits contained in the tier.\",\n    \"7-1\": \"Array\",\n    \"6-1\": \"Integer\",\n    \"5-1\": \"Boolean\",\n    \"4-1\": \"String\",\n    \"3-1\": \"String formatted USD amount.\",\n    \"2-1\": \"Integer\",\n    \"1-1\": \"String\",\n    \"1-0\": \"title\",\n    \"2-0\": \"level\",\n    \"3-0\": \"cost\",\n    \"4-0\": \"description\",\n    \"5-0\": \"published\",\n    \"6-0\": \"subscribers\",\n    \"7-0\": \"benefits\"\n  },\n  \"cols\": 3,\n  \"rows\": 8\n}\n[/block]\nPublished tiers can be seen on a channel’s GameWisp page. Subscribers can only be granted benefits from published tiers. However, if a subscriber has benefits for a tier that a channel later sets to unpublished, the subscriber still has access to those benefits since they were in a published tier at the time of subscription. Recurring benefits from an unpublished tier will not recur.","excerpt":"Fires whenever a channel publishes a tier on GameWisp","slug":"tier-published","type":"fn","title":"tier-published"}

tier-published

Fires whenever a channel publishes a tier on GameWisp

Using Socket.IO this benefit can be listened to as follows: [block:code] { "codes": [ { "code": "socket.on('tier-published', function(data){\n //Do stuff.\n});", "language": "javascript" } ] } [/block] The tier published event is fired whenever a channel publishes a subscriber tier. The tier may be new, or it may a tier that was unpublished and then published again by the channel. The JSON structure of the event is as follows: [block:code] { "codes": [ { "code": "{\n event: \"tier-published\",\n channel_id: \"channel-id\",\n channel: {\n names: {\n gamewisp: \"GameWisp channel name\",\n twitch: \"twitch channel name\",\n youtube: \"youtube channel name\"\n },\n ids: {\n gamewisp: \"channel identifier\",\n twitch: \"12312312q\",\n youtube: \"UCiqp4J8asdkssssssssdfae\"\n } \n },\n data: {\n id: \"12345\",\n title: \"Tier Title\",\n level: \"1\",\n cost: \"4.00\",\n description: \"Tier description.\",\n published: true,\n subscribers: 0,\n benefits: [\n {\n id: \"3\",\n delivery: \"delivery-messaging\",\n title: \"Subscriber Messaging\",\n description: \"Receive Subscriber-only messages from me.\",\n channel_data: null,\n type: \"unknown-type\",\n month_delay: null,\n recurring: false,\n recurring_input: false,\n receieve_immediately: false,\n removed_at: null,\n subscriber_limit: null,\n tier_bonus: false,\n quantity: 1,\n multiplier: 1\n },\n //...\n ]\n }\n}", "language": "javascript" } ] } [/block] The **tier-published** event contains the following **data** Object: [block:parameters] { "data": { "h-0": "Property", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "Integer", "0-2": "The unique identifier of the tier.", "1-2": "The title of the tier.", "2-2": "The level of the tier. Minimum: 1, Maximum:6. This value is null for Twitch tiers.", "3-2": "The cost of the tier.", "4-2": "The text description of the tier.", "5-2": "The published state of the tier.", "6-2": "The count of subscribers currently in the tier.", "7-2": "An array of benefits contained in the tier.", "7-1": "Array", "6-1": "Integer", "5-1": "Boolean", "4-1": "String", "3-1": "String formatted USD amount.", "2-1": "Integer", "1-1": "String", "1-0": "title", "2-0": "level", "3-0": "cost", "4-0": "description", "5-0": "published", "6-0": "subscribers", "7-0": "benefits" }, "cols": 3, "rows": 8 } [/block] Published tiers can be seen on a channel’s GameWisp page. Subscribers can only be granted benefits from published tiers. However, if a subscriber has benefits for a tier that a channel later sets to unpublished, the subscriber still has access to those benefits since they were in a published tier at the time of subscription. Recurring benefits from an unpublished tier will not recur.