# 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:** 1

<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:** [30 January 2019 14:29 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/1 "2019-01-30T14:29:15Z")

</div>

IAM USING IBM NODE-RED WEBSITE  
i'am trying to develop a chatbot with NodeRED uses the direct message from Twitter, The problem is i can't reply through direct message . from what i searched i have to add (( **message\_create.message\_data**  **message\_create.target.recipient\_id**  **type** but i don't now how to add them ???

 ![00%20PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5f485d707f6217b8603689b672dfc5ccb41fc3ff.png)

---

<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:** [30 January 2019 14:55 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/2 "2019-01-30T14:55:11Z")

</div>

**message\_create.message\_data**** message\_create.target.recipient\_id **** type** thats how within the Twitter API you specify that you are sending a DM.

But the twitter node hides the API complexity from you.

Have you read the Info panel for the `twitter-out` node? It specifies a far easier format for how to send a DM

---

<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:** [30 January 2019 16:32 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/3 "2019-01-30T16:32:58Z")

</div>

You mean this one ? [https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event](https://developer.twitter.com/en/docs/direct-messages/sending-and-receiving/api-reference/new-event)

---

<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:** [30 January 2019 16:33 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/4 "2019-01-30T16:33:50Z")

</div>

i did not now how to write the code inside the function .....

---

<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:** [30 January 2019 17:27 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/5 "2019-01-30T17:27:28Z")

</div>

That isn't the info panel for the `twitter-out` node in Node-RED

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9d1e84a746da8692ca430f47651c352d7526e2ee.png)

---

<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 13:06 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/6 "2019-02-01T13:06:34Z")

</div>

yah i know , but idon't know how to write it inside the function

---

<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 13:09 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/7 "2019-02-01T13:09:27Z")

</div>

look at the section "Concatenating strings" [https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First\_steps/Strings](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/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 16:14 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/9 "2019-02-01T16:14:50Z")

</div>

i trayed everything

msg.payload.d.username every single format  
the message did not work it will not reply to direct message

the problem is : I TALK TO THE ACCOUNT THROUGH DIRECT MESSAGE, THE RAPLY FROM THE ACCOUNT IS TWEETING PUBLIC NOT TO THE SAME ACCOUNT HOW ASK THE QUESTION

---

<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 16:18 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/10 "2019-02-01T16:18:49Z")

</div>

msg.payload="D(space)@twitterusername(space)message"

and please do not shout

---

<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 16:19 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/11 "2019-02-01T16:19:57Z")

</div>

i'am so sorry i will try 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 16:21 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/12 "2019-02-01T16:21:32Z")

</div>

![27%20PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/a4d3d2b9262ab5a575c21f70ffe5965a68de8f5c.png) add new function ? or to the same function ?

---

<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 16:22 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/13 "2019-02-01T16:22:04Z")

</div>

![48%20PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/402bb5e714a5eef6540beaa94e8dc9411945a92e.png)

---

<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 16:25 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/14 "2019-02-01T16:25:28Z")

</div>

like this ?

 ![13%20PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/bbdcb5cabcfb69190c89fab046cc8119739f5c40.png)

---

<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 16:28 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/15 "2019-02-01T16:28:27Z")

</div>

@Malhakbani no, not like that.

Where Mark used `(space)` he intended you to put a space character there - just as it shows in the Twitter node help sidebar.

Lets say you want to send a DM to the @NodeRED twitter account to say "Hello". You would do:

```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 16:30 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/16 "2019-02-01T16:30:26Z")

</div>

okay this is huge mistake thanks

---

<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 16:42 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/17 "2019-02-01T16:42:22Z")

</div>

"Error: No user matches for specified terms." this from the debug and what if i want him to send to any user `@username` will it work ?

and if you see the picture i created the dailog from ibm watson convesesn i want him to send the dailog

---

<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 16:46 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/18 "2019-02-01T16:46:11Z")

</div>

Maybe try without the `@` in the username - I honestly can't remember if that's needed or not.

The usual rules apply as to which users you can DM - refer to the Twitter docs for those rules.

So in your Function you need to build up a String that looks like the one we've given you. That is where the information on String concatenation that @ukmoose linked you to would be useful.

---

<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 16:53 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/19 "2019-02-01T16:53:24Z")

</div>

and the username has to exist... and be set to accept DM from you.

---

<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:42 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/20 "2019-02-01T17:42:01Z")

</div>

i rayed multiple solution did not work

 ![19%20PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6757e2a287078dcc6b6438fce55f89cfcc9321b7.png)

---

<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:45 UTC](https://discourse.nodered.org/t/problem-with-twitter-direct-message-no-reply/7397/21 "2019-02-01T17:45:20Z")

</div>

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

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