{"_id":"58512c69488ec11900fa3196","project":"54eb50e5615ffc1900305a16","user":"54eb4fdedf7add210007b29b","parentDoc":null,"__v":0,"version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":28,"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","59b8eeeb707542001076d3b6"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"category":{"_id":"59392839e376d4002f8a0474","project":"54eb50e5615ffc1900305a16","version":"54eb63b859b1172100334fae","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2017-06-08T10:34:33.059Z","from_sync":false,"order":5,"slug":"numbers","title":"Numbers"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-14T11:26:33.662Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"This documentation will help you configure the method for receiving incoming SMS messages and Voice services. Before configuring an Action, you must have a [phone number](/docs/phone-number) and [Configuration container](/docs/number-configuration) ready.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/6af562b-sms4.PNG\",\n        \"sms4.PNG\",\n        493,\n        89,\n        \"#dcd4d3\"\n      ]\n    }\n  ]\n}\n[/block]\nFor SMS, when setting up an Action, you need to choose between two methods for incoming message delivery:\n\n* **Http forward method** - allows you to receive messages from your subscribers in real-time\n  * *HTTP POST* - Receive messages via POST request in the request body\n  * *HTTP GET* - Receive messages via GET request as part of the URL query string\n* **Pull method** - allows you to fetch new messages from the Infobip server over API at your convenience\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Difference between Forward and Pull methods\",\n  \"body\": \"Learn more about Forward and Pull methods for receiving messages in [introduction](/docs/receive-sms-introduction#step-3-action-setup).\"\n}\n[/block]\n###Available methods\n* [Create new Action](#create-new-action)\n* [Get Action](#get-action)\n* [Delete Action](#delete-action) \n\n##Action model\n|Property name|Type|Description|\n|-|-|-|\n|actionKey|string|Unique ID of the Action.|\n|type|string|Action model of receiving the message. Must be `HTTP_FORWARD_POST`, `HTTP_FORWARD_GET` or `PULL`|\n|callbackData|string|Data string that will be returned with each received message.|\n|forwardUrl|string|URL to which new messages will be forwarded (if `type` is set to `HTTP_FORWARD_POST` or `HTTP_FORWARD_GET`)|\n[block:api-header]\n{\n  \"type\": \"post\",\n  \"title\": \"Create new Action\"\n}\n[/block]\nThis method will create a new Action within the Configuration container.\n```\nhttps://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions\n```\n###Create Pull example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\\n\\n{\\n\\t\\\"type\\\": \\\"PULL\\\",\\n\\t\\\"callbackData\\\": \\\"you-do-not-call-us-we-call-you-data\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"actionKey\\\": \\\"76BA545050E5623F6BA00D595A23EC28\\\",\\n  \\\"type\\\": \\\"PULL\\\",\\n  \\\"callbackData\\\": \\\"someCallbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccessful response is represented by the HTTP status code `200 OK`.\n\n###Create HTTP POST forward example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\\n\\n{\\n\\t\\\"type\\\": \\\"HTTP_FORWARD_POST\\\",\\n\\t\\\"forwardUrl\\\": \\\"http://someurl.com/message\\\",\\n\\t\\\"callbackData\\\": \\\"someCallbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"actionKey\\\": \\\"76BA545050E5623F6BA00D595A23EC28\\\",\\n  \\\"type\\\": \\\"HTTP_FORWARD_POST\\\",\\n  \\\"callbackData\\\": \\\"someCallbackData\\\",\\n  \\\"forwardUrl\\\": \\\"http://someurl.com/message\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccessful response is represented by the HTTP status code `200 OK`.\n\n###Create HTTP GET forward example\nUse [placeholders](#section-using-placeholders-in-http-forward-get-request) in `forwardUrl` to generate a query string with desired message data.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\\n\\n{\\n\\t\\\"type\\\": \\\"HTTP_FORWARD_GET\\\",\\n\\t\\\"forwardUrl\\\": \\\"http://someurl.com/message?sender=%sender%&text=%cleanText%\\\",\\n\\t\\\"callbackData\\\": \\\"someCallbackData\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"actionKey\\\": \\\"76BA545050E5623F6BA00D595A23EC28\\\",\\n  \\\"type\\\": \\\"HTTP_FORWARD_GET\\\",\\n  \\\"callbackData\\\": \\\"someCallbackData\\\",\\n  \\\"forwardUrl\\\": \\\"http://someurl.com/message?sender=%sender%&text=%cleanText%\\\"\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccessful response is represented by the HTTP status code `200 OK`.\n\n####Using placeholders in HTTP Forward GET request\nThis method allows you to pass message data as URL query string parameters. Example:\n\n```\nhttp://someurl.com/message?sender=%sender%&text=%cleanText%\n```\nYou can combine any placeholder from this list to build your query string parameters. Wrap a **placeholder name** with `%` like this `%sender%`.\n\nPalcehodlers\n\n|Placeholder name|Description|\n|-|-|\n|sender|Sender ID|\n|text|Message text|\n|keyword|Configuration container keyword|\n|cleanText|Message text without keyword|\n|receiver|Receiver number|\n|when|Date sent|\n|callbackdata|Callback data|\n[block:api-header]\n{\n  \"type\": \"get\",\n  \"title\": \"Get Action\"\n}\n[/block]\nThis method will return the Action of the selected Configuration\n```\nhttps://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions\n```\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nResponse\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"actions\\\": [\\n    {\\n      \\\"actionKey\\\": \\\"76BA545050E5623F6BA00D595A23EC28\\\",\\n      \\\"type\\\": \\\"PULL\\\",\\n      \\\"callbackData\\\": \\\"you-do-not-call-us-we-call-you-data\\\"\\n    }\\n  ]\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccessful response is represented by the HTTP status code `200 OK`.\n\n[block:api-header]\n{\n  \"type\": \"delete\",\n  \"title\": \"Delete Action\"\n}\n[/block]\nThis method will delete an Action of the selected Configuration\n```\nhttps://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions/{actionKey}\n```\nRequest example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"DELETE /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions/76BA545050E5623F6BA00D595A23EC28 HTTP/1.1\\nHost: api.infobip.com\\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\\nAccept: application/json\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\nSuccessful response is represented by the HTTP status code `204 No Content`. There is no response body.","excerpt":"Actions allow you to configure the incoming messages delivery method.","slug":"action","type":"basic","title":"Action"}

Action

Actions allow you to configure the incoming messages delivery method.

This documentation will help you configure the method for receiving incoming SMS messages and Voice services. Before configuring an Action, you must have a [phone number](/docs/phone-number) and [Configuration container](/docs/number-configuration) ready. [block:image] { "images": [ { "image": [ "https://files.readme.io/6af562b-sms4.PNG", "sms4.PNG", 493, 89, "#dcd4d3" ] } ] } [/block] For SMS, when setting up an Action, you need to choose between two methods for incoming message delivery: * **Http forward method** - allows you to receive messages from your subscribers in real-time * *HTTP POST* - Receive messages via POST request in the request body * *HTTP GET* - Receive messages via GET request as part of the URL query string * **Pull method** - allows you to fetch new messages from the Infobip server over API at your convenience [block:callout] { "type": "info", "title": "Difference between Forward and Pull methods", "body": "Learn more about Forward and Pull methods for receiving messages in [introduction](/docs/receive-sms-introduction#step-3-action-setup)." } [/block] ###Available methods * [Create new Action](#create-new-action) * [Get Action](#get-action) * [Delete Action](#delete-action) ##Action model |Property name|Type|Description| |-|-|-| |actionKey|string|Unique ID of the Action.| |type|string|Action model of receiving the message. Must be `HTTP_FORWARD_POST`, `HTTP_FORWARD_GET` or `PULL`| |callbackData|string|Data string that will be returned with each received message.| |forwardUrl|string|URL to which new messages will be forwarded (if `type` is set to `HTTP_FORWARD_POST` or `HTTP_FORWARD_GET`)| [block:api-header] { "type": "post", "title": "Create new Action" } [/block] This method will create a new Action within the Configuration container. ``` https://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions ``` ###Create Pull example [block:code] { "codes": [ { "code": "POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json\n\n{\n\t\"type\": \"PULL\",\n\t\"callbackData\": \"you-do-not-call-us-we-call-you-data\"\n}", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"actionKey\": \"76BA545050E5623F6BA00D595A23EC28\",\n \"type\": \"PULL\",\n \"callbackData\": \"someCallbackData\"\n}", "language": "json" } ] } [/block] Successful response is represented by the HTTP status code `200 OK`. ###Create HTTP POST forward example [block:code] { "codes": [ { "code": "POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json\n\n{\n\t\"type\": \"HTTP_FORWARD_POST\",\n\t\"forwardUrl\": \"http://someurl.com/message\",\n\t\"callbackData\": \"someCallbackData\"\n}", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"actionKey\": \"76BA545050E5623F6BA00D595A23EC28\",\n \"type\": \"HTTP_FORWARD_POST\",\n \"callbackData\": \"someCallbackData\",\n \"forwardUrl\": \"http://someurl.com/message\"\n}", "language": "json" } ] } [/block] Successful response is represented by the HTTP status code `200 OK`. ###Create HTTP GET forward example Use [placeholders](#section-using-placeholders-in-http-forward-get-request) in `forwardUrl` to generate a query string with desired message data. [block:code] { "codes": [ { "code": "POST /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json\n\n{\n\t\"type\": \"HTTP_FORWARD_GET\",\n\t\"forwardUrl\": \"http://someurl.com/message?sender=%sender%&text=%cleanText%\",\n\t\"callbackData\": \"someCallbackData\"\n}", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"actionKey\": \"76BA545050E5623F6BA00D595A23EC28\",\n \"type\": \"HTTP_FORWARD_GET\",\n \"callbackData\": \"someCallbackData\",\n \"forwardUrl\": \"http://someurl.com/message?sender=%sender%&text=%cleanText%\"\n}", "language": "json" } ] } [/block] Successful response is represented by the HTTP status code `200 OK`. ####Using placeholders in HTTP Forward GET request This method allows you to pass message data as URL query string parameters. Example: ``` http://someurl.com/message?sender=%sender%&text=%cleanText% ``` You can combine any placeholder from this list to build your query string parameters. Wrap a **placeholder name** with `%` like this `%sender%`. Palcehodlers |Placeholder name|Description| |-|-| |sender|Sender ID| |text|Message text| |keyword|Configuration container keyword| |cleanText|Message text without keyword| |receiver|Receiver number| |when|Date sent| |callbackdata|Callback data| [block:api-header] { "type": "get", "title": "Get Action" } [/block] This method will return the Action of the selected Configuration ``` https://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions ``` Request example [block:code] { "codes": [ { "code": "GET /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] Response [block:code] { "codes": [ { "code": "{\n \"actions\": [\n {\n \"actionKey\": \"76BA545050E5623F6BA00D595A23EC28\",\n \"type\": \"PULL\",\n \"callbackData\": \"you-do-not-call-us-we-call-you-data\"\n }\n ]\n}", "language": "json" } ] } [/block] Successful response is represented by the HTTP status code `200 OK`. [block:api-header] { "type": "delete", "title": "Delete Action" } [/block] This method will delete an Action of the selected Configuration ``` https://api.infobip.com/numbers/1/numbers/{numberKey}/configurations/{configurationKey}/actions/{actionKey} ``` Request example [block:code] { "codes": [ { "code": "DELETE /numbers/1/numbers/78D8394AC5EG0460B4CF0E723FC31B49/configurations/64GD2CA328536A09DD2CA328536A09D8/actions/76BA545050E5623F6BA00D595A23EC28 HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] Successful response is represented by the HTTP status code `204 No Content`. There is no response body.