{"_id":"56e7266bdbc36117006a41ff","project":"56acd71213ac890d001c3c7a","user":"56acd6caa040860d00ac94a2","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"},"parentDoc":null,"__v":14,"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"},"githubsync":"","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-03-14T21:00:27.060Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"This Event is NOT for Real-Time Detection of a Subscriber Renewal!\",\n  \"body\": \"If a subscriber renews properly, the[ subscriber-renewed](https://gamewisp.readme.io/v1.0/docs/subscriber-renewed) event will fire as soon the successful renewal happens. subscriber-anniversary fires based on action by the subscriber. Namely, initiating an anniversary alert.\"\n}\n[/block]\nUsing Socket.IO this event can be listened to as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"socketClient.on('subscriber-anniversary', function(data, callback){\\n  //do something\\n});\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\nThis event fires whenever a subscriber initiates an Anniversary Alert on GameWisp. See below for a description of Anniversary Alerts and how they're used.\n\nThe JSON response is as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  event: \\\"subscriber-anniversary\\\",\\n\\tchannel_id: 4,\\n\\tchannel: \\n  {\\n    names:\\n    {\\n      gamewisp: \\\"gamewisp-channel-name\\\",\\n      twitch:   \\\"twitch-channel-name\\\",\\n      youtube:  null,\\n    },\\n    ids:\\n    {\\n      gamewisp: 4,\\n      twitch:   123456,\\n      youtube:  null,\\n    },\\n  },\\n\\tdata:\\n  {\\n    id: 16,\\n    subscriber:\\n    {\\n      ids:\\n    \\t{\\n        gamewisp: 83,\\n        twitch:   null\\n  \\t\\t},\\n      usernames:\\n  \\t\\t{\\n        gamewisp: \\\"subscriber-username\\\",\\n        twitch:   null\\n      },\\n      status: \\\"active\\\",\\n      amount: \\\"2.50\\\",\\n      subscribed_at: \\\"2016-02-25 00:00:00\\\",\\n      end_of_access: \\\"2016-03-25 00:00:00\\\",\\n      tier:\\n      {\\n        id: 6,\\n        title: \\\"tier name\\\",\\n        level: 1,\\n        cost: \\\"2.50\\\",\\n        description: \\\"tier description\\\",\\n        published: true\\n      },\\n    },\\n    fired: true,\\n    url: \\\"https://gamewisp.com/alert/<unique-hash>\\\",\\n    month_count: 1,\\n    subscribed_at: \\\"2016-02-24 00:00:00\\\",\\n    payment_date: \\\"2016-02-25 16:47:34\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nThe ```data``` object is described as follows:\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 Alert Anniversary object.\",\n    \"1-0\": \"subscriber\",\n    \"1-1\": \"Object\",\n    \"1-2\": \"The standard GameWisp subscriber object. Described in [subscriber-new](https://gamewisp.readme.io/docs/subscriber-new)\",\n    \"2-0\": \"fired\",\n    \"2-1\": \"Boolean\",\n    \"2-2\": \"A boolean indicated whether or not the Anniversary Alert has been fired by the subscriber. When using Singularity, the ```fired``` property should always be true.\",\n    \"3-0\": \"url\",\n    \"3-1\": \"String\",\n    \"3-2\": \"A unique URL to fire the Anniversary Alert. Upon receiving this event; however, this URL will no longer be valid since the subscriber used to fire the Anniversary Alert that led to the subscriber-anniversary event.\",\n    \"4-0\": \"month_count\",\n    \"4-1\": \"Integer\",\n    \"4-2\": \"The month count of the particular Anniversary Alert. Example: month_count = 3 indicates that the alert is for the subscriber's third consecutive month of subscription.\",\n    \"5-0\": \"subscribed_at\",\n    \"5-1\": \"String formatted \\nUTC DateTime\",\n    \"5-2\": \"The date of the subscriber's initial subscription.\",\n    \"6-0\": \"payment_date\",\n    \"6-1\": \"String formatted UTC DateTime\",\n    \"6-2\": \"The date that the subscriber was successfully renewed.\"\n  },\n  \"cols\": 3,\n  \"rows\": 7\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"What's an Anniversary Alert, Anyway?\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Not all Anniversary Alerts are Fired\",\n  \"body\": \"Since Anniversary Alerts require a subscriber clicking a link in an email sent to them to actually fire, some number of Anniversary Alerts in our system go unfired.\\n\\nFor this reason, it is generally not a good idea to rely on the subscriber-anniversary event to perform critical operations in your application. Use subscriber-renewed instead.\"\n}\n[/block]\nThe following video gives a quick description of Anniversary Alerts and how they work. \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]\nAn Anniversary Alert is how GameWisp handles providing on-stream recognition for subscribers upon successful renewal of their subscription. The standard flow of an Anniversary Alert is as follows:\n\n1. The subscriber is successfully charged for another month of subscription on GameWisp.\n2. The subscriber is sent an email containing a unique URL\n3. The subscriber can then click on the URL in the email whenever the channel to which they're subscribed is streaming.\n4. Clicking this URL initiates an on-screen alert sent through TwitchAlerts or StreamPro indicating that the subscriber has been subscribed for a particular number of months.\n\nSpecifically, the ```subscriber-anniversary``` event is fired immediately after the completion of Step 4. An application can use the receipt of this event to indicate that the subscriber is ready to receive some sort of recognition for subscribing for yet another month. This could be a pop up in your application, an automated \"Thanks for your continued subscription\" in a chat bot, etc. \n\nDo **not** use this event as indication that the subscriber has been successfully renewed and your application needs to reallocate benefits or take any action related to successful renewal. That's what the [subscriber-renewed](https://gamewisp.readme.io/docs/subscriber-renewed) event is for.","excerpt":"Fires whenever a subscriber fires an anniversary alert after a successful resubscription","slug":"subscriber-anniversary","type":"fn","title":"subscriber-anniversary"}

subscriber-anniversary

Fires whenever a subscriber fires an anniversary alert after a successful resubscription

[block:callout] { "type": "warning", "title": "This Event is NOT for Real-Time Detection of a Subscriber Renewal!", "body": "If a subscriber renews properly, the[ subscriber-renewed](https://gamewisp.readme.io/v1.0/docs/subscriber-renewed) event will fire as soon the successful renewal happens. subscriber-anniversary fires based on action by the subscriber. Namely, initiating an anniversary alert." } [/block] Using Socket.IO this event can be listened to as follows: [block:code] { "codes": [ { "code": "socketClient.on('subscriber-anniversary', function(data, callback){\n //do something\n});", "language": "javascript" } ] } [/block] This event fires whenever a subscriber initiates an Anniversary Alert on GameWisp. See below for a description of Anniversary Alerts and how they're used. The JSON response is as follows: [block:code] { "codes": [ { "code": "{\n event: \"subscriber-anniversary\",\n\tchannel_id: 4,\n\tchannel: \n {\n names:\n {\n gamewisp: \"gamewisp-channel-name\",\n twitch: \"twitch-channel-name\",\n youtube: null,\n },\n ids:\n {\n gamewisp: 4,\n twitch: 123456,\n youtube: null,\n },\n },\n\tdata:\n {\n id: 16,\n subscriber:\n {\n ids:\n \t{\n gamewisp: 83,\n twitch: null\n \t\t},\n usernames:\n \t\t{\n gamewisp: \"subscriber-username\",\n twitch: null\n },\n status: \"active\",\n amount: \"2.50\",\n subscribed_at: \"2016-02-25 00:00:00\",\n end_of_access: \"2016-03-25 00:00:00\",\n tier:\n {\n id: 6,\n title: \"tier name\",\n level: 1,\n cost: \"2.50\",\n description: \"tier description\",\n published: true\n },\n },\n fired: true,\n url: \"https://gamewisp.com/alert/<unique-hash>\",\n month_count: 1,\n subscribed_at: \"2016-02-24 00:00:00\",\n payment_date: \"2016-02-25 16:47:34\"\n }\n}", "language": "json" } ] } [/block] The ```data``` object is described as follows: [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 Alert Anniversary object.", "1-0": "subscriber", "1-1": "Object", "1-2": "The standard GameWisp subscriber object. Described in [subscriber-new](https://gamewisp.readme.io/docs/subscriber-new)", "2-0": "fired", "2-1": "Boolean", "2-2": "A boolean indicated whether or not the Anniversary Alert has been fired by the subscriber. When using Singularity, the ```fired``` property should always be true.", "3-0": "url", "3-1": "String", "3-2": "A unique URL to fire the Anniversary Alert. Upon receiving this event; however, this URL will no longer be valid since the subscriber used to fire the Anniversary Alert that led to the subscriber-anniversary event.", "4-0": "month_count", "4-1": "Integer", "4-2": "The month count of the particular Anniversary Alert. Example: month_count = 3 indicates that the alert is for the subscriber's third consecutive month of subscription.", "5-0": "subscribed_at", "5-1": "String formatted \nUTC DateTime", "5-2": "The date of the subscriber's initial subscription.", "6-0": "payment_date", "6-1": "String formatted UTC DateTime", "6-2": "The date that the subscriber was successfully renewed." }, "cols": 3, "rows": 7 } [/block] [block:api-header] { "type": "basic", "title": "What's an Anniversary Alert, Anyway?" } [/block] [block:callout] { "type": "warning", "title": "Not all Anniversary Alerts are Fired", "body": "Since Anniversary Alerts require a subscriber clicking a link in an email sent to them to actually fire, some number of Anniversary Alerts in our system go unfired.\n\nFor this reason, it is generally not a good idea to rely on the subscriber-anniversary event to perform critical operations in your application. Use subscriber-renewed instead." } [/block] The following video gives a quick description of Anniversary Alerts and how they work. [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] An Anniversary Alert is how GameWisp handles providing on-stream recognition for subscribers upon successful renewal of their subscription. The standard flow of an Anniversary Alert is as follows: 1. The subscriber is successfully charged for another month of subscription on GameWisp. 2. The subscriber is sent an email containing a unique URL 3. The subscriber can then click on the URL in the email whenever the channel to which they're subscribed is streaming. 4. Clicking this URL initiates an on-screen alert sent through TwitchAlerts or StreamPro indicating that the subscriber has been subscribed for a particular number of months. Specifically, the ```subscriber-anniversary``` event is fired immediately after the completion of Step 4. An application can use the receipt of this event to indicate that the subscriber is ready to receive some sort of recognition for subscribing for yet another month. This could be a pop up in your application, an automated "Thanks for your continued subscription" in a chat bot, etc. Do **not** use this event as indication that the subscriber has been successfully renewed and your application needs to reallocate benefits or take any action related to successful renewal. That's what the [subscriber-renewed](https://gamewisp.readme.io/docs/subscriber-renewed) event is for.