{"_id":"585ba1f144a09a19000dba01","user":"57a98d832242630e00cc8df7","__v":0,"parentDoc":null,"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"},"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"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-12-22T09:50:41.579Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"We have covered in detail how to [send LINE messages](/docs/send-single-line-message-api) over API. When it comes to the reception of inbound messages from your subscribers there is a choice between two basic methods:\n  * **HTTP forward method** - allows you to receive inbound messages from your subscribers in real time\n  * **Pull method** - allows you to fetch new messages from Infobip server over an API whenever you want\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Incoming messages setup\",\n  \"body\": \"It's up to you which method to use. It really depends on your use case. You can find instructions on how to setup each scenario in [Configuration documentation](/docs/line-chat-configuration).\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"HTTP forward method\"\n}\n[/block]\nIf you wish to receive the inbound messages in real time you should use this method.\n\nIn order to receive forwarded incoming messages, you will have to set up a unique web address on your own web server that is able to receive a POST request. Every message we receive from your subscriber will be forwarded to the URL you provided in [Action setup](/docs/line-chat-action).\n\nAn example of the forwarded message:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"results\\\": [\\n    {\\n      \\\"from\\\": \\\"fd9c6a0d-02d3-4e39-8361-92f637471c08\\\",\\n      \\\"to\\\": \\\"842C684C7856D6E876A7250135457CGE\\\",\\n      \\\"receivedAt\\\": \\\"2017-01-05T12:47:56.221+0000\\\",\\n      \\\"callbackData\\\": \\\"callbackData\\\",\\n      \\\"message\\\": {\\n        \\\"text\\\": \\\"Thank you for this!\\\",\\n        \\\"type\\\": \\\"TEXT\\\"\\n      },\\n      \\\"price\\\": {\\n        \\\"pricePerMessage\\\": 0,\\n        \\\"currency\\\": \\\"EUR\\\"\\n      }\\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\": \"Pull method\"\n}\n[/block]\nAll messages received from your subscribers will be received on Infobip platform and will be there until you decide to access them. Accessing your received messages is pretty much straightforward. All you need to do is make a simple API call which will return received messages.\n\nRequest example \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /line/1/inbox/reports 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  \\\"results\\\": [\\n    {\\n      \\\"from\\\": \\\"fd9c6a0d-02d3-4e39-8361-92f637471c08\\\",\\n      \\\"to\\\": \\\"842C684C7856D6E876A7250135457CGE\\\",\\n      \\\"receivedAt\\\": \\\"2017-01-05T12:47:56.221+0000\\\",\\n      \\\"callbackData\\\": \\\"callbackData\\\",\\n      \\\"message\\\": {\\n        \\\"text\\\": \\\"Thank you for this!\\\",\\n        \\\"type\\\": \\\"TEXT\\\"\\n      },\\n      \\\"price\\\": {\\n        \\\"pricePerMessage\\\": 0,\\n        \\\"currency\\\": \\\"EUR\\\"\\n      }\\n    }\\n  ],\\n  \\\"messageCount\\\": 1,\\n  \\\"pendingMessageCount\\\": 0\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Important\",\n  \"body\": \"All received messages can be pulled **only one time**! Once a certain message has been pulled by this method, it will not be available in the next API call. This means that every time you make an API call, you will see only messages received since the last API request you made.\"\n}\n[/block]","excerpt":"Receive incoming LINE message from your subscribers","slug":"receive-line-message-api","type":"basic","title":"Receive LINE message"}

Receive LINE message

Receive incoming LINE message from your subscribers

We have covered in detail how to [send LINE messages](/docs/send-single-line-message-api) over API. When it comes to the reception of inbound messages from your subscribers there is a choice between two basic methods: * **HTTP forward method** - allows you to receive inbound messages from your subscribers in real time * **Pull method** - allows you to fetch new messages from Infobip server over an API whenever you want [block:callout] { "type": "warning", "title": "Incoming messages setup", "body": "It's up to you which method to use. It really depends on your use case. You can find instructions on how to setup each scenario in [Configuration documentation](/docs/line-chat-configuration)." } [/block] [block:api-header] { "type": "basic", "title": "HTTP forward method" } [/block] If you wish to receive the inbound messages in real time you should use this method. In order to receive forwarded incoming messages, you will have to set up a unique web address on your own web server that is able to receive a POST request. Every message we receive from your subscriber will be forwarded to the URL you provided in [Action setup](/docs/line-chat-action). An example of the forwarded message: [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"from\": \"fd9c6a0d-02d3-4e39-8361-92f637471c08\",\n \"to\": \"842C684C7856D6E876A7250135457CGE\",\n \"receivedAt\": \"2017-01-05T12:47:56.221+0000\",\n \"callbackData\": \"callbackData\",\n \"message\": {\n \"text\": \"Thank you for this!\",\n \"type\": \"TEXT\"\n },\n \"price\": {\n \"pricePerMessage\": 0,\n \"currency\": \"EUR\"\n }\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] [block:api-header] { "type": "basic", "title": "Pull method" } [/block] All messages received from your subscribers will be received on Infobip platform and will be there until you decide to access them. Accessing your received messages is pretty much straightforward. All you need to do is make a simple API call which will return received messages. Request example [block:code] { "codes": [ { "code": "GET /line/1/inbox/reports HTTP/1.1\nHost: api.infobip.com\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\nAccept: application/json", "language": "json" } ] } [/block] Response: [block:code] { "codes": [ { "code": "{\n \"results\": [\n {\n \"from\": \"fd9c6a0d-02d3-4e39-8361-92f637471c08\",\n \"to\": \"842C684C7856D6E876A7250135457CGE\",\n \"receivedAt\": \"2017-01-05T12:47:56.221+0000\",\n \"callbackData\": \"callbackData\",\n \"message\": {\n \"text\": \"Thank you for this!\",\n \"type\": \"TEXT\"\n },\n \"price\": {\n \"pricePerMessage\": 0,\n \"currency\": \"EUR\"\n }\n }\n ],\n \"messageCount\": 1,\n \"pendingMessageCount\": 0\n}", "language": "json" } ] } [/block] [block:callout] { "type": "warning", "title": "Important", "body": "All received messages can be pulled **only one time**! Once a certain message has been pulled by this method, it will not be available in the next API call. This means that every time you make an API call, you will see only messages received since the last API request you made." } [/block]