{"_id":"56b0e385135ec20d00baf9a9","user":"56acd6caa040860d00ac94a2","project":"56acd71213ac890d001c3c7a","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"},"editedParams2":true,"githubsync":"","__v":3,"category":{"_id":"56afd523bc304a0d00ace1df","pages":["56afd736b34d210d003d9ba9","56afd977bc304a0d00ace1e3","56b0e385135ec20d00baf9a9"],"project":"56acd71213ac890d001c3c7a","__v":3,"version":"56acd71213ac890d001c3c7d","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-01T21:58:59.198Z","from_sync":false,"order":4,"slug":"channel-resource","title":"Channel Resource"},"editedParams":true,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-02T17:12:37.891Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"var params = {\n  access_token: \"CHANNEL_ACCESS_TOKEN\",\n  type: 'twitch',\n  user_name: 'TWITCH_USER_NAME',\n  include: 'user,tier'\n};\n\n$.getJSON('https://api.gamewisp.com/pub/v1/channel/subscriber-for-channel/', params, function(json) {\n    console.log(json);\n});","language":"javascript"},{"language":"php","code":"<?php\n\n$client = new GuzzleHttp\\Client();\n\ntry {\n\n  $response = $client->get('https://api.gamewisp.com/pub/v1/channel/subscriber-for-channel', [\n    'query' => [\n      'access_token'  => 'CHANNEL_ACCESS_TOKEN',\n      'type' => 'twitch',\n  \t\t'user_name' => 'TWITCH_USER_NAME',\n  \t\t'include' => 'user,tier'\n    ]\n  ]);\n\n  $result = $response->json();\n\n} catch (Exception $e) {\n\n  //error\n  $result = $e->getResponse()->json();\n\n}"},{"name":"Sample URL","language":"text","code":"https://api.gamewisp.com/pub/v1/channel/subscriber-for-channel?type=twitch&access_token=CHANNEL_ACCESS_TOKEN&include=user,tier&user_name=TWITCH_USER_NAME"}]},"method":"get","results":{"codes":[{"code":"{\n  \"result\": {\n    \"status\": 1,\n    \"message\": \"Subscriber Retrieved\"\n  },\n  \"data\": [\n    {\n      \"id\": 26,\n      \"user_id\": 5,\n      \"status\": \"active\",\n      \"subscribed_at\": null,\n      \"tier_id\": \"3\",\n      \"tier\": {\n        \"data\": {\n          \"id\": 3,\n          \"level\": 1,\n          \"title\": \"Tier name\",\n          \"description\": \"Tier description.\",\n          \"cost\": \"$3.50\",\n          \"published\": true,\n          \"created_at\": \"2015-08-30 00:00:00\",\n          \"updated_at\": \"2015-09-15 03:04:12\"\n        }\n      },\n      \"user\": {\n        \"data\": {\n          \"id\": 5,\n          \"username\": \"eli\",\n          \"banned\": false,\n          \"deactivated\": false,\n          \"created_at\": \"2015-08-30 00:00:00\",\n          \"links\": {\n            \"uri\": \"/user/5\"\n          }\n        }\n      }\n    }\n  ]\n}","name":"","status":200,"language":"json"},{"name":"With multiple subscriber entries","status":200,"language":"json","code":"-{\n  \"result\": {\n    \"status\": 1,\n    \"message\": \"Subscriber Retrieved\"\n  },\n  \"data\": [\n    {\n      \"id\": 41,\n      \"user_id\": 5,\n      \"status\": \"twitch\",\n      \"subscribed_at\": \"2015-10-01 00:00:00\",\n      \"tier_id\": \"1\",\n      \"tier\": {\n        \"data\": {\n          \"id\": 1,\n          \"level\": 1,\n          \"title\": \"GameWisp Twitch Tier\",\n          \"description\": \"Twitch tier description\",\n          \"cost\": \"$0.00\",\n          \"published\": true,\n          \"created_at\": \"2015-09-30 00:00:00\",\n          \"updated_at\": \"2015-01-29 19:37:39\"\n        }\n      },\n      \"user\": {\n        \"data\": {\n          \"id\": 5,\n          \"username\": \"test\",\n          \"banned\": false,\n          \"deactivated\": false,\n          \"created_at\": \"-0001-11-30 00:00:00\",\n          \"links\": {\n            \"uri\": \"/user/5\"\n          }\n        }\n      }\n    },\n    {\n      \"id\": 26,\n      \"user_id\": 5,\n      \"status\": \"active\",\n      \"subscribed_at\": null,\n      \"tier_id\": \"3\",\n      \"tier\": {\n        \"data\": {\n          \"id\": 3,\n          \"level\": 1,\n          \"title\": \"Tier name\",\n          \"description\": \"Tier description.\",\n          \"cost\": \"$3.50\",\n          \"published\": true,\n          \"created_at\": \"2015-08-30 00:00:00\",\n          \"updated_at\": \"2015-09-15 03:04:12\"\n        }\n      },\n      \"user\": {\n        \"data\": {\n          \"id\": 5,\n          \"username\": \"test\",\n          \"banned\": false,\n          \"deactivated\": false,\n          \"created_at\": \"2015-08-30 00:00:00\",\n          \"links\": {\n            \"uri\": \"/user/5\"\n          }\n        }\n      }\n    }\n  ]\n}"}]},"settings":"","auth":"required","params":[{"_id":"56b0e385135ec20d00baf9ab","ref":"","in":"query","required":true,"desc":"OAuth2 access token, identifies the channel","default":"","type":"string","name":"access_token"},{"_id":"56b141e08f7a4f0d0029dde4","ref":"","in":"query","required":true,"desc":"the read_only scope is required, and supplied by default.","default":"read_only","type":"string","name":"scope"},{"_id":"56b0e3cbd97a7017007ce846","ref":"","in":"query","required":true,"desc":"The type of user. Options include: 'twitch' and 'gamewisp'","default":"","type":"string","name":"type"},{"_id":"56b0e385135ec20d00baf9aa","ref":"","in":"query","required":true,"desc":"Identifier for a user. Can be a GameWisp user ID or a Twitch user ID. Only required if ```user_name``` is not present","default":"","type":"int","name":"user_id"},{"_id":"56b0e3cbd97a7017007ce845","ref":"","in":"query","required":true,"desc":"A user's username. Can be a GameWisp username or a twitch username. Only required if user_id is not present","default":"","type":"string","name":"user_name"},{"_id":"56b0e6d1ce5f410d0056c9fc","ref":"","in":"query","required":false,"desc":"Optional parameter to provide additional information. See \"Include Parameters\" below.","default":"","type":"string","name":"include"}],"url":"/channel/subscriber-for-channel"},"isReference":false,"order":2,"body":"This is the endpoint you want to use if you need to determine whether or not a user subscribes to a channel on GameWisp. Since the method accepts both GameWisp and Twitch usernames and IDs, this is the fastest and most flexible method to perform a subscriber check on a new user. \n\nThis endpoint also accepts a **benefits** option for the ```include``` parameter, allowing you to return the [benefit-fulfillment pairs](https://gamewisp.readme.io/v1.0/docs/working-with-benefits-and-fulfillment) for a subscriber if you need them.\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"This Endpoint May Return Multiple Subscriber Objects\",\n  \"body\": \"This scenario occurs if the channel is partnered on Twitch and the user is both a Twitch subscriber and a GameWisp subscriber. This happens more often than you might think for partnered channels on GameWisp. See the Result Format above.\"\n}\n[/block]\n\nYou should always check the status returned with each subscriber object, as it will indicate whether or not the subscriber is currently active, a twitch subscriber, inactive, etc.\n\nThe ```type``` parameter dictates what records are checked on the backend. For example, If you pass **gamewisp** as the ```type``` parameter and the user's twitch username as ```user_name``` you may return the wrong subscriber for that channel. This outcome is extremely rare, but possible.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"This endpoint Accepts Include Parameters\",\n  \"body\": \"Be sure to review [how include parameters work](https://gamewisp.readme.io/docs/additional-includes) if you haven't yet.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Include Parameters\"\n}\n[/block]\nThe parameters below can also be included in any combination as a comma separated list (e.g, ```include=tier,user,benefits``` in the query string).\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Include Parameter\",\n    \"h-1\": \"Description\",\n    \"0-0\": \"user\",\n    \"1-0\": \"tier\",\n    \"2-0\": \"benefits\",\n    \"0-1\": \"Returns a user object nested with each subscriber object.\",\n    \"1-1\": \"Returns a tier object nested within each subscriber object.\",\n    \"2-1\": \"Returns the [benefit-fulfillment pairs](https://gamewisp.readme.io/v1.0/docs/working-with-benefits-and-fulfillment) associated with this subscriber\",\n    \"3-0\": \"anniversaries\",\n    \"3-1\": \"Returns any active subscriber anniversary objects the subscriber has. Active anniversaries have not been used by the subscriber yet and are less than three weeks old. Anniversaries are created whenever a subscriber successfully renews. See below for more information.\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n**The anniversaries Include Parameter**\n\nSubscriber anniversaries are generated automatically by GameWisp whenever a paying subscriber successfully renews. These anniversaries allow subscribers to fire off one time use \"Anniversary alerts\" that can cause an on screen alert. They're analogous to resubscriber alerts used by TwitchAlerts et al., but work for GameWisp subscriptions.\n\nThe anniversary object is described below. For more information on how GameWisp subscriber anniversaries work, check out the following YouTube video: \n[block:embed]\n{\n  \"html\": \"<iframe class=\\\"embedly-embed\\\" src=\\\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcJ2ZlBRAzs4%3Ffeature%3Doembed&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcJ2ZlBRAzs4&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcJ2ZlBRAzs4%2Fhqdefault.jpg&key=02466f963b9b4bb8845a05b53d3235d7&type=text%2Fhtml&schema=youtube\\\" width=\\\"854\\\" height=\\\"480\\\" scrolling=\\\"no\\\" frameborder=\\\"0\\\" allowfullscreen></iframe>\",\n  \"url\": \"https://www.youtube.com/watch?v=cJ2ZlBRAzs4\",\n  \"title\": \"GameWisp Subscriber Anniversary Alerts\",\n  \"favicon\": \"https://s.ytimg.com/yts/img/favicon-vflz7uhzw.ico\",\n  \"image\": \"https://i.ytimg.com/vi/cJ2ZlBRAzs4/hqdefault.jpg\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\\"anniversaries\\\": {\\n        \\\"data\\\": [\\n          {\\n            \\\"id\\\": 12,\\n            \\\"subscriber_id\\\": 88,\\n            \\\"fired\\\": false,\\n            \\\"month_count\\\": 2,\\n            \\\"subscribed_at\\\": \\\"2016-01-01 00:00:00\\\",\\n            \\\"renewed_at\\\": \\\"2016-02-01 00:00:00\\\",\\n            \\\"activation_url\\\": \\\"https://gamewisp.com/alert/<unique-hash>\\\"\\n          }\\n        ]\\n      }\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"id\",\n    \"0-1\": \"integer\",\n    \"0-2\": \"The unique id of the anniversary object.\",\n    \"1-0\": \"subscriber_id\",\n    \"1-1\": \"integer\",\n    \"1-2\": \"The id of the subscriber to which the alert belongs.\",\n    \"2-0\": \"fired\",\n    \"2-1\": \"boolean\",\n    \"2-2\": \"If true, the subscriber has used the alert already. If not, the subscriber can visit ```activation_url``` to fire the alert.\",\n    \"3-0\": \"subscribed_at\",\n    \"3-1\": \"UTC datetime formatted as string\",\n    \"3-2\": \"The date that the subscriber subscribed to the channel.\",\n    \"4-0\": \"renewed_at\",\n    \"4-1\": \"UTC datetime formatted as string\",\n    \"4-2\": \"The date the the subscriber was successfully renewed.\",\n    \"5-0\": \"month_count\",\n    \"5-1\": \"integer\",\n    \"5-2\": \"The anniversary month count for the anniversary object. Ex: a month_count of 2 indicates that the anniversary object was generated for the subscriber's second consecutive month of subscription.\",\n    \"6-0\": \"activation_url\",\n    \"6-1\": \"string\",\n    \"6-2\": \"The unique URL for the anniversary alert that will cause an alert to fire. For this url to work, the subscriber must be logged in to GameWisp and the ```fired``` parameter must be false.\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]","excerpt":"Determines if :user is subscribed to :channel","slug":"channelsubscriber-for-channel","type":"endpoint","title":"/channel/subscriber-for-channel"}

