Twitter bot using Nod-RED

#1

Hi ,
I have created a simple Twitter bot in Node-RED,( with the twitter node updated version),but i'm not able to display messages on twitter.
Could you please help me out with this.
Thank you.

#2

I moved your post to #general as it's not about the development of the core of Node-RED but about how you use / configure a node.

#3

Are there any error messages?

Have you been through the twitter approval process?

#4

Is approval means creating Access token and key?? if yes have created an app in the Twitter dashboard. but In my program the twitter node shows this message
"waiting for search term"

#5

Okay, Thank you

#6

I'm sure we could help, but you need to share some details of what you have done and what isn't working.

The Twitter node generally 'just works' once you have the authentication details setup. Are you trying to update your twitter stream or search for tweets?

#7

Its a simple flow.

  1. Consisting of one Inject Node, One function node , one debug node, one twitter node.
  2. In the function node I have created a program fro generating random numbers ,
    The program is
    ran=Math.round(Math.random()*100);
    msg.payload=ran;
    return msg;
  3. I have wired the twitter node and function node.
  4. I can able to get the numbers through debug node , but i cannot able to generate the tweets in twitter.
#8

Do you get any errors from the Twitter node?

I note you are passing it a Number rather than a String. I think I'd expect that to work, although equally I wouldn't be surprised if the code assumed a user would be sending actual text. So you could try ensuring msg.payload is a String - msg.payload="My number: "+ran;

#9

I did not get any errors in twitter node , but in bottom i get yellow square and stating "waiting for search term "

yeah sure I will check that and get back to you.

#10

Which Twitter node are you using? That sounds like you are using the Twitter In node - which is used to search for tweets. If you want to update your twitter stream you need to use the Twitter Out node.

#11

yeah It works fine with this.
Thanks .

#12

If i didnot use msgpayload= "My Number "+ran; i get error .
Is there any reason??

#13

Ever error happens for a reason. What error do you get?

#14

TypeError: msg.payload.slice is not a function
I get this error

#15

and what is your function now?
If I have

ran=Math.round(Math.random()*100);
msg.payload= "My Number "+ran;
return msg;

it works fine

#16

In my earlier reply, I did say this:

The error you are hitting confirms this; the node expects msg.payload to be a String.