Log In

Actions

Defines what action is executed when an experience is triggered.

SendLocalMessageAction

Shows a local push message with plain text.

{
  "@type": "SendLocalMessageAction",
  "contentType": "text/plain",
  "content": {
    "default": "Come in and check out our new products!"
  },
  "bgAlert": {}
}

ShowHtmlAction

Shows a local push message with HTML code.

{
  "@type": "ShowHtmlAction",
  "contentType": "text/html",
  "content": {
    "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"
  },
  "bgAlert": {
    "default": "Welcome to MOCA!"
  }
}

🚧

Background Alert

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.

❗️

Content length

The maximum allowed size for a message is 50kb

OpenUrlAction

Opens a URL.

{
  "@type": "OpenUrlAction",
  "contentType": "text/x-url",
  "content": {
    "default": "http://www.mocaplatform.com"
  },
  "bgAlert": {
    "default": "Check our website!"
  }
}

TagAction

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)

{
  "@type": "TagAction",
  "tagName": "EntranceTag",
  "actionValue": "+2"
}

CustomAction

When fired, this action invokes an app-developer provided custom callback. The callback is invoked with a provided string attribute.

{
  "@type": "CustomAction",
  "customArgument": "CustomActionCallback"
}