Problem with Twitter direct message, No reply

"Function tried to send a message of type string"

var dir1 ="D SkylineDynamics ";
var dir2 =msg.payload.output.text[0];
var joined = dir1 + dir2;
return joined;

Wire that into a debug node and check what the msg.payload now contains

"Function tried to send a message of type string"

"Function tried to send a message of type string"

because you are trying to return a string joined

The twitter node and the rest of Node-RED expects to receive an object.
As part of that object the bit that the twitter node knows what to do is msg.payload

so as @knolleary showed you

msg.payload = "D @NodeRED Hello";
return msg;

yah but it work but did not send the dialogue is send just hello

So i tried to do what you said is Concatenating strings but did not work
msg.payload =msg.payload.output.text[0];
msg.payload ="D SkylineDynamics ";
return msg;

can i use it with out return ?

Hi @Malhakbani

At this point, take a step back and go learn some basic JavaScript

Your last example code:

msg.payload =msg.payload.output.text[0];
msg.payload ="D SkylineDynamics ";
return msg;

First sets payload to the value of msg.payload.output.text[0].

Then it sets payload to the text "D SkylineDynamics " - overwriting what you had just set it to.

You need to join the value of msg.payload.output.text[0] to the end of the string "D SkylineDynamics ". We've given you links to pages that explain how to join strings.

i know javascript but i just sent it as JOKE ,

i tried to join the value of them :
var dir1 ="D SkylineDynamics ";
var dir2 =msg.payload.output.text[0];
var joined = dir1 + dir2;
return joined;

i apologize if i asked to much questions but i'am tried to learn
Just please help me with final thing
thank you @knolleary @ukmoose @dceejay
w

Sorry, I must have missed that.

var dir1 ="D SkylineDynamics ";
var dir2 =msg.payload.output.text[0];
var joined = dir1 + dir2;
return joined;

This is returning a string. You cannot do that. Youve already seen the error that causes.

It has been explained you should update msg.payload and then return msg.

guys guys thank you so much much love it works

msg.payload ="D username "+msg.payload.output.text[0];
return msg;

i looooooove you guys
but know i don't know how to make it global for all user how contact me

As you

know javascript

I'm are you can work out from the msg object you receive where the senders username is and then modify the output object to include it

var one = " D" ;
var two = "SkylineDynamics";
var joined = one + two;
msg.payload =" joined "+ msg.payload.output.text[0];
return msg;

msg.account_id = msg.req.account_id;

var name = msg.account_id;
msg.payload ="D name "+msg.payload.output.text[0];
return msg;

i tried every solution did not work

i know the problem is it have to be formatted like this ( "D username" ) and quotes is very important
but the problem how to get the user name = msg.account_id or there is another name for the account id for example msg.username_id . and how to join them to gather .

var name = "D"

var user = " username"

var test = `""${name+user}""`
msg.payload =test + msg.payload.output.text[0];
msg.payload.account= "D"
msg.payload.user = " username"
msg.payload.join = `"${msg.payload.account+msg.payload.user }"`
msg.payload =msg.payload.join+msg.payload.output.text[0];
return msg;

@Malhakbani do you have a question to go with any of these code excerpts you are sharing?

all of this did not work

that is why i'am sharing it

please help