{"_id":"57d65dd646dcc30e007dd105","version":{"_id":"54eb63b859b1172100334fae","project":"54eb50e5615ffc1900305a16","forked_from":"54eb63a1867e1917009b711d","__v":26,"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"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1"},"parentDoc":null,"category":{"_id":"5515472ac28d6125001b8884","pages":["551924db45b0d80d00152254","55194fec71a8cc210031db15","551e55590a72c50d0085b911"],"version":"54eb63b859b1172100334fae","__v":3,"project":"54eb50e5615ffc1900305a16","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-03-27T12:03:54.990Z","from_sync":false,"order":3,"slug":"receive-sms","title":"Receive SMS"},"project":"54eb50e5615ffc1900305a16","__v":2,"user":"54eb4fdedf7add210007b29b","updates":["5874ec7a694a7b0f001cf77f"],"next":{"pages":[],"description":""},"createdAt":"2016-09-12T07:48:38.374Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":true,"order":2,"body":"This tutorial will show you how to access messages sent by your customers. Before you proceed to implement this method, [**please read introduction**](/docs/receive-sms-introduction)  on how to receive incoming messages where you can learn about numbers and initial setup.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"This tutorial covers a method of receiving new messages via **Forward method**. Besides Forward method, received messages can be accessed by **Pull method**. Learn more in [Pull method documentation](/docs/pull-received-messages).\",\n  \"title\": \"Pull method\"\n}\n[/block]\nTo receive incoming forwarded messages, you will have to set up a URL on your web server that can receive POST request from our system.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"The received messages forward retry cycle and sender addresses are identical to that of Delivery Report forwarding on Notify URL, described on [Delivery Reports on Notify URL](https://dev.infobip.com/docs/notify-url).\",\n  \"title\": \"Retry cycle and sender IP addresses\"\n}\n[/block]\n##Forward message example\n\nWhen our system receives MO message, it will be forwarded automatically to the URL you have provided during the Action setup. When a new message from your customers arrives in our system, it will be forwarded with message body as follows:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"results\\\": [\\n    {\\n      \\\"messageId\\\": \\\"817790313235066447\\\",\\n      \\\"from\\\": \\\"385916242493\\\",\\n      \\\"to\\\": \\\"385921004026\\\",\\n      \\\"text\\\": \\\"QUIZ Correct answer is Paris\\\",\\n      \\\"cleanText\\\": \\\"Correct answer is Paris\\\",\\n      \\\"keyword\\\": \\\"QUIZ\\\",\\n      \\\"receivedAt\\\": \\\"2016-10-06T09:28:39.220+0000\\\",\\n      \\\"smsCount\\\": 1,\\n      \\\"price\\\": {\\n        \\\"pricePerMessage\\\": 0,\\n        \\\"currency\\\": \\\"EUR\\\"\\n      },\\n      \\\"callbackData\\\": \\\"callbackData\\\"\\n    }\\n  ],\\n  \\\"messageCount\\\": 1,\\n  \\\"pendingMessageCount\\\": 0\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Request body parameters\"\n}\n[/block]\n|Parameter|Type|Description|\n|-|-|-|\n|*results*|[Messages[]](#messages)|Collection of reports, one per every received message.|\n|*messageCount*|Int|Number of returned messages in this request.|\n|*pendingMessageCount*|Int|Number of remaining new messages on our server ready to be returned in the next API call.|\n\n### Messages\n\n|Parameter|Type|Description|\n|-|-|-|\n|*messageId*|String|The ID that uniquely identifies the received message.|\n|*from*|String|Sender ID that can be alphanumeric or numeric.|\n|*to*|String|The message destination address.|\n|*text*|String|Full text of the received message.|\n|*cleanText*|String|Text of received message without a keyword (if a keyword was sent).|\n|*keyword*|String|Keyword extracted from the message text.|\n|*receivedAt*|Date|Tells when Infobip platform received the message. It has the following format: `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`.|\n|*smsCount*|Int|The number of sent message segments.|\n|*pricePerMessage*|Decimal|Cost of receiving a message.|\n|*currency*|String|Currency of the message price.|\n|*callbackData*|int|Custom callback data can be inserted during setup phase.|","excerpt":"This method allows you receive messages in real time by implementing URL on your application server where new messages will be forwarded.","slug":"forward-received-messages","type":"basic","title":"Receive SMS by Forward method"}

Receive SMS by Forward method

This method allows you receive messages in real time by implementing URL on your application server where new messages will be forwarded.

This tutorial will show you how to access messages sent by your customers. Before you proceed to implement this method, [**please read introduction**](/docs/receive-sms-introduction) on how to receive incoming messages where you can learn about numbers and initial setup. [block:callout] { "type": "info", "body": "This tutorial covers a method of receiving new messages via **Forward method**. Besides Forward method, received messages can be accessed by **Pull method**. Learn more in [Pull method documentation](/docs/pull-received-messages).", "title": "Pull method" } [/block] To receive incoming forwarded messages, you will have to set up a URL on your web server that can receive POST request from our system. [block:callout] { "type": "info", "body": "The received messages forward retry cycle and sender addresses are identical to that of Delivery Report forwarding on Notify URL, described on [Delivery Reports on Notify URL](https://dev.infobip.com/docs/notify-url).", "title": "Retry cycle and sender IP addresses" } [/block] ##Forward message example When our system receives MO message, it will be forwarded automatically to the URL you have provided during the Action setup. When a new message from your customers arrives in our system, it will be forwarded with message body as follows: [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"messageId\": \"817790313235066447\",\n \"from\": \"385916242493\",\n \"to\": \"385921004026\",\n \"text\": \"QUIZ Correct answer is Paris\",\n \"cleanText\": \"Correct answer is Paris\",\n \"keyword\": \"QUIZ\",\n \"receivedAt\": \"2016-10-06T09:28:39.220+0000\",\n \"smsCount\": 1,\n \"price\": {\n \"pricePerMessage\": 0,\n \"currency\": \"EUR\"\n },\n \"callbackData\": \"callbackData\"\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Request body parameters" } [/block] |Parameter|Type|Description| |-|-|-| |*results*|[Messages[]](#messages)|Collection of reports, one per every received message.| |*messageCount*|Int|Number of returned messages in this request.| |*pendingMessageCount*|Int|Number of remaining new messages on our server ready to be returned in the next API call.| ### Messages |Parameter|Type|Description| |-|-|-| |*messageId*|String|The ID that uniquely identifies the received message.| |*from*|String|Sender ID that can be alphanumeric or numeric.| |*to*|String|The message destination address.| |*text*|String|Full text of the received message.| |*cleanText*|String|Text of received message without a keyword (if a keyword was sent).| |*keyword*|String|Keyword extracted from the message text.| |*receivedAt*|Date|Tells when Infobip platform received the message. It has the following format: `yyyy-MM-dd'T'HH:mm:ss.SSSXXX`.| |*smsCount*|Int|The number of sent message segments.| |*pricePerMessage*|Decimal|Cost of receiving a message.| |*currency*|String|Currency of the message price.| |*callbackData*|int|Custom callback data can be inserted during setup phase.|