{"_id":"59e70b9fe027ae002e7d2f14","category":{"_id":"59e70b9ee027ae002e7d2eda","version":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-12-21T18:49:06.424Z","from_sync":false,"order":8,"slug":"structures","title":"Structures"},"user":"5496d353f52a630b00519cdc","project":"5496d393f52a630b00519cdd","parentDoc":null,"version":{"_id":"59e70b9ee027ae002e7d2ed2","project":"5496d393f52a630b00519cdd","__v":2,"createdAt":"2017-10-18T08:06:54.462Z","releaseDate":"2017-10-18T08:06:54.462Z","categories":["59e70b9ee027ae002e7d2ed3","59e70b9ee027ae002e7d2ed4","59e70b9ee027ae002e7d2ed5","59e70b9ee027ae002e7d2ed6","59e70b9ee027ae002e7d2ed7","59e70b9ee027ae002e7d2ed8","59e70b9ee027ae002e7d2ed9","59e70b9ee027ae002e7d2eda","59e70b9ee027ae002e7d2edb","59e70b9ee027ae002e7d2edc","59e70b9ee027ae002e7d2edd","59e70b9ee027ae002e7d2ede","59e70b9ee027ae002e7d2edf","5b8661ccdd19310003a3fa0b"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.10","version":"2.0.10"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-06-27T12:30:37.455Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":9,"body":"Trigger response is structured as follows:\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"1-0\": \"rule\",\n    \"1-1\": \"Contains the triggering rule information. ee [Rule Structure](#rule-structure).\",\n    \"2-0\": \"user_info\",\n    \"2-1\": \"Contains the User ID, Device ID, App Key and Custom Data.\",\n    \"3-0\": \"visit\",\n    \"3-1\": \"Contains the visit information and place information if needed. See [Visit Structure](doc:visit)\",\n    \"0-0\": \"id\",\n    \"0-1\": \"The trigger ID. Example: 56eea860fdef26678540cdb7\"\n  },\n  \"cols\": 2,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Rule Structure\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Field\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Example\",\n    \"0-0\": \"id\",\n    \"0-3\": \"516c1fabea1ffbd953545e46\",\n    \"0-1\": \"The rule ID.\",\n    \"0-2\": \"string\",\n    \"1-0\": \"tag\",\n    \"1-1\": \"The rule custom tag.\",\n    \"1-2\": \"string\",\n    \"1-3\": \"\\\"Wallmart rule\\\"\",\n    \"2-0\": \"event\",\n    \"2-1\": \"Can be either \\\"arrival\\\" or \\\"departure\\\".\",\n    \"2-2\": \"string\",\n    \"2-3\": \"\\\"arrival\\\"\",\n    \"3-0\": \"time_delay\",\n    \"3-1\": \"The rule time delay in minutes. The default value is 0 (trigger is called immediately)\",\n    \"3-2\": \"integer\",\n    \"3-3\": \"0\",\n    \"4-0\": \"geofence_hits\",\n    \"4-1\": \"Available only in rules that are based on geofences.\",\n    \"4-2\": \"JSON array of [Geofence Structure](doc:geofence)\",\n    \"5-0\": \"place_type_hits\",\n    \"5-1\": \"Available only in rules that are based on place types.\",\n    \"5-2\": \"JSON array of place type object information.\",\n    \"6-0\": \"custom_hits\",\n    \"6-1\": \"Custom hits are tailor made to your use case. Please contact your account manager to configure them.\"\n  },\n  \"cols\": 4,\n  \"rows\": 7\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Trigger Response Examples\"\n}\n[/block]\n##Place Type Trigger\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"data\\\": {\\n    \\\"user_info\\\": {\\n      \\\"user_id\\\": \\\"YOUR_USER_ID\\\",\\n      \\\"app_key\\\": \\\"APP_KEY\\\",\\n      \\\"device_id\\\": \\\"5772c1b9fdef26427a455153\\\"\\n    },\\n    \\\"visit\\\": {\\n      \\\"event_type\\\": \\\"visit\\\",\\n      \\\"is_confirmed\\\": false,\\n      \\\"start_time\\\": \\\"2016-10-04T10:47:12.000-07:00\\\",\\n      \\\"place_id\\\": \\\"57f3e746e4b01d4af1e1c050\\\",\\n      \\\"place\\\": {\\n        \\\"estimated_address\\\": {\\n          \\\"city\\\": \\\"San Francisco\\\",\\n          \\\"country\\\": \\\"United States\\\",\\n          \\\"state\\\": \\\"California\\\",\\n          \\\"formatted_city\\\": \\\"San Francisco, California, United States\\\",\\n          \\\"postal_code\\\": \\\"94103\\\",\\n          \\\"formatted_address\\\": \\\"135 4th Street, San Francisco, California, United States\\\",\\n          \\\"street_address\\\": \\\"135 4th Street\\\"\\n        },\\n        \\\"estimated_geolocation\\\": {\\n          \\\"lat\\\": 37.784469903416,\\n          \\\"long\\\": -122.40330482239,\\n          \\\"accuracy\\\": 3.3771327633926\\n        },\\n        \\\"type_id\\\": 20,\\n        \\\"venue_info\\\": {\\n          \\\"category\\\": \\\"Shop & Service\\\",\\n          \\\"name\\\": \\\"Metreon\\\",\\n          \\\"probability\\\": 0.85,\\n          \\\"sub_category\\\": \\\"Mall\\\"\\n        },\\n        \\\"first_visit_time\\\": \\\"2016-10-04T16:03:11.000Z\\\",\\n        \\\"venues\\\": [\\n          {\\n          \\t\\\"category\\\": \\\"Shop & Service\\\",\\n\\t          \\\"name\\\": \\\"Metreon\\\",\\n  \\t        \\\"probability\\\": 0.85,\\n    \\t      \\\"sub_category\\\": \\\"Mall\\\"\\n        \\t},\\n          {\\n            \\\"category\\\": \\\"Food\\\",\\n            \\\"name\\\": \\\"Mel's Drive-In\\\",\\n            \\\"probability\\\": 0.06,\\n            \\\"sub_category\\\": \\\"Diner\\\"\\n          },\\n          {\\n            \\\"category\\\": \\\"Shop & Service\\\",\\n            \\\"name\\\": \\\"Off the Grid: 5M :::at::: Fifth and Minna\\\",\\n            \\\"probability\\\": 0.04,\\n            \\\"sub_category\\\": \\\"Street Food Gathering\\\"\\n          },\\n          {\\n            \\\"category\\\": \\\"Food\\\",\\n            \\\"name\\\": \\\"Sharetea\\\",\\n            \\\"probability\\\": 0.04,\\n            \\\"sub_category\\\": \\\"Bubble Tea Shop\\\"\\n          }\\n        ],\\n        \\\"last_visit_time\\\": \\\"2016-10-04T17:54:21.000Z\\\",\\n        \\\"type\\\": \\\"Shop & Service\\\",\\n        \\\"id\\\": \\\"57f3e746e4b01d4af1e1c050\\\"\\n      },\\n      \\\"id\\\": \\\"57f3eccdfdef263fe1e66df8\\\"\\n    },\\n    \\\"id\\\": \\\"57f4235dfdef264999b81940\\\",\\n    \\\"rule\\\": {\\n      \\\"time_delay\\\": 0,\\n      \\\"place_type_hits\\\": [\\n        {\\n          \\\"tag\\\": \\\"YOUR_PLACE_TAG\\\",\\n          \\\"sub_category\\\": \\\"Mall\\\"\\n          \\\"place_type\\\": \\\"Shop & Service\\\"\\n        }\\n      ],\\n      \\\"tag\\\": \\\"YOUR_RULE_TAG\\\",\\n      \\\"id\\\": \\\"RULE_ID\\\",\\n      \\\"event\\\": \\\"arrival\\\"\\n    }\\n  },\\n  \\\"result\\\": \\\"SUCCESS\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n##Geofence Trigger\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"rule\\\":{\\n    \\\"id\\\":\\\"516c1fabea1ffbd953545e46\\\",\\n    \\\"tag\\\":\\\"geofence_type_custom_tag\\\",\\n    \\\"event\\\":\\\"arrival\\\",\\n    \\\"time_delay\\\":30,\\n    \\\"geofence_hits\\\": [\\n      {\\n        \\\"id\\\": \\\"23ca26d59473d40402bec561\\\",\\n        \\\"location\\\": {\\n          \\\"lat\\\": 39.524765,\\n          \\\"long\\\": 2.735162,\\n          \\\"radius\\\": 125\\n        },\\n        \\\"tag\\\": \\\"YOUR GEOFENCE TAG\\\",\\n        \\\"push_text\\\":\\\"YOUR PUSH TEXT\\\"\\n      }\\n    ]\\n  },\\n  \\\"user_info\\\": {\\n    \\\"device_id\\\": \\\"53ce26d59473d40002beb577\\\",\\n    \\\"user_id\\\": \\\"YOUR USER ID\\\"\\n  },\\n  \\\"visit\\\": {\\n    \\\"start_time\\\": \\\"2015-06-02 12:39:37.378754\\\"\\n  }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"The trigger response JSON structure","slug":"triggers","type":"basic","title":"Trigger Response"}

Trigger Response

The trigger response JSON structure

Trigger response is structured as follows: [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "1-0": "rule", "1-1": "Contains the triggering rule information. ee [Rule Structure](#rule-structure).", "2-0": "user_info", "2-1": "Contains the User ID, Device ID, App Key and Custom Data.", "3-0": "visit", "3-1": "Contains the visit information and place information if needed. See [Visit Structure](doc:visit)", "0-0": "id", "0-1": "The trigger ID. Example: 56eea860fdef26678540cdb7" }, "cols": 2, "rows": 4 } [/block] [block:api-header] { "type": "basic", "title": "Rule Structure" } [/block] [block:parameters] { "data": { "h-0": "Field", "h-1": "Description", "h-2": "Type", "h-3": "Example", "0-0": "id", "0-3": "516c1fabea1ffbd953545e46", "0-1": "The rule ID.", "0-2": "string", "1-0": "tag", "1-1": "The rule custom tag.", "1-2": "string", "1-3": "\"Wallmart rule\"", "2-0": "event", "2-1": "Can be either \"arrival\" or \"departure\".", "2-2": "string", "2-3": "\"arrival\"", "3-0": "time_delay", "3-1": "The rule time delay in minutes. The default value is 0 (trigger is called immediately)", "3-2": "integer", "3-3": "0", "4-0": "geofence_hits", "4-1": "Available only in rules that are based on geofences.", "4-2": "JSON array of [Geofence Structure](doc:geofence)", "5-0": "place_type_hits", "5-1": "Available only in rules that are based on place types.", "5-2": "JSON array of place type object information.", "6-0": "custom_hits", "6-1": "Custom hits are tailor made to your use case. Please contact your account manager to configure them." }, "cols": 4, "rows": 7 } [/block] [block:api-header] { "type": "basic", "title": "Trigger Response Examples" } [/block] ##Place Type Trigger [block:code] { "codes": [ { "code": "{\n \"data\": {\n \"user_info\": {\n \"user_id\": \"YOUR_USER_ID\",\n \"app_key\": \"APP_KEY\",\n \"device_id\": \"5772c1b9fdef26427a455153\"\n },\n \"visit\": {\n \"event_type\": \"visit\",\n \"is_confirmed\": false,\n \"start_time\": \"2016-10-04T10:47:12.000-07:00\",\n \"place_id\": \"57f3e746e4b01d4af1e1c050\",\n \"place\": {\n \"estimated_address\": {\n \"city\": \"San Francisco\",\n \"country\": \"United States\",\n \"state\": \"California\",\n \"formatted_city\": \"San Francisco, California, United States\",\n \"postal_code\": \"94103\",\n \"formatted_address\": \"135 4th Street, San Francisco, California, United States\",\n \"street_address\": \"135 4th Street\"\n },\n \"estimated_geolocation\": {\n \"lat\": 37.784469903416,\n \"long\": -122.40330482239,\n \"accuracy\": 3.3771327633926\n },\n \"type_id\": 20,\n \"venue_info\": {\n \"category\": \"Shop & Service\",\n \"name\": \"Metreon\",\n \"probability\": 0.85,\n \"sub_category\": \"Mall\"\n },\n \"first_visit_time\": \"2016-10-04T16:03:11.000Z\",\n \"venues\": [\n {\n \t\"category\": \"Shop & Service\",\n\t \"name\": \"Metreon\",\n \t \"probability\": 0.85,\n \t \"sub_category\": \"Mall\"\n \t},\n {\n \"category\": \"Food\",\n \"name\": \"Mel's Drive-In\",\n \"probability\": 0.06,\n \"sub_category\": \"Diner\"\n },\n {\n \"category\": \"Shop & Service\",\n \"name\": \"Off the Grid: 5M @ Fifth and Minna\",\n \"probability\": 0.04,\n \"sub_category\": \"Street Food Gathering\"\n },\n {\n \"category\": \"Food\",\n \"name\": \"Sharetea\",\n \"probability\": 0.04,\n \"sub_category\": \"Bubble Tea Shop\"\n }\n ],\n \"last_visit_time\": \"2016-10-04T17:54:21.000Z\",\n \"type\": \"Shop & Service\",\n \"id\": \"57f3e746e4b01d4af1e1c050\"\n },\n \"id\": \"57f3eccdfdef263fe1e66df8\"\n },\n \"id\": \"57f4235dfdef264999b81940\",\n \"rule\": {\n \"time_delay\": 0,\n \"place_type_hits\": [\n {\n \"tag\": \"YOUR_PLACE_TAG\",\n \"sub_category\": \"Mall\"\n \"place_type\": \"Shop & Service\"\n }\n ],\n \"tag\": \"YOUR_RULE_TAG\",\n \"id\": \"RULE_ID\",\n \"event\": \"arrival\"\n }\n },\n \"result\": \"SUCCESS\"\n}", "language": "json" } ] } [/block] ##Geofence Trigger [block:code] { "codes": [ { "code": "{\n \"rule\":{\n \"id\":\"516c1fabea1ffbd953545e46\",\n \"tag\":\"geofence_type_custom_tag\",\n \"event\":\"arrival\",\n \"time_delay\":30,\n \"geofence_hits\": [\n {\n \"id\": \"23ca26d59473d40402bec561\",\n \"location\": {\n \"lat\": 39.524765,\n \"long\": 2.735162,\n \"radius\": 125\n },\n \"tag\": \"YOUR GEOFENCE TAG\",\n \"push_text\":\"YOUR PUSH TEXT\"\n }\n ]\n },\n \"user_info\": {\n \"device_id\": \"53ce26d59473d40002beb577\",\n \"user_id\": \"YOUR USER ID\"\n },\n \"visit\": {\n \"start_time\": \"2015-06-02 12:39:37.378754\"\n }\n}", "language": "json" } ] } [/block]