HTTP integration

(Matic S) #41


I have a question about how ACK messages (Device->Cloud) in the case of confirmed transmission (initiated in direction Cloud->Device) could be seen by our application via HTTP integration.

We send confirmed messages, but looks like TTN doesn’t send the ACK messages to our HTTP endpoint, or maybe we are logging the input messages incorrectly. We don’t see them due to that.

We are logging all HTTP input on our HTTP endpoint
(by HTTP endpoint, I refer to path which is being called by TTN once a message is received).

Thanks & cheers!

(Especial) #42

I did samething as you did except put my own url which is

but i only got
-> {“dev_id”:“arduino_lora_test2”,“payload_raw”:“AAE=”}
and no data on ttn

I’m trying to looking for downlink please help me (sorry for my bad english ㅠㅠ)

(Especial) #43

I solve my problem!

I just thought “dev_id” is no important data so, I remainded as “hrmansenuno”
after i changed into my own dev_id it works!

(Callum Taylor) #44


Sorry to bring up a new issue on an older form. I have tried absolutely everywhere online, and I still can’t seem to get uplink data from TTN sent to my website to work. In the TTN HTTP integration fields, I have used the default access key, my website with the PHP file on the end (e.g. - obviously websitename is different) and the method as POST. On the PHP side, I have tried using MYSQL and writing to text files but I get absolutely nothing. When looking at the devices accessing my website I can clearly see TTN sending data. To simplify the code to find the root of the problem, I have used this code in by ‘file.php’ from the posts above (slightly modified):


//Make sure that it is a POST request.
if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
    throw new Exception('Request method must be POST!');
//Make sure that the content type of the POST request has been set to application/json
$contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
if(strcasecmp($contentType, 'application/json') != 0){
    throw new Exception('Content type must be: application/json');
//Receive the RAW post data.
$content = trim(file_get_contents("php://input"));
//Attempt to decode the incoming RAW post data from JSON.
$decoded = json_decode($content, true);
//If json_decode failed, the JSON is invalid.
    throw new Exception('Received content contained invalid JSON!');

//Process the JSON.

echo $decoded; // Can I simply echo the decoded?


When I try to see if it works, I go to the website URL directly ( and then simulate an uplink in TTN console. It only displays the thrown error ‘Request method must be POST!’ or if I remove this, then nothing. What am I doing wrong? Should I have any other files in my website directory which has code relevant to file.php? Could it have something to do with my hosting, which is GoDaddy? Let me know if I can make it clearer in any way or try anything.


(Arjan) #45

Where do you expect the output to go to? The HTTP integration is a server-to-server interface; when TTN connects to your server, it’s not going to handle the response you’re sending using the line above. Rather than echo-ing the request back to TTN, you’ll need to store it somewhere.

It doesn’t make sense that you’re going to that URL: even when TTN also goes to that URL at exactly the very same time (unlikely), there’s nothing in your code to make you (the human) show whatever TTN sent to that URL. Each request is a standalone request; nothing is shared with others who happen to know the same URL.

As a bare minimum without any security, this example from Parsing HTTP integration data in PHP might help:

(Callum Taylor) #46

Thank you so much. I failed to mention that I am a complete novice to PHP and I was thinking in terms of C++ and getting it simply to display data it receives. I feel very silly right now.

Thanks again.

(Rego21) #47


Im also trying to receive data on my Apache server. Im using wampserver (localhost). Can you give me some advices how to receive the data from the devices on my application. Maybe the steps you did…

Thank you very much!

(Ud Lo Ra) #48

@rego21: you need a server accessible through the web at some address. If you have it at home on an ADSL line, in principle you could, but if you do not know already how to do it, it is too much effort, it is easier to just use some free PHP hosting.

(Rego21) #49

Ok i understand. Can you point me one free PHP hosting? Thank you for the help!

(Ud Lo Ra) #50

I do not use a specific platform, having my own server. Just google for PHP free hosting, or maybe wait for some other user suggestion. If what you have to do is simple, you might also use some already available platform (check those in the Integrations tab).