i want to reply to anyone how contact me
"D username" +msg.payload.output.text[0] this one works but i have to specified the name like this:
"D knolleary" +msg.payload.output.text[0] and it will work but i want to be globally for anyone i did not know how
You have never described your full scenario. All you've said is you want to create a chatbot and reply using a direct message.
So we have to assume you mean they will tweet at you? Does that mean you have a Twitter In node at the start of your flow? If that is the case, then the sidebar help for the Twitter In node tells you what properties are available on the message.
Also, if you wire a Debug node after the Twitter In node and configure the Debug node to display the complete message, you can see the messages and explore it to find the username field you need.
i'am sorry if i was not clear and i appreciate your help
Yes i have Twitter account in the start of the flow where he will get any one how contact me through direct message . and i wired the node with the debug and in the sidebar he showed me the name of the account but still not possible to make it dynamic for any account to reply to
If you know what property on the message contains the username then you should be able to use that in your Function node to build the proper string.
The only problem will be the Chatbot node - I don't know off the top of my head if that node passes through all message properties, or if it only returns the properties from the Watson Conversation service.
I have given you advice on how to find that out. Use a Debug node set to display the complete message - not just msg.payload as you have it currently. Also read the Twitter In node help. You have all the pointers I can give you. Good luck.
Finally with hardwork and long hours no sleep and all the help from you guys thank you so much @ukmoose@knolleary thanks much love
final project :
the code in the function is :
var text = msg.payload.output.text[0];
var username = msg.tweet.sender.screen_name;
msg.payload =`D ${username} `+text;
return msg;