Ping to test a Webhook

Using a Ping to test the webhook from a server into Losant:

{
  "type": "ping"
}

Yielded the following liveData format:

{
  "deviceId": "woolshirt_879MX4Dqp",
  "data": {
    "S7_1200_1_110_64_14_221": {
      "MBO_DI_2": {
        "value": 0,
        "timestamp": 1587669387257
      }
    }
  },
  "type": "liveData"
}

Are there any special settings needed in the workflow in order to read this payload format?
image

Hey @Amit_Gitterman,

Welcome to the Losant Forums! I would love to help you but I’m not sure how to interpret your question. Could you provide more information about your problem?

Thank you for getting back with me so fast.

I received a proper (application/json?) payload to losant from a server I provided the Webhook Trigger to, but only for several hours. Now I cannot seem to get any payload to losant from the server. The payload was viewed in the debug tab of the webhook workflow. Settings on losant and on the server the webhook trigger was sent to did not change since the original configuration.

Contacting the server I sent the Webhook Trigger to regarding the matter yielded a replay that they were bale to retrieve the expected payload. They advised me that their software specialist tested the webhook (he used { “type”:“ping”} to test it) and it seems to be working as expected (sending the needed payload upon triggering). He suspects that I may not be processing ‘liveData’ payload types (copied to the original question) correctly on the receiving end (receiving end=Losant).

  1. Should I change my configuration to accommodate the expected payload type?
  2. Can I use { “type”:“ping”} to test it in the Losant Test Webhook page?

Will appreciate your guidance on this

Hi @Amit_Gitterman,

I just tested this and was able to successfully trigger a Webhook with your JSON payload. My debug log looked like so:

Typing {"type":"ping"} in the Test Webhook page should result in a successful response as well. When you trigger the Losant Webhook from the other service, do you get a response code and body?

Thanks!
Julia

Thank you for your reply, I tried to recreate the test you conducted but the debug log state: “No Debug Log Yet”
I am probably missing something just not sure what it is.

@Amit_Gitterman,

Are you receiving a response body within your other service? Can you include screenshots of your Losant workflow and the trigger from the sender?

Have you configured the Webhook to wait for a reply? It’s possible your request could be timing out.

Thanks!
Julia

Confirm, wait for reply is selected in the webhook on losant

Thew losant workflow look like this:


Please elaborate on the request for a screen shot of the trigger from the sender and I will accommodate.

Hi @Amit_Gitterman,

You have enabled this webhook to wait for a reply. If you read the snippet above the “wait for reply” checkbox, it explicitly states you must include a Webhook Reply Node in order for a successful request. If you do not include a Webhook Reply Node, the workflow will wait for 30 seconds for a reply, and then time out.

You will either need to add this node or disable this checkbox, as your workflow is waiting to see that node and is timing out since it does not exist.

Thanks,
Julia

You are correct I do not have a webhook reply node.
I disabled (unchecked) the “wait for a reply” but still can no see the payload in debug similar to the message you sent on April 25th (4/8 message).
Please elaborate how to read the payload without the webhook reply node and having the “wait for a reply” un-checked.

Hello @Amit_Gitterman,

If you currently have this box unchecked and your workflow includes exclusively a Webhook Trigger and Debug Node, you should be able to receive payloads within your debug log when your webhook is triggered. If you are not receiving them, I would recommend doing the following:

Debugging with Postman

Postman is a tool that can be used for POST requests. You can configure a POST within Postman to your Losant Webhook, and when triggered, you should see a payload in your debug log.

Losant University

I would recommend checking out the Workflow Engine course of Losant University to improve your workflow knowledge.

POST Request Configuration

It would be beneficial if you could include the configuration of your POST request to Losant. How are you currently triggering this webhook? What is the configuration that is not reaching Losant?

Thanks,
Julia

I will followup on your recommendations.

Please bring rational into the debug node output within workflow:

For the last couple of days I was not able to populate the debug log when pressing the debug tab in the workflow screen. I found that a Debug Node Output is populating only after several hours with all the accumulated debug node outputs. Simply keeping the debug Tab selected on the workflow screen will generate the required debug node output list after 2-3 hours:

Please note that when I force the webhook through postman I can see the debug note output populating immediately.

Is there a way to force populate the debug tab and bypass the wait for it to populate?

Hi @Amit_Gitterman,

Please correct me if I am misinterpreting your question, but it sounds as though you are looking to simulate your webhook for testing, as it only fires every few hours.

You can use the Virtual Button Trigger to run your workflow without triggering your webhook. The Virtual Button Trigger Node will fire a workflow when the “virtual button” is pressed. You can connect the Virtual Button to the first node(s) below your Webhook Trigger to simulate your webhook, and can even copy your webhook payload for use within the Virtual Button configuration.

