{"_id":"55d3a5bac336ec0d007c222b","user":"5432d74e8780d4080074d772","__v":5,"project":"53844557a43e08da4677be0e","category":{"_id":"55b7d0e5568be2230092bb92","project":"53844557a43e08da4677be0e","version":"53844558a43e08da4677be12","pages":["55b7f917568be2230092bc55","55b800e2568be2230092bc85","55b83216d9caa30d001aae38","55b8324ad9caa30d001aae3a","55d3a5bac336ec0d007c222b","55d7732f4ad876170027fa1d"],"__v":6,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-28T18:58:45.698Z","from_sync":false,"order":2,"slug":"inbox-by-knowtify-in-app-notifications","title":"InBox by Knowtify - In-app Notifications"},"version":{"_id":"53844558a43e08da4677be12","__v":8,"project":"53844557a43e08da4677be0e","createdAt":"2014-05-27T07:57:12.136Z","releaseDate":"2014-05-27T07:57:12.136Z","categories":["53844558a43e08da4677be13","538619e1ef91f96d49aa1a0b","541e82877eb16bb64f83c0ca","5445a073c3eb3808000c76b2","5445a098c3eb3808000c76b3","54bb05ab522f03150054d9e8","54bb05cf9741c81500078f73","55b7d0e5568be2230092bb92"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"false","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-08-18T21:38:02.030Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"If you would like Send alerts to InBox without having to use the Knowtify interface to creat the message, you can do this. This is great if you want to send messages to users who haven't logged. [Try it live here](http://codepen.io/DaneLyons/pen/WvBLKE/right).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n    var _knowtify = _knowtify || [];\\n    var _knowtifyInbox = _knowtifyInbox || [];\\n    _knowtify.public_token = \\\"FROM_YOUR_KNOWTIFY_ACCOUNT\\\";\\n\\t\\tvar timestamp = new Date();\\n\\n    (function(d,s,t,u){var j = d.createElement(s);var p = d.getElementsByTagName(s)[0];\\n        j.type = t;j.async = true;j.src = u;p.parentNode.insertBefore(j, p);})(document,'script','text/javascript', 'http://js.knowtify.io/knowtify.js');\\n\\n    _knowtify.push(['load_inbox', 'BUTTON_ID', {email: \\\"xxx\\\", id: \\\"xxx\\\"}]);\\n    _knowtifyInbox.push(['message', {\\n        id: \\\"123\\\",\\n        heading: \\\"Message heading\\\",\\n      \\tdescription: \\\"Message description...\\\",\\n        image: \\\"https://s3.amazonaws.com/knowtify_web/_img/inbox_profile.png\\\",\\n        content: \\\"<p>HTML displayed when message is clicked</p>\\\",\\n        created_at: timestamp\\n    }])\\n\\n</script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"URLs\"\n}\n[/block]\nYou can also redirect users to a url instead of displaying content by including a 'url' attribute instead of 'content'.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<script>\\n    var _knowtify = _knowtify || [];\\n    var _knowtifyInbox = _knowtifyInbox || [];\\n    _knowtify.public_token = \\\"FROM_YOUR_KNOWTIFY_ACCOUNT\\\";\\n\\t\\tvar timestamp = new Date();\\n\\n    (function(d,s,t,u){var j = d.createElement(s);var p = d.getElementsByTagName(s)[0];\\n        j.type = t;j.async = true;j.src = u;p.parentNode.insertBefore(j, p);})(document,'script','text/javascript', 'http://js.knowtify.io/knowtify.js');\\n\\n    _knowtify.push(['load_inbox', 'BUTTON_ID', {email: \\\"xxx\\\", id: \\\"xxx\\\"}]);\\n    _knowtifyInbox.push(['message', {\\n        id: \\\"123\\\",\\n        heading: \\\"Message heading\\\",\\n      \\tdescription: \\\"Message description...\\\",\\n        image: \\\"https://s3.amazonaws.com/knowtify_web/_img/inbox_profile.png\\\",\\n        url: \\\"http://google.com\\\",\\n        created_at: timestamp\\n    }])\\n\\n</script>\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]","excerpt":"How to send alerts to InBox without needing to use the Knowtify interface","slug":"js-triggered-alerts","type":"basic","title":"JS TRIGGERED ALERT MESSAGES"}

JS TRIGGERED ALERT MESSAGES

How to send alerts to InBox without needing to use the Knowtify interface

If you would like Send alerts to InBox without having to use the Knowtify interface to creat the message, you can do this. This is great if you want to send messages to users who haven't logged. [Try it live here](http://codepen.io/DaneLyons/pen/WvBLKE/right). [block:code] { "codes": [ { "code": "<script>\n var _knowtify = _knowtify || [];\n var _knowtifyInbox = _knowtifyInbox || [];\n _knowtify.public_token = \"FROM_YOUR_KNOWTIFY_ACCOUNT\";\n\t\tvar timestamp = new Date();\n\n (function(d,s,t,u){var j = d.createElement(s);var p = d.getElementsByTagName(s)[0];\n j.type = t;j.async = true;j.src = u;p.parentNode.insertBefore(j, p);})(document,'script','text/javascript', 'http://js.knowtify.io/knowtify.js');\n\n _knowtify.push(['load_inbox', 'BUTTON_ID', {email: \"xxx\", id: \"xxx\"}]);\n _knowtifyInbox.push(['message', {\n id: \"123\",\n heading: \"Message heading\",\n \tdescription: \"Message description...\",\n image: \"https://s3.amazonaws.com/knowtify_web/_img/inbox_profile.png\",\n content: \"<p>HTML displayed when message is clicked</p>\",\n created_at: timestamp\n }])\n\n</script>", "language": "javascript" } ] } [/block] [block:api-header] { "type": "basic", "title": "URLs" } [/block] You can also redirect users to a url instead of displaying content by including a 'url' attribute instead of 'content'. [block:code] { "codes": [ { "code": "<script>\n var _knowtify = _knowtify || [];\n var _knowtifyInbox = _knowtifyInbox || [];\n _knowtify.public_token = \"FROM_YOUR_KNOWTIFY_ACCOUNT\";\n\t\tvar timestamp = new Date();\n\n (function(d,s,t,u){var j = d.createElement(s);var p = d.getElementsByTagName(s)[0];\n j.type = t;j.async = true;j.src = u;p.parentNode.insertBefore(j, p);})(document,'script','text/javascript', 'http://js.knowtify.io/knowtify.js');\n\n _knowtify.push(['load_inbox', 'BUTTON_ID', {email: \"xxx\", id: \"xxx\"}]);\n _knowtifyInbox.push(['message', {\n id: \"123\",\n heading: \"Message heading\",\n \tdescription: \"Message description...\",\n image: \"https://s3.amazonaws.com/knowtify_web/_img/inbox_profile.png\",\n url: \"http://google.com\",\n created_at: timestamp\n }])\n\n</script>", "language": "javascript" } ] } [/block]