# Using node red to check if item is in stock?

**URL:** <https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605>\
**Category:** General\
**Created:** [23 January 2021 14:48 UTC](https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605 "2021-01-23T14:48:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nappyjim](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nappyjim/32/34077_2.png) [@nappyjim](https://discourse.nodered.org/u/nappyjim)\
**Post date:** [23 January 2021 14:48 UTC](https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605/1 "2021-01-23T14:48:13Z")

</div>

Is there a way to get node red to check a webpage and alert me when its in stock?

I tried first just doing an http request and it does return a payload, but it appears to be truncated. I need to see the entire payload and then hoping I can put in a switch to look for the words out of stock.

How do I get the payload to not be truncated?

```auto
[{"id":"5b052fc3.25283","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"a404705e.d925","type":"inject","z":"5b052fc3.25283","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1312,"y":153,"wires":[["f382423a.cf469"]]},{"id":"f382423a.cf469","type":"http request","z":"5b052fc3.25283","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://inovelli.com/refurbished-4-in-1-sensor-z-wave/","tls":"","persist":false,"proxy":"","authType":"","x":1304,"y":225,"wires":[["b68fe543.a67b08"]]},{"id":"b68fe543.a67b08","type":"debug","z":"5b052fc3.25283","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1301,"y":297,"wires":[]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3c573a1ddc7c3f2d53e45c465008e1c2208de10e.png)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 January 2021 15:01 UTC](https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605/2 "2021-01-23T15:01:24Z")

</div>

> [@nappyjim](#):
>
> Is there a way to get node red to check a webpage and alert me when its in stock?

Depends on the page.

Some pages like that are updated dynamically by JavaScript AFTER the page has been returned to the browser. In that case, a simple request node will not work and you would have to use a full "headless browser" node.

> [@nappyjim](#):
>
> but it appears to be truncated

As stated in the Node-RED docs, the debug output is truncated if it gets too long so that performance of the browser isn't badly impacted.

> [@nappyjim](#):
>
> How do I get the payload to not be truncated?

You need to use something like the html node to select just a part of the returned content.

The best approach is to open the page in your browser and use the developer tools to select the area of html that you want. Then you can copy the selector which you can use in the html node.

However, just watch out for the page updating itself from JavaScript after it has loaded, this is really common for information that is quite dynamic. It lets the authors of the site quickly deliver the more static information and then enrich the page with dynamic data afterwards.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [23 January 2021 15:08 UTC](https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605/3 "2021-01-23T15:08:24Z")

</div>

> [@nappyjim](#):
>
> How do I get the payload to not be truncated?

The payload isn't truncated, it is just the view in the debug pane that is truncated. If you set the debug node to also send to the console then the full payload should appear in the log.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 March 2021 15:08 UTC](https://discourse.nodered.org/t/using-node-red-to-check-if-item-is-in-stock/39605/4 "2021-03-24T15:08:32Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
