{"_id":"585aa01755db7137001e691d","category":{"_id":"582dc59ee1b8692300c0dd03","__v":0,"project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-11-17T14:58:38.431Z","from_sync":false,"order":15,"slug":"line","title":"LINE messaging"},"__v":0,"user":"57a98d832242630e00cc8df7","project":"54eb50e5615ffc1900305a16","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":27,"createdAt":"2015-02-23T17:30:32.501Z","releaseDate":"2015-02-23T17:30:32.501Z","categories":["54eb63b959b1172100334faf","54eb63b959b1172100334fb0","54eb63b959b1172100334fb1","54eb63b959b1172100334fb2","54ed8dd4ab373e2300f50eae","54ed99b2ab373e2300f50ede","55153a6de68daa2f00cff838","551546edbc466623002afe72","5515472ac28d6125001b8884","55154749c28d6125001b8885","555d9b4106dfec0d00d38ea7","5613e06e433e5735007c7708","5624bbb785a31117001c5403","56669e857cc81e0d00253f8e","568b8d837a42220d00498311","56a632277ef6620d00e2f18a","56d8147c3eb4dd0b00201aac","57a9ce2fac6db30e000d7efd","57a9cf4e944ea60e00dc3f74","58172386715dce0f00da4aa0","582dc59ee1b8692300c0dd03","589b19b4fec2730f0082e040","58b04a023529383900a759b5","58b92d1598157a0f004869bf","592e7685c58275000f20174f","59392839e376d4002f8a0474","59393064e376d4002f8a05a1","5947ae0d4005e2000f3a4fec","594a74df1d1de5001ab3517a","5954bc387a147f001b918915"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-21T15:30:31.663Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[Sending messages](/docs/send-single-line-message-api) to your users over API is quite simple. When it comes to [receiving incoming messages](/docs/receive-line-message-api) from your users, you can choose between two methods:\n* **HTTP forward method** - allows you to receive messages from your subscribers in real-time\n* **Pull method** - allows you to fetch new messages from Infobip server over API at your convenience\n\nYou can choose your preferable method by configuring Action.\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important\",\n  \"body\": \"The Configuration container must be created before Action since Actions can exist only inside of the Configuration container.\"\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/5cad0c3-fb3.PNG\",\n        \"fb3.PNG\",\n        497,\n        92,\n        \"#e0d7d6\"\n      ],\n      \"sizing\": \"smart\",\n      \"caption\": \"\"\n    }\n  ]\n}\n[/block]\nAvailable methods\n* [List all actions](#list-all-actions)\n* [Create the new action](#create-new-action)\n* [Delete an action](#delete-action) \n\n##Action models\nDifferent actions have different models, depending on the logic that the action triggers. These models are used as a request and response bodies for GET and POST methods.\n\n### HTTP forward action\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"key\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Key of the action.\",\n    \"1-0\": \"type\",\n    \"1-1\": \"String\",\n    \"1-2\": \"Constant value - \\\"HTTP_FORWARD\\\"\",\n    \"2-0\": \"forwardUrl\",\n    \"2-1\": \"String\",\n    \"2-2\": \"URL that the received message will be forwarded to.\",\n    \"3-0\": \"callbackData\",\n    \"3-1\": \"String\",\n    \"3-2\": \"Optional. String that will be forwarded alongside the usual fields posted to forwardUrl.\"\n  },\n  \"cols\": 3,\n  \"rows\": 4\n}\n[/block]\n### Pull action\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Property name\",\n    \"h-1\": \"Type\",\n    \"h-2\": \"Description\",\n    \"0-0\": \"key\",\n    \"1-1\": \"String\",\n    \"1-0\": \"type\",\n    \"0-1\": \"String\",\n    \"0-2\": \"Key of the action.\",\n    \"1-2\": \"Constant value - \\\"PULL\\\"\",\n    \"2-0\": \"callbackData\",\n    \"2-1\": \"String\",\n    \"2-2\": \"Optional. String that will be forwarded alongside the usual fields posted to forwardUrl.\"\n  },\n  \"cols\": 3,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"List all actions\"\n}\n[/block]\nReturns actions for a given application configuration, if any.\n\n```\nhttps://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions\n```\n\n###Path params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|applicationKey|string|-|Application key|\n|configurationKey|string|-|Configuration key|\n\n###Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\n### Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"actions\\\": [\\n    {\\n      \\\"key\\\": \\\"{actionKey}\\\",\\n      \\\"type\\\": \\\"HTTP_FORWARD\\\",\\n      \\\"forwardUrl\\\": \\\"http://www.example.com/webhook?param=param\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nOn success, the response header HTTP status code will be `200 OK`. \n\n|Parameter|Type|Description|\n|-|-|-|\n|*actions*|String|List or actions.|\n|*key*|String|Application key.|\n|*type*|String|Action type.|\n|*forwardUrl*|String|Forward URL.|\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Create a new action\"\n}\n[/block]\nCreates an action.\n\n```\nhttps://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions\n```\n\n###Path params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|applicationKey|string|-|Application key|\n|configurationKey|string|-|Configuration key|\n\n###Request example: HTTP forward\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n    \\\"type\\\": \\\"HTTP_FORWARD\\\",\\n    \\\"forwardUrl\\\": \\\"https://www.myDomain.com/messageReceiver\\\",\\n    \\\"callbackData\\\": \\\"callbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"key\\\": \\\"{actionKey}\\\",\\n  \\\"type\\\": \\\"HTTP_FORWARD\\\",\\n  \\\"forwardUrl\\\": \\\"https://www.myDomain.com/messageReceiver\\\",\\n  \\\"callbackData\\\": \\\"callbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccess response is represented by a HTTP status code `200 OK`.\n\nSee [action models](#section-action-models) for request and response bodies.\n\nAttempt to create a new action when another action is already defined for a configuration will result in status `409 Conflict`.\n\n###Request example: Pull\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nContent-Type: application/json\\n\\n{\\n    \\\"type\\\": \\\"PULL\\\",\\n    \\\"callbackData\\\": \\\"callbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n### Response\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"key\\\": \\\"{actionKey}\\\",\\n  \\\"type\\\": \\\"PULL\\\",\\n  \\\"callbackData\\\": \\\"callbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccess response is represented by a HTTP status code `200 OK`.\n\nSee [action models](#section-action-models) for request and response bodies.\n\nAttempt to create a new action when another action is already defined for a configuration will result in status `409 Conflict`.\n[block:api-header]\n{\n  \"type\": \"delete\",\n  \"title\": \"Delete an action\"\n}\n[/block]\nDeletes an action.\n\n```\nhttps://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions/{actionKey}\n```\n\n###Path params\n\n|Parameter|Type|Default value|Description|\n|-|-|-|\n|applicationKey|string|-|Application key|\n|configurationKey|string|-|Configuration key|\n|actionKey|string|-|Action key|\n\n##Request example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"DELETE /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions/{actionKey}  HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\",\n      \"language\": \"http\"\n    }\n  ]\n}\n[/block]\nSuccess response is represented by a HTTP status code `204 No Content`. There is no response body.","excerpt":"Actions allow you to configure inbound messages delivery method.","slug":"line-chat-action","type":"basic","title":"Action"}

Action

Actions allow you to configure inbound messages delivery method.

[Sending messages](/docs/send-single-line-message-api) to your users over API is quite simple. When it comes to [receiving incoming messages](/docs/receive-line-message-api) from your users, you can choose between two methods: * **HTTP forward method** - allows you to receive messages from your subscribers in real-time * **Pull method** - allows you to fetch new messages from Infobip server over API at your convenience You can choose your preferable method by configuring Action. [block:callout] { "type": "warning", "title": "Important", "body": "The Configuration container must be created before Action since Actions can exist only inside of the Configuration container." } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/5cad0c3-fb3.PNG", "fb3.PNG", 497, 92, "#e0d7d6" ], "sizing": "smart", "caption": "" } ] } [/block] Available methods * [List all actions](#list-all-actions) * [Create the new action](#create-new-action) * [Delete an action](#delete-action) ##Action models Different actions have different models, depending on the logic that the action triggers. These models are used as a request and response bodies for GET and POST methods. ### HTTP forward action [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "key", "0-1": "String", "0-2": "Key of the action.", "1-0": "type", "1-1": "String", "1-2": "Constant value - \"HTTP_FORWARD\"", "2-0": "forwardUrl", "2-1": "String", "2-2": "URL that the received message will be forwarded to.", "3-0": "callbackData", "3-1": "String", "3-2": "Optional. String that will be forwarded alongside the usual fields posted to forwardUrl." }, "cols": 3, "rows": 4 } [/block] ### Pull action [block:parameters] { "data": { "h-0": "Property name", "h-1": "Type", "h-2": "Description", "0-0": "key", "1-1": "String", "1-0": "type", "0-1": "String", "0-2": "Key of the action.", "1-2": "Constant value - \"PULL\"", "2-0": "callbackData", "2-1": "String", "2-2": "Optional. String that will be forwarded alongside the usual fields posted to forwardUrl." }, "cols": 3, "rows": 3 } [/block] [block:api-header] { "type": "get", "title": "List all actions" } [/block] Returns actions for a given application configuration, if any. ``` https://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions ``` ###Path params |Parameter|Type|Default value|Description| |-|-|-| |applicationKey|string|-|Application key| |configurationKey|string|-|Configuration key| ###Request example [block:code] { "codes": [ { "code": "GET /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "language": "http" } ] } [/block] ### Response [block:code] { "codes": [ { "code": "{\n \"actions\": [\n {\n \"key\": \"{actionKey}\",\n \"type\": \"HTTP_FORWARD\",\n \"forwardUrl\": \"http://www.example.com/webhook?param=param\"\n }\n ]\n}", "language": "json" } ] } [/block] On success, the response header HTTP status code will be `200 OK`. |Parameter|Type|Description| |-|-|-| |*actions*|String|List or actions.| |*key*|String|Application key.| |*type*|String|Action type.| |*forwardUrl*|String|Forward URL.| [block:api-header] { "type": "post", "title": "Create a new action" } [/block] Creates an action. ``` https://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions ``` ###Path params |Parameter|Type|Default value|Description| |-|-|-| |applicationKey|string|-|Application key| |configurationKey|string|-|Configuration key| ###Request example: HTTP forward [block:code] { "codes": [ { "code": "POST /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"type\": \"HTTP_FORWARD\",\n \"forwardUrl\": \"https://www.myDomain.com/messageReceiver\",\n \"callbackData\": \"callbackData\"\n}", "language": "json" } ] } [/block] ### Response [block:code] { "codes": [ { "code": "{\n \"key\": \"{actionKey}\",\n \"type\": \"HTTP_FORWARD\",\n \"forwardUrl\": \"https://www.myDomain.com/messageReceiver\",\n \"callbackData\": \"callbackData\"\n}", "language": "json" } ] } [/block] Success response is represented by a HTTP status code `200 OK`. See [action models](#section-action-models) for request and response bodies. Attempt to create a new action when another action is already defined for a configuration will result in status `409 Conflict`. ###Request example: Pull [block:code] { "codes": [ { "code": "POST /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nContent-Type: application/json\n\n{\n \"type\": \"PULL\",\n \"callbackData\": \"callbackData\"\n}", "language": "json" } ] } [/block] ### Response [block:code] { "codes": [ { "code": "{\n \"key\": \"{actionKey}\",\n \"type\": \"PULL\",\n \"callbackData\": \"callbackData\"\n}", "language": "json" } ] } [/block] Success response is represented by a HTTP status code `200 OK`. See [action models](#section-action-models) for request and response bodies. Attempt to create a new action when another action is already defined for a configuration will result in status `409 Conflict`. [block:api-header] { "type": "delete", "title": "Delete an action" } [/block] Deletes an action. ``` https://api.infobip.com/line/1/applications/{applicationKey}/configurations/{configurationKey}/actions/{actionKey} ``` ###Path params |Parameter|Type|Default value|Description| |-|-|-| |applicationKey|string|-|Application key| |configurationKey|string|-|Configuration key| |actionKey|string|-|Action key| ##Request example [block:code] { "codes": [ { "code": "DELETE /line/1/applications/{applicationKey}/configurations/{configurationKey}/actions/{actionKey} HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", "language": "http" } ] } [/block] Success response is represented by a HTTP status code `204 No Content`. There is no response body.