# Receive data using a webhook

**URL:** <https://forums.losant.com/t/receive-data-using-a-webhook/3526>\
**Category:** Help\
**Tags:** workflow, webhook, http\
**Created:** [January 12, 2021, 10:51pm UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526 "2021-01-12T22:51:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jules\_Huguenin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/jules_huguenin/32/4031_2.png) [@Jules\_Huguenin](https://forums.losant.com/u/Jules_Huguenin)\
**Post date:** [January 12, 2021, 10:51pm UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/1 "2021-01-12T22:51:57Z")

</div>

Hi there,  
My device can send data to Losant via a HTTPS POST and I have set up a webhook for this.  
Unfortunately I’m not receiving the data in Losant and looking at the url POST from the device, here is what I see:

_Wed Jan 13 11:21:26 2021 daemon.info iojuggler: executing action id=1_  
_Wed Jan 13 11:21:26 2021 daemon.info iojuggler: POST: [https://triggers.losant.com/webhooks/](https://triggers.losant.com/webhooks/) **XXXXXXXXXXXXX**?input3=falling&time=2021-01-13%2011%3A21%3A26&seralnumber= **XXXXXX** &inputname=dio0_

My understanding is that the device adds a query string to the url to send the parameters. Can I receive this in Losant?  
Cheers  
Jules

---

<div class="post-metadata">

**Author:** ![Jules\_Huguenin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/jules_huguenin/32/4031_2.png) [@Jules\_Huguenin](https://forums.losant.com/u/Jules_Huguenin)\
**Post date:** [January 18, 2021, 7:50pm UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/2 "2021-01-18T19:50:56Z")

</div>

Further to my question above, I have two ways to send my data to Losant from my device.

1 - I can send the data based on time interval, which is not ideal for my application. I am receiving the data in Losant by using a webhook. Here is the payload result:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/3926d1307ada9cf8e6bf600e772ba7be8929a785.png)  
Note that I should have a JSON object in the body response, but that’s a secondary problem.

2 - I can send the data based on change of input status, which is the solution I have described in my initial post. I tested the solution with [https://webhook.site/](https://webhook.site/) and here is what I get:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/3/31b385094b91ffe38e840fb36b50c5ac4c640fc1.png)

I’m not receiving anything in Losant using this solution, any idea what could be the issue?

---

<div class="post-metadata">

**Author:** ![Heath](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/heath/32/3036_2.png) [@Heath](https://forums.losant.com/u/Heath)\
**Post date:** [January 18, 2021, 8:30pm UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/4 "2021-01-18T20:30:24Z")

</div>

Hi @Jules_Huguenin,

> 1 - I can send the data based on time interval, which is not ideal for my application. I am receiving the data in Losant by using a webhook. Here is the payload result:

I did some testing on my end and was able to reproduce the behavior you are seeing in the first image. When posting data to a Losant Webhook where the body of the request is a JSON object, the `content-type` should be `application/json`. When using `content-type` of `application/x-www-form-urlencoded` I experienced the same behavior you did:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/e/e6f4dcefbece163e92d94612fdc75772686f4b3b.png)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/d/dc777cdc76286f39d92d7ca329b23fca2add21ef.png)

When I sent the query parameters you mentioned in your first question I was able to successfully see the data in a payload in Losant, but in the `query` section, rather than the `body` section:

![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/a/aa68f60895afbec48b7b806d096a5eba36946daa.png)

Let me know if changing the `content-type` to `application/json` works for you!

> I’m not receiving anything in Losant using this solution, any idea what could be the issue?

When you say “I’m not receiving anything in Losant using this solution…” do you mean that a workflow is not being triggered? Or do you mean that the workflow is being triggered, but the data that you are including as query parameters is not on the payload?

Thank you,  
Heath

---

<div class="post-metadata">

**Author:** ![Jules\_Huguenin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/jules_huguenin/32/4031_2.png) [@Jules\_Huguenin](https://forums.losant.com/u/Jules_Huguenin)\
**Post date:** [January 18, 2021, 8:45pm UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/6 "2021-01-18T20:45:16Z")

</div>

Hi @Heath,  
Thanks for your answer, I have found the problem and it’s on the device side. There is too many characters for the webhook URL input field and I wasn’t given an alert when pasting the URL into the field.  
It must be a bug with the device’s firmware and I have raised the question with support.

I will try to change the content type once the URL input field problem is fixed.  
Cheers  
Jules

---

<div class="post-metadata">

**Author:** ![Jules\_Huguenin](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/jules_huguenin/32/4031_2.png) [@Jules\_Huguenin](https://forums.losant.com/u/Jules_Huguenin)\
**Post date:** [January 19, 2021, 1:06am UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/8 "2021-01-19T01:06:54Z")

</div>

[update]

I have used the experience endpoint as a workaround for my problem with the length of the webhook URL (thanks to [Webhook too long for server](https://forums.losant.com/t/webhook-too-long-for-server/2921)).

The data is coming in nicely in data instead of query, without changing the content-type:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/d/dbc962b5faeac49f1ea1f58058094aa56052f52d.png)

Do I need to create an Endpoint reply node in my workflow? With or without it I get this response:  
`{ "error": "No endpoint found for this route" }`

Cheers  
Jules

---

<div class="post-metadata">

**Author:** ![Stewart\_McCallum](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/stewart_mccallum/32/2490_2.png) [@Stewart\_McCallum](https://forums.losant.com/u/Stewart_McCallum)\
**Post date:** [January 19, 2021, 1:58am UTC](https://forums.losant.com/t/receive-data-using-a-webhook/3526/9 "2021-01-19T01:58:34Z")

</div>

I had the same issue with long webhooks.  
I switch to a endpoint with “No Static Reply (use experience workflow to reply)”  
Mine responds with a message id and Time/Date.