get/channel/subscriber-for-channel

Determines if :user is subscribed to :channel

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Query Params

access_token:
required
string
OAuth2 access token, identifies the channel
scope:
required
stringread_only
the read_only scope is required, and supplied by default.
type:
required
string
The type of user. Options include: 'twitch' and 'gamewisp'
user_id:
required
integer
Identifier for a user. Can be a GameWisp user ID or a Twitch user ID. Only required if ```user_name``` is not present
user_name:
required
string
A user's username. Can be a GameWisp username or a twitch username. Only required if user_id is not present
include:
string
Optional parameter to provide additional information. See "Include Parameters" below.

Examples


Result Format


Documentation

This is the endpoint you want to use if you need to determine whether or not a user subscribes to a channel on GameWisp. Since the method accepts both GameWisp and Twitch usernames and IDs, this is the fastest and most flexible method to perform a subscriber check on a new user. This endpoint also accepts a **benefits** option for the ```include``` parameter, allowing you to return the [benefit-fulfillment pairs](https://gamewisp.readme.io/v1.0/docs/working-with-benefits-and-fulfillment) for a subscriber if you need them. [block:callout] { "type": "warning", "title": "This Endpoint May Return Multiple Subscriber Objects", "body": "This scenario occurs if the channel is partnered on Twitch and the user is both a Twitch subscriber and a GameWisp subscriber. This happens more often than you might think for partnered channels on GameWisp. See the Result Format above." } [/block] You should always check the status returned with each subscriber object, as it will indicate whether or not the subscriber is currently active, a twitch subscriber, inactive, etc. The ```type``` parameter dictates what records are checked on the backend. For example, If you pass **gamewisp** as the ```type``` parameter and the user's twitch username as ```user_name``` you may return the wrong subscriber for that channel. This outcome is extremely rare, but possible. [block:callout] { "type": "info", "title": "This endpoint Accepts Include Parameters", "body": "Be sure to review [how include parameters work](https://gamewisp.readme.io/docs/additional-includes) if you haven't yet." } [/block] [block:api-header] { "type": "basic", "title": "Include Parameters" } [/block] The parameters below can also be included in any combination as a comma separated list (e.g, ```include=tier,user,benefits``` in the query string). [block:parameters] { "data": { "h-0": "Include Parameter", "h-1": "Description", "0-0": "user", "1-0": "tier", "2-0": "benefits", "0-1": "Returns a user object nested with each subscriber object.", "1-1": "Returns a tier object nested within each subscriber object.", "2-1": "Returns the [benefit-fulfillment pairs](https://gamewisp.readme.io/v1.0/docs/working-with-benefits-and-fulfillment) associated with this subscriber", "3-0": "anniversaries", "3-1": "Returns any active subscriber anniversary objects the subscriber has. Active anniversaries have not been used by the subscriber yet and are less than three weeks old. Anniversaries are created whenever a subscriber successfully renews. See below for more information." }, "cols": 2, "rows": 4 } [/block] **The anniversaries Include Parameter** Subscriber anniversaries are generated automatically by GameWisp whenever a paying subscriber successfully renews. These anniversaries allow subscribers to fire off one time use "Anniversary alerts" that can cause an on screen alert. They're analogous to resubscriber alerts used by TwitchAlerts et al., but work for GameWisp subscriptions. The anniversary object is described below. For more information on how GameWisp subscriber anniversaries work, check out the following YouTube video: [block:embed] { "html": "<iframe class=\"embedly-embed\" src=\"//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcJ2ZlBRAzs4%3Ffeature%3Doembed&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcJ2ZlBRAzs4&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcJ2ZlBRAzs4%2Fhqdefault.jpg&key=02466f963b9b4bb8845a05b53d3235d7&type=text%2Fhtml&schema=youtube\" width=\"854\" height=\"480\" scrolling=\"no\" frameborder=\"0\" allowfullscreen></iframe>", "url": "https://www.youtube.com/watch?v=cJ2ZlBRAzs4", "title": "GameWisp Subscriber Anniversary Alerts", "favicon": "https://s.ytimg.com/yts/img/favicon-vflz7uhzw.ico", "image": "https://i.ytimg.com/vi/cJ2ZlBRAzs4/hqdefault.jpg" } [/block] [block:code] { "codes": [ { "code": "\"anniversaries\": {\n \"data\": [\n {\n \"id\": 12,\n \"subscriber_id\": 88,\n \"fired\": false,\n \"month_count\": 2,\n \"subscribed_at\": \"2016-01-01 00:00:00\",\n \"renewed_at\": \"2016-02-01 00:00:00\",\n \"activation_url\": \"https://gamewisp.com/alert/<unique-hash>\"\n }\n ]\n }", "language": "json" } ] } [/block] [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Type", "h-2": "Description", "0-0": "id", "0-1": "integer", "0-2": "The unique id of the anniversary object.", "1-0": "subscriber_id", "1-1": "integer", "1-2": "The id of the subscriber to which the alert belongs.", "2-0": "fired", "2-1": "boolean", "2-2": "If true, the subscriber has used the alert already. If not, the subscriber can visit ```activation_url``` to fire the alert.", "3-0": "subscribed_at", "3-1": "UTC datetime formatted as string", "3-2": "The date that the subscriber subscribed to the channel.", "4-0": "renewed_at", "4-1": "UTC datetime formatted as string", "4-2": "The date the the subscriber was successfully renewed.", "5-0": "month_count", "5-1": "integer", "5-2": "The anniversary month count for the anniversary object. Ex: a month_count of 2 indicates that the anniversary object was generated for the subscriber's second consecutive month of subscription.", "6-0": "activation_url", "6-1": "string", "6-2": "The unique URL for the anniversary alert that will cause an alert to fire. For this url to work, the subscriber must be logged in to GameWisp and the ```fired``` parameter must be false." }, "cols": 3, "rows": 7 } [/block]