Thanks!
Julia

Simulation of the webhook is not needed as the device I am connected to seem to be posting in a functional manner. I created a secondary webhook on the device:

  1. Webhook 1 configured to point to generated https://webhook.site/ webhook URL
  2. Webhook 2 configured to point to the Losant Server (Losant generated Webhook Trigger URL)

On webhook.site I am receiving posts correctly and periodically as intended:

Capture 1

The raw content of these Payloads on webhook.site look like this:

{“deviceId”:“woolshirt_879MX4Dqp”,“data”:{“S7_1200_1_110_64_14_221”:{“Digital inputs from PLC”:{“value”:7436,“timestamp”:1588595788339},“MBO_DI_2”:{“value”:128,“timestamp”:1588595738337},“MBO_FLTS_33_48”:{“value”:0,“timestamp”:1588595738337},“MBO_W
rngs_17_32”:{“value”:400,“timestamp”:1588595748337},“FACE BYPASS PROCVAR”:{“value”:35.7,“timestamp”:1588595748337},“MBO_DI_3”:{“value”:-22528,“timestamp”:1588595748337},“DH WHEEL RUNTIME MSB”:{“value”:6406,“timestamp”:1588595758338},“SYSTEM RUNTIME MSB”:{“value”:8357,“timestamp”:1588595758338}}},“type”:“liveData”}

I simply want to receive the same payload which is populating correctly in the Webhook.site server on the Losant server as well. I tested if the workflow on losant is set up correctly with POSTMAN. When I send a post with the Losant Generated webhook trigger URL through POSTMAN I can see the debug node output populating immediately with the following payload:

{
“globals”: {},
“applicationName”: “Munters Industrial Unit Monitor”,
“flowName”: “Webhook SMC LTE Trigger”,
“flowId”: “5e9ef77e815721000776cc1f”,
“flowVersion”: “develop”,
“relayType”: “public”,
“relayId”: “000000000000000000000000”,
“triggerType”: “webhook”,
“triggerId”: “5e9ef60665a0e90006c4257e”,
“applicationId”: “5e9ef4c4815721000776cbe4”,
“data”: {
“replyId”: “5e9ef60665a0e90006c4257e.KxC_LaNypdlAczEIy5xSu.9ufcp1uVGjI70J5-7JjXUW”,
“body”: null,
“query”: {},
“headers”: {
“accept-encoding”: “gzip, deflate, br”,
“postman-token”: “REDACTED”,
“accept”: “/”,
“user-agent”: “PostmanRuntime/7.24.1”,
“content-length”: “0”,
“x-forwarded-for”: “65.126.224.30”,
“x-forwarded-proto”: “https”,
“x-real-ip”: “65.126.224.30”
},
“method”: “post”,
“path”: “/”
},
“time”: “2020-05-04T12:00:41.553Z”
}

In a comparison of the two servers, the webhook.site receive posts while the losant do not receive them at the time they are generated by the posting device.

Main Question: Why can’t I see the posts from the webhooked device in the Losant Server debug tab (in the workflow session) but I can see all of the Posts in webhook.site server request list?

Hi @Amit_Gitterman,

Great, thank you so much for that explanation and the example payloads, they are quite helpful!

Could you also include your configuration for the incoming request to the Losant webhook? In order to better isolate the problem, I want to ensure the device you are posting from contains a request that would be accepted by Losant. I tested the liveData tag and was successful, but it’s possible something else could be causing the request to get delayed.

Additionally, how often is your device triggering the webhook.site webhook?

Thanks!
Julia

The configuration for the incoming request look like this:


The device is triggering the webhook.site at the same rate it does the losant server (every 10 minutes)

Thank you for getting back with me

Hi @Amit_Gitterman,

I would recommend checking out this documentation in the Debug Node. Keep in mind, the Debug Panel will only be populated if you have the workflow open, and does not “save” historical requests.

When I previously asked if you could “also include your configuration for the incoming request to the Losant webhook,” I was referring to the request from your device to Losant, not your Losant workflow configuration. How are you triggering your Webhook Trigger Node from your device? Have you written code on your device?

Thanks,
Julia

Thank you for getting back with me.

I have not written a code on the IoT device. Every 5 minutes the IoT Gateway Device post the data to the losant Webhooks URL. I do not have access to the code that is triggered by the IoT Gateway Device.

The payload that is suppose to arrive from the IoT device is defined above (basically copied it from the webhoow.site post)

From your question I understand that the post code in the device matter. If you have a sample code to share I can ask if the manufacturer have the same code written on their device.

@Amit_Gitterman,

Would you be okay with sharing the device? Or sharing with me in a DM? That may help us figure out what’s going on here.

Yes, I can share the device. What information do you need?
I can send you the Webhook Manual if needed (I was not able to upload it in the forum)