---
description: >-
  Node-RED is an awesome tool that makes prototyping a lot faster and easier!
  Node-RED is very easy to get started with and is a great tool for beginners
  who want to write and understand programming
---

# Basics

Node-RED provides lot of tools and plugins which supports almost everything related to programming.\
It can be used for APIs, DataBase, IOTIntro to IBM's Node-RED, WebSockets, Emails, Scripting, Image Processing, Cloud computing, edge computing, creating websites and lot more one can think of doing it based on NodeJS.

Once you have Node-RED set up on your IBM Cloud Account you can create your first flow

## Steps to Create Flows

### Step 1. Add an Inject node

The Inject node allows you to inject messages into a flow, either by clicking the button on the node, or setting a time interval between injects.

Drag one onto the workspace from the palette.

Open the sidebar (Ctrl-Space, or via the dropdown menu) and select the Info tab.

Select the newly added Inject node to see information about its properties and a description of what it does.

![](https://2528353307-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt6dJbzl2clqSIe4FNg%2F-Lt6dhp_n2-0F50qdVFc%2F-Lt6dkPBlQBaVJGi3Gsm%2Fimage%20\(43\).png?generation=1573160181269423\&alt=media)

### Step 2. Add a Debug Node

The Debug node causes any message to be displayed in the Debug sidebar. By default, it just displays the payload of the message, but it is possible to display the entire message object.

![](https://2528353307-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt6dJbzl2clqSIe4FNg%2F-Lt6dhp_n2-0F50qdVFc%2F-Lt6dkPDuQCDnk7OGams%2Fimage%20\(35\).png?generation=1573160183228662\&alt=media)

### Step 3. **Wire the two together**

Connect the Inject and Debug nodes together by dragging between the output port of one to the input port of the other.

![](https://2528353307-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt6dJbzl2clqSIe4FNg%2F-Lt6dhp_n2-0F50qdVFc%2F-Lt6dkPFA-GwUghL5aip%2Fimage%20\(34\).png?generation=1573160187312695\&alt=media)

### **Step 4. Deploy**

At this point, the nodes only exist in the editor and must be deployed to the server.

Click the Deploy button. Simple as that.

With the Debug sidebar tab selected, click the Inject button. You should Hello World Selected in the Side Bar. Let’s do something more useful with that.

![](https://2528353307-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt6dJbzl2clqSIe4FNg%2F-Lt6dhp_n2-0F50qdVFc%2F-Lt6dkPHXoNsf-0kMHjU%2Fimage%20\(42\).png?generation=1573160182740320\&alt=media)

### Step 5. **Add a Function node**

The Function node allows you to pass each message though a JavaScript function.

Wire the Function node in between the Inject and Debug nodes. You may need to delete the existing wire (select it and hit delete on the keyboard).

Double-click on the Function node to bring up the edit dialog. Copy the follow code into the function field:

```
var newString = msg.payload.replace("World","Everyone , I hope you enjoy Node Red ");
return {payload : newString};
```

![](https://2528353307-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lt6dJbzl2clqSIe4FNg%2F-Lt6dhp_n2-0F50qdVFc%2F-Lt6dkPJUJmmyKBqunJQ%2Fimage%20\(22\).png?generation=1573160191813309\&alt=media)
