# Problem with Twitter direct message, No reply

**URL:** <https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397>\
**Category:** General\
**Created:** [30 January 2019 14:29 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397 "2019-01-30T14:29:15Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 17:47 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/22 "2019-02-01T17:47:27Z")

</div>

`"Function tried to send a message of type string"`

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 17:47 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/23 "2019-02-01T17:47:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 February 2019 17:47 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/24 "2019-02-01T17:47:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 17:50 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/25 "2019-02-01T17:50:35Z")

</div>

"Function tried to send a message of type string"

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 17:58 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/26 "2019-02-01T17:58:39Z")

</div>

"Function tried to send a message of type string"

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 February 2019 18:08 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/27 "2019-02-01T18:08:02Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 18:12 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/29 "2019-02-01T18:12:43Z")

</div>

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;

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 18:18 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/30 "2019-02-01T18:18:03Z")

</div>

can i use it with out return ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 18:21 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/31 "2019-02-01T18:21:16Z")

</div>

Hi @Malhakbani

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

Your last example code:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 18:31 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/33 "2019-02-01T18:31:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 18:34 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/34 "2019-02-01T18:34:37Z")

</div>

> [@Malhakbani](#):
>
> i just sent it as JOKE ,

Sorry, I must have missed that.

```auto
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.

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 19:00 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/35 "2019-02-01T19:00:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [1 February 2019 19:10 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/36 "2019-02-01T19:10:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 22:11 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/37 "2019-02-01T22:11:08Z")

</div>

```
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

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 22:15 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/38 "2019-02-01T22:15:14Z")

</div>

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 .

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 23:26 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/39 "2019-02-01T23:26:21Z")

</div>

```
var name = "D"

var user = " username"

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

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 23:29 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/40 "2019-02-01T23:29:59Z")

</div>

```
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;
```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 February 2019 23:38 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/41 "2019-02-01T23:38:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 23:38 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/42 "2019-02-01T23:38:31Z")

</div>

all of this did not work

---

<div class="post-metadata">

**Author:** ![Malhakbani](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@Malhakbani](https://discourse.nodered.org/u/Malhakbani)\
**Post date:** [1 February 2019 23:39 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/43 "2019-02-01T23:39:01Z")

</div>

that is why i'am sharing it

please help

[Previous page](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397.md?page=1)

[Next page](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397.md?page=3)
