# Send simple message as string

**URL:** <https://discourse.nodered.org/t/send-simple-message-as-string/21625>\
**Category:** General\
**Created:** [12 February 2020 23:45 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625 "2020-02-12T23:45:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poodlepapa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/poodlepapa/32/8174_2.png) [@Poodlepapa](https://discourse.nodered.org/u/Poodlepapa)\
**Post date:** [12 February 2020 23:45 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/1 "2020-02-12T23:45:44Z")

</div>

I have a simple message format question. I have set up an inject node to send 1, 2, 3, or 4 as a string. How do I incorporate a node to send those with out using an inject node? It truly is a s simple as sending a 1-4 when it receives a time stamp. I tried using a template node but I don't think im doing it right.

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [12 February 2020 23:51 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/2 "2020-02-12T23:51:38Z")

</div>

A flow has to have something to activate it. I't could be a physical button that is pushed or a sensor that detects motion or a sensor that triggers every 5 minutes to read the temperature.

It could also be an `inject` node that is set to only fire off when you press it...or it could be set fire off every 100 milliseconds (or every 2 hours).

But _something_ has to kickoff the flow you put together.

---

<div class="post-metadata">

**Author:** ![Poodlepapa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/poodlepapa/32/8174_2.png) [@Poodlepapa](https://discourse.nodered.org/u/Poodlepapa)\
**Post date:** [12 February 2020 23:54 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/3 "2020-02-12T23:54:51Z")

</div>

Yes, Im sorry I should have been more clear. I I am going to have a random Number generator set up to a PIR sensor. When it picks any of the 1-4 is will send that number on. How do I send it as a string? Change Node?

---

<div class="post-metadata">

**Author:** ![Poodlepapa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/poodlepapa/32/8174_2.png) [@Poodlepapa](https://discourse.nodered.org/u/Poodlepapa)\
**Post date:** [12 February 2020 23:56 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/4 "2020-02-12T23:56:18Z")

</div>

Got it! Change node does the trick! thank you

---

<div class="post-metadata">

**Author:** ![Poodlepapa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/poodlepapa/32/8174_2.png) [@Poodlepapa](https://discourse.nodered.org/u/Poodlepapa)\
**Post date:** [13 February 2020 00:21 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/5 "2020-02-13T00:21:20Z")

</div>

I have a half way working flow! How would I define numbers to delete from the change node If I wanted anything greater than 5 removed?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [13 February 2020 10:06 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/6 "2020-02-13T10:06:53Z")

</div>

> [@Poodlepapa](#):
>
> I am going to have a random Number generator set up to a PIR sensor. When it picks any of the 1-4 is will send that number on

You have confused me. It might be best is you share your flow.  
If you want to ignore any number greater than 5 try the `switch` node

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [13 February 2020 19:21 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/7 "2020-02-13T19:21:32Z")

</div>

Have you thought instead of having that PIR signal go into a node that generates a random number between 1 and 4 instead, rather than having to delete generated numbers not in that range?

---

<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:** [13 April 2020 19:21 UTC](https://discourse.nodered.org/t/send-simple-message-as-string/21625/8 "2020-04-13T19:21:36Z")

</div>

Closed on 13 April 2020 19:21 UTC

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