{"_id":"5951d99af544fe0015385a86","project":"56f962d8d522d81700600280","version":{"_id":"56f962d8d522d81700600283","hasDoc":true,"__v":5,"hasReference":true,"project":"56f962d8d522d81700600280","createdAt":"2016-03-28T16:59:04.166Z","releaseDate":"2016-03-28T16:59:04.166Z","categories":["56f962d8d522d81700600284","5951d5489435c30015923d54","5951d6de50727a00155053c6","5951d99224e2f70015dec6c6","5951e40ef5c137001533814b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"category":{"_id":"5951d5489435c30015923d54","project":"56f962d8d522d81700600280","version":"56f962d8d522d81700600283","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-27T03:47:20.769Z","from_sync":false,"order":1,"slug":"tasks","title":"Reference"},"user":"57736a020a6d610e00dea1fd","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-06-27T04:05:46.643Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"Webhooks make it possible for your application to be notified of important system events, as soon as these take place within Wimo.\n\nWhile you are generally able to create as many webhook entries as you'd like, remember that a single webhook always targets a single trigger. The following triggers are available:\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Value\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"TASK_START\",\n    \"0-1\": \"1\",\n    \"0-2\": \"Task started by driver.\",\n    \"1-0\": \"TASK_COMPLETE\",\n    \"1-1\": \"2\",\n    \"1-2\": \"Task completed by driver.\",\n    \"2-0\": \"TASK_FAILED\",\n    \"2-1\": \"3\",\n    \"2-2\": \"Task failed.\",\n    \"3-0\": \"TASK_CREATED\",\n    \"3-1\": \"4\",\n    \"3-2\": \"New task created.\",\n    \"4-0\": \"TASK_UPDATED\",\n    \"4-2\": \"Task updated, including assignment, feedback and attachment (photo, signature) changes.\",\n    \"4-1\": \"5\",\n    \"5-0\": \"TASK_DELETED\",\n    \"5-1\": \"6\",\n    \"5-2\": \"Task deleted.\",\n    \"6-0\": \"TASK_ASSIGNED\",\n    \"6-1\": \"7\",\n    \"6-2\": \"Task assigned to driver.\",\n    \"7-0\": \"TASK_UNASSIGNED\",\n    \"7-1\": \"8\",\n    \"7-2\": \"Task unassigned from driver.\",\n    \"8-0\": \"TASK_GEOCODED\",\n    \"8-1\": \"9\",\n    \"8-2\": \"task geocoded.\"\n  },\n  \"cols\": 3,\n  \"rows\": 9\n}\n[/block]\nWebhooks are created, retrieved and deleted via API only. All standard, non-validation requests are made via POST.\n\nIn addition to the properties from the Includes column above, the JSON body we will POST to your url will include a time property along with triggerId and triggerName so you may overload the same url on your application as required. In addition, full objects will be provided in the data property, as relevant. Note that all other properties not relevant to the trigger may be provided as null.\n\n[block:html]\n{\n  \"html\": \"<span style=\\\"background-color: #248FB2; color:white; padding-left:5px; padding-right:5px;\\\">Post</span>\\n<a href=\\\"https://docs.wimo.ae/docs/add-webhook\\\">Add Webhook</a>\"\n}\n[/block]\n\nBody parameters\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"url\",\n    \"0-1\": \"String\",\n    \"0-2\": \"The URL that Wimo should issue a request against as soon as the trigger condition is met.\",\n    \"1-0\": \"trigger\",\n    \"1-1\": \"Integer\",\n    \"1-2\": \"The number corresponding to the trigger condition on which the webhook should fire.\"\n  },\n  \"cols\": 3,\n  \"rows\": 2\n}\n[/block]\nTo create a new webhook, provide a verifiable url and trigger.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --request POST \\\\\\n  --url https://be.wimo.ae:3001/api/v1/webHooks \\\\\\n  --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90' \\\\\\n  --data '{\\\"url\\\":\\\"http://requestb.in/zw3zgzzw\\\",\\\"trigger\\\":8}'\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"success\\\": true,\\n    \\\"webHook\\\": {\\n        \\\"id\\\": 63,\\n        \\\"url\\\": \\\"http://requestb.in/zw3zgzzw\\\",\\n        \\\"trigger\\\": 8,\\n        \\\"companyId\\\": 5400,\\n        \\\"updatedAt\\\": \\\"2017-06-27T07:21:29.000Z\\\",\\n        \\\"createdAt\\\": \\\"2017-06-27T07:21:29.000Z\\\"\\n    }\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<span style=\\\"background-color: #6BBD5B; color:white; padding-left:5px; padding-right:5px;\\\">Get</span>\\n<a href=\\\"https://docs.wimo.ae/docs/get-list-webhooks\\\">Get List Webhooks</a>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --request GET \\\\\\n  --url https://be.wimo.ae:3001/api/v1/webHooks \\\\\\n  --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90'\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"success\\\": true,\\n    \\\"webHooks\\\": [\\n        {\\n            \\\"id\\\": 60,\\n            \\\"url\\\": \\\"http://requestb.in/12ercjp1\\\",\\n            \\\"trigger\\\": 4,\\n            \\\"createdAt\\\": \\\"2017-03-27T08:07:54.000Z\\\",\\n            \\\"updatedAt\\\": \\\"2017-03-27T08:07:54.000Z\\\",\\n            \\\"companyId\\\": 5400\\n        },\\n        {\\n            \\\"id\\\": 61,\\n            \\\"url\\\": \\\"http://requestb.in/t51cq6t5\\\",\\n            \\\"trigger\\\": 4,\\n            \\\"createdAt\\\": \\\"2017-04-05T10:41:12.000Z\\\",\\n            \\\"updatedAt\\\": \\\"2017-04-05T10:41:12.000Z\\\",\\n            \\\"companyId\\\": 5400\\n        },\\n        {\\n            \\\"id\\\": 62,\\n            \\\"url\\\": \\\"http://requestb.in/zw3zgzzwmi\\\",\\n            \\\"trigger\\\": 8,\\n            \\\"createdAt\\\": \\\"2017-06-27T04:41:13.000Z\\\",\\n            \\\"updatedAt\\\": \\\"2017-06-27T04:41:13.000Z\\\",\\n            \\\"companyId\\\": 5400\\n        }\\n    ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<span style=\\\"background-color: #E27A7A; color:white; padding-left:5px; padding-right:5px;\\\">Delete</span>\\n<a href=\\\"https://docs.wimo.ae/docs/delete-webhook\\\">Delete Webhook</a>\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl --request DELETE \\\\\\n  --url https://be.wimo.ae:3001/api/v1/webHooks/62 \\\\\\n  --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90'\\n\\n\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"success\\\": true\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"webhooks","type":"basic","title":"WebHooks"}
Webhooks make it possible for your application to be notified of important system events, as soon as these take place within Wimo. While you are generally able to create as many webhook entries as you'd like, remember that a single webhook always targets a single trigger. The following triggers are available: [block:parameters] { "data": { "h-0": "Name", "h-1": "Value", "h-2": "Description", "0-0": "TASK_START", "0-1": "1", "0-2": "Task started by driver.", "1-0": "TASK_COMPLETE", "1-1": "2", "1-2": "Task completed by driver.", "2-0": "TASK_FAILED", "2-1": "3", "2-2": "Task failed.", "3-0": "TASK_CREATED", "3-1": "4", "3-2": "New task created.", "4-0": "TASK_UPDATED", "4-2": "Task updated, including assignment, feedback and attachment (photo, signature) changes.", "4-1": "5", "5-0": "TASK_DELETED", "5-1": "6", "5-2": "Task deleted.", "6-0": "TASK_ASSIGNED", "6-1": "7", "6-2": "Task assigned to driver.", "7-0": "TASK_UNASSIGNED", "7-1": "8", "7-2": "Task unassigned from driver.", "8-0": "TASK_GEOCODED", "8-1": "9", "8-2": "task geocoded." }, "cols": 3, "rows": 9 } [/block] Webhooks are created, retrieved and deleted via API only. All standard, non-validation requests are made via POST. In addition to the properties from the Includes column above, the JSON body we will POST to your url will include a time property along with triggerId and triggerName so you may overload the same url on your application as required. In addition, full objects will be provided in the data property, as relevant. Note that all other properties not relevant to the trigger may be provided as null. [block:html] { "html": "<span style=\"background-color: #248FB2; color:white; padding-left:5px; padding-right:5px;\">Post</span>\n<a href=\"https://docs.wimo.ae/docs/add-webhook\">Add Webhook</a>" } [/block] Body parameters [block:parameters] { "data": { "h-0": "Name", "h-1": "Type", "h-2": "Description", "0-0": "url", "0-1": "String", "0-2": "The URL that Wimo should issue a request against as soon as the trigger condition is met.", "1-0": "trigger", "1-1": "Integer", "1-2": "The number corresponding to the trigger condition on which the webhook should fire." }, "cols": 3, "rows": 2 } [/block] To create a new webhook, provide a verifiable url and trigger. [block:code] { "codes": [ { "code": "curl --request POST \\\n --url https://be.wimo.ae:3001/api/v1/webHooks \\\n --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90' \\\n --data '{\"url\":\"http://requestb.in/zw3zgzzw\",\"trigger\":8}'", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"success\": true,\n \"webHook\": {\n \"id\": 63,\n \"url\": \"http://requestb.in/zw3zgzzw\",\n \"trigger\": 8,\n \"companyId\": 5400,\n \"updatedAt\": \"2017-06-27T07:21:29.000Z\",\n \"createdAt\": \"2017-06-27T07:21:29.000Z\"\n }\n}", "language": "json" } ] } [/block] [block:html] { "html": "<span style=\"background-color: #6BBD5B; color:white; padding-left:5px; padding-right:5px;\">Get</span>\n<a href=\"https://docs.wimo.ae/docs/get-list-webhooks\">Get List Webhooks</a>" } [/block] [block:code] { "codes": [ { "code": "curl --request GET \\\n --url https://be.wimo.ae:3001/api/v1/webHooks \\\n --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90'", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"success\": true,\n \"webHooks\": [\n {\n \"id\": 60,\n \"url\": \"http://requestb.in/12ercjp1\",\n \"trigger\": 4,\n \"createdAt\": \"2017-03-27T08:07:54.000Z\",\n \"updatedAt\": \"2017-03-27T08:07:54.000Z\",\n \"companyId\": 5400\n },\n {\n \"id\": 61,\n \"url\": \"http://requestb.in/t51cq6t5\",\n \"trigger\": 4,\n \"createdAt\": \"2017-04-05T10:41:12.000Z\",\n \"updatedAt\": \"2017-04-05T10:41:12.000Z\",\n \"companyId\": 5400\n },\n {\n \"id\": 62,\n \"url\": \"http://requestb.in/zw3zgzzwmi\",\n \"trigger\": 8,\n \"createdAt\": \"2017-06-27T04:41:13.000Z\",\n \"updatedAt\": \"2017-06-27T04:41:13.000Z\",\n \"companyId\": 5400\n }\n ]\n}", "language": "json" } ] } [/block] [block:html] { "html": "<span style=\"background-color: #E27A7A; color:white; padding-left:5px; padding-right:5px;\">Delete</span>\n<a href=\"https://docs.wimo.ae/docs/delete-webhook\">Delete Webhook</a>" } [/block] [block:code] { "codes": [ { "code": "curl --request DELETE \\\n --url https://be.wimo.ae:3001/api/v1/webHooks/62 \\\n --header 'authorization: 95de9ce1f12861dca3335cc87b5cfd90'\n\n", "language": "shell" } ] } [/block] [block:code] { "codes": [ { "code": "{\n \"success\": true\n}", "language": "json" } ] } [/block]