{"__v":11,"_id":"55b0cf51f202b12100cda2ff","category":{"__v":2,"_id":"55afb28ec8a85321007a5462","pages":["55b0cf51f202b12100cda2ff","55b0cf69b3171b3700b15404"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-07-22T15:11:10.650Z","from_sync":false,"order":11,"slug":"experiences","title":"Experiences"},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","user":"55a54dde9c32760d00ca78a8","version":{"__v":23,"_id":"559a61d2dbcfd20d00710b3c","project":"559a61d2dbcfd20d00710b39","createdAt":"2015-07-06T11:09:06.510Z","releaseDate":"2015-07-06T11:09:06.510Z","categories":["559a61d3dbcfd20d00710b3d","55a589ddaaf9cf1900114dd0","55a589e30f354f0d00fd0312","55a589ea80c8a30d00b323cc","55a589f6aaf9cf1900114dd1","55a58d4e80c8a30d00b323e6","55a8e7a227a17d21005251a2","55a93098cf45e1390093f351","55afb085f202b12100cd9e83","55afb22e902fd51700f5f8bf","55afb260902fd51700f5f8c2","55afb28ec8a85321007a5462","55afb294f202b12100cd9e95","55afb29b902fd51700f5f8c5","55afb2a1c8a85321007a5463","55afb2a7902fd51700f5f8c7","55afb2ad902fd51700f5f8c8","55afb2b5902fd51700f5f8ca","55b74b2131bccb190081bedc","55bb441b54f9640d006e6cf2","565711085cb2420d00d70071","5681681330018c0d006bf7ff","588f38b5923d610f00c72dad"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"Version 1.0","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-23T11:26:09.169Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":true,"order":1,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"SendLocalMessageAction\"\n}\n[/block]\nShows a local push message with plain text.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\":::at:::type\\\": \\\"SendLocalMessageAction\\\",\\n  \\\"contentType\\\": \\\"text/plain\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"Come in and check out our new products!\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowHtmlAction\"\n}\n[/block]\nShows a local push message with HTML code.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowHtmlAction\\\",\\n  \\\"contentType\\\": \\\"text/html\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"<style>\\\\\\\\\\\\nbody {\\\\\\\\\\\\n\\\\\\\\tbackground-color: #dddddd;\\\\\\\\\\\\n\\\\\\\\ttext-align: center;\\\\\\\\\\\\n\\\\\\\\tfont-family: \\\\\\\"futura\\\\\\\";\\\\\\\\\\\\n\\\\\\\\tfont-size: 20px;\\\\\\\\\\\\n}\\\\\\\\\\\\n.logo {\\\\\\\\\\\\n\\\\\\\\twidth: 100%;\\\\\\\\\\\\n}\\\\\\\\\\\\n.title {\\\\\\\\\\\\n\\\\\\\\tfont-size: 1.25em;\\\\\\\\\\\\n\\\\\\\\tcolor: black;\\\\\\\\\\\\n}\\\\\\\\\\\\n.wrapper {\\\\\\\\\\\\n\\\\\\\\tmargin: 10% 5%;\\\\\\\\\\\\n}\\\\\\\\\\\\n.button {\\\\\\\\\\\\n\\\\\\\\tmargin: 0 2.5%;\\\\\\\\\\\\n\\\\\\\\tpadding: 10px 0;\\\\\\\\\\\\n\\\\\\\\twidth: 45%;\\\\\\\\\\\\n\\\\\\\\tbackground: #bf0d3f;\\\\\\\\\\\\n\\\\\\\\tborder-radius: 5px;\\\\\\\\\\\\n\\\\\\\\tfloat: left;\\\\\\\\\\\\n}\\\\\\\\\\\\na {\\\\\\\\\\\\n\\\\\\\\tcolor: white;\\\\\\\\\\\\n}\\\\\\\\\\\\n</style>\\\\\\\\\\\\n<div>\\\\\\\\\\\\n\\\\\\\\t<img class=\\\\\\\"logo\\\\\\\" src=\\\\\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\\\\\"/>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n<div class=\\\\\\\"title\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n<div class=\\\\\\\"wrapper\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t<a href=\\\\\\\"http://mocaplatform.com/\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t\\\\\\\\t<div class=\\\\\\\"button\\\\\\\">Go to web</div>\\\\\\\\\\\\n\\\\\\\\t</a>\\\\\\\\\\\\n\\\\\\\\t<a href=\\\\\\\"mocasdk://closeme\\\\\\\">\\\\\\\\\\\\n\\\\\\\\t\\\\\\\\t<div class=\\\\\\\"button\\\\\\\">Dismiss</div>\\\\\\\\\\\\n\\\\\\\\t</a>\\\\\\\\\\\\n</div>\\\\\\\\\\\\n\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Welcome to MOCA!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Background Alert\",\n  \"body\": \"If the App is not in foreground, the message in `bgAlert` will be shown as a notification. When the user opens it, the HTML message will be shown.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Content length\",\n  \"body\": \"The maximum allowed size for a message is 50kb\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowImageAction\"\n}\n[/block]\nShows a local push message with an image.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowImageAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Image!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowVideoAction\"\n}\n[/block]\nShows a local push message with video.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowVideoAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.your-site.com/your-video-url\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"PlaySoundAction\"\n}\n[/block]\nPlays a sound file from the application package.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"PlaySoundAction\\\",\\n  \\\"contentType\\\": \\\"text/plain\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"my-sound.wav\\\"\\n  },\\n  \\\"bgAlert\\\": {}\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"OpenUrlAction\"\n}\n[/block]\nOpens a URL.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"OpenUrlAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"Check our website!\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"ShowCardAction\"\n}\n[/block]\nThis action enables you to deliver loyalty cards, event tickets, discount coupons or custom cards to your users from Passbook, Google Wallet and similar.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"ShowCardAction\\\",\\n  \\\"contentType\\\": \\\"text/x-url\\\",\\n  \\\"content\\\": {\\n    \\\"default\\\": \\\"http://www.your-site.com/your-passcard-url.pkpass\\\"\\n  },\\n  \\\"bgAlert\\\": {\\n    \\\"default\\\": \\\"You have a new card available. Open it now?\\\"\\n  },\\n  \\\"cardProvider\\\": \\\"apple-passbook\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"TagAction\"\n}\n[/block]\nAdds a tag to the user. You can optionally add a value for the tag (Accepted values are numbers preceded by a plus sign, a minus sign, or none)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"TagAction\\\",\\n  \\\"tagName\\\": \\\"EntranceTag\\\",\\n  \\\"actionValue\\\": \\\"+2\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CustomAction\"\n}\n[/block]\nWhen fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CustomAction\\\",\\n  \\\"customArgument\\\": \\\"CustomActionCallback\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"CompositeAction\"\n}\n[/block]\nA collection of actions. All children actions are executed when the experience is triggered.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"@type\\\": \\\"CompositeAction\\\",\\n  \\\"list\\\": [\\n    {\\n      \\\"@type\\\": \\\"OpenUrlAction\\\",\\n      \\\"contentType\\\": \\\"text/x-url\\\",\\n      \\\"content\\\": {\\n        \\\"default\\\": \\\"http://www.mocaplatform.com\\\"\\n      },\\n      \\\"bgAlert\\\": {\\n        \\\"default\\\": \\\"Check our website!\\\"\\n      }\\n    },\\n    {\\n      \\\"@type\\\": \\\"PlaySoundAction\\\",\\n      \\\"contentType\\\": \\\"text/plain\\\",\\n      \\\"content\\\": {\\n        \\\"default\\\": \\\"my-sound.wav\\\"\\n      },\\n      \\\"bgAlert\\\": {}\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"Defines what action is executed when an experience is triggered.","slug":"actions","type":"basic","title":"Actions"}

Actions

Defines what action is executed when an experience is triggered.

[block:api-header] { "type": "basic", "title": "SendLocalMessageAction" } [/block] Shows a local push message with plain text. [block:code] { "codes": [ { "code": "{\n \"@type\": \"SendLocalMessageAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"Come in and check out our new products!\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowHtmlAction" } [/block] Shows a local push message with HTML code. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowHtmlAction\",\n \"contentType\": \"text/html\",\n \"content\": {\n \"default\": \"<style>\\\\\\nbody {\\\\\\n\\\\tbackground-color: #dddddd;\\\\\\n\\\\ttext-align: center;\\\\\\n\\\\tfont-family: \\\"futura\\\";\\\\\\n\\\\tfont-size: 20px;\\\\\\n}\\\\\\n.logo {\\\\\\n\\\\twidth: 100%;\\\\\\n}\\\\\\n.title {\\\\\\n\\\\tfont-size: 1.25em;\\\\\\n\\\\tcolor: black;\\\\\\n}\\\\\\n.wrapper {\\\\\\n\\\\tmargin: 10% 5%;\\\\\\n}\\\\\\n.button {\\\\\\n\\\\tmargin: 0 2.5%;\\\\\\n\\\\tpadding: 10px 0;\\\\\\n\\\\twidth: 45%;\\\\\\n\\\\tbackground: #bf0d3f;\\\\\\n\\\\tborder-radius: 5px;\\\\\\n\\\\tfloat: left;\\\\\\n}\\\\\\na {\\\\\\n\\\\tcolor: white;\\\\\\n}\\\\\\n</style>\\\\\\n<div>\\\\\\n\\\\t<img class=\\\"logo\\\" src=\\\"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\\\"/>\\\\\\n</div>\\\\\\n<div class=\\\"title\\\">\\\\\\n\\\\t<B>WELCOME TO MOCA PLATFORM</B>\\\\\\n</div>\\\\\\n<div class=\\\"wrapper\\\">\\\\\\n\\\\t<a href=\\\"http://mocaplatform.com/\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Go to web</div>\\\\\\n\\\\t</a>\\\\\\n\\\\t<a href=\\\"mocasdk://closeme\\\">\\\\\\n\\\\t\\\\t<div class=\\\"button\\\">Dismiss</div>\\\\\\n\\\\t</a>\\\\\\n</div>\\\\\\n\"\n },\n \"bgAlert\": {\n \"default\": \"Welcome to MOCA!\"\n }\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Background Alert", "body": "If the App is not in foreground, the message in `bgAlert` will be shown as a notification. When the user opens it, the HTML message will be shown." } [/block] [block:callout] { "type": "danger", "title": "Content length", "body": "The maximum allowed size for a message is 50kb" } [/block] [block:api-header] { "type": "basic", "title": "ShowImageAction" } [/block] Shows a local push message with an image. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowImageAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"https://d1ejjz5qg15st4.cloudfront.net/avatars/orgs/345q3bzte0fqamqn2uatixvkq.png\"\n },\n \"bgAlert\": {\n \"default\": \"Image!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowVideoAction" } [/block] Shows a local push message with video. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowVideoAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-video-url\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "PlaySoundAction" } [/block] Plays a sound file from the application package. [block:code] { "codes": [ { "code": "{\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "OpenUrlAction" } [/block] Opens a URL. [block:code] { "codes": [ { "code": "{\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "ShowCardAction" } [/block] This action enables you to deliver loyalty cards, event tickets, discount coupons or custom cards to your users from Passbook, Google Wallet and similar. [block:code] { "codes": [ { "code": "{\n \"@type\": \"ShowCardAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.your-site.com/your-passcard-url.pkpass\"\n },\n \"bgAlert\": {\n \"default\": \"You have a new card available. Open it now?\"\n },\n \"cardProvider\": \"apple-passbook\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "TagAction" } [/block] Adds a tag to the user. You can optionally add a value for the tag (Accepted values are numbers preceded by a plus sign, a minus sign, or none) [block:code] { "codes": [ { "code": "{\n \"@type\": \"TagAction\",\n \"tagName\": \"EntranceTag\",\n \"actionValue\": \"+2\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CustomAction" } [/block] When fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CustomAction\",\n \"customArgument\": \"CustomActionCallback\"\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "CompositeAction" } [/block] A collection of actions. All children actions are executed when the experience is triggered. [block:code] { "codes": [ { "code": "{\n \"@type\": \"CompositeAction\",\n \"list\": [\n {\n \"@type\": \"OpenUrlAction\",\n \"contentType\": \"text/x-url\",\n \"content\": {\n \"default\": \"http://www.mocaplatform.com\"\n },\n \"bgAlert\": {\n \"default\": \"Check our website!\"\n }\n },\n {\n \"@type\": \"PlaySoundAction\",\n \"contentType\": \"text/plain\",\n \"content\": {\n \"default\": \"my-sound.wav\"\n },\n \"bgAlert\": {}\n }\n ]\n}", "language": "json" } ] } [/block]