Problem with Twitter direct message, No reply

#1

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

0 Likes

#2

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

0 Likes

#3

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

0 Likes

#4

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

0 Likes

#5

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

0 Likes

#6

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

0 Likes

#7

look at the section "Concatenating strings" https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/Strings

0 Likes

#9

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

0 Likes

#10

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

and please do not shout

1 Like

#11

i'am so sorry i will try it

0 Likes

#12

add new function ? or to the same function ?

0 Likes

#13

0 Likes

#14

like this ?

0 Likes

#15

@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:

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

#16

okay this is huge mistake thanks

0 Likes

#17

"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

0 Likes

#18

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.

0 Likes

#19

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

0 Likes

#20

i rayed multiple solution did not work

0 Likes

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