Node-red-contrib-mastodon

FYI Although the node is 4 years old - it seems to work fine

1 Like

Is there some context to this Si?

If you don't know why I've posted this then..........

3 Likes

Some basic info on using it to post from a bot.

Set up a bot account (botsin.space seems a popular instance choice)

Get your keys via settiings-> development
image

add new application - submit and then click on it to see keys - its the access token that's needed
image

edit a send message node
image

feed the node with something in msg.payload.text

Should get tooted out :slight_smile:

image

2 Likes

Awesome, thanks!

Is there an example of how to send media, for instance?

Haven't got to doing that yet

1 Like

GOT IT.

If you include a filename in msg.payload.image, it will include the image in the toot.

3 Likes

Excellent find and easy to use :slight_smile:

I have a function node which sets msg.payload.text to a String and then returns msg:

msg.payload.text = "Hello world"; 
return msg;

The output of the function node is connected to the input of the sendMessage node, but the value which is tooted is "undefined". What am I doing wrong?

I don't use JavaScript in functions very much but I think you need to set msg.payload to be an object first

msg.payload = {}
msg.payload.text = "Hello using function node in Node-RED"
return msg;

This woks for me

2 Likes

That did the trick. Thank you!

1 Like

or

msg.payload = {text: "Hello using function node in Node-RED"}

Many ways to skin a cat

2 Likes

#YLSNED :slight_smile:
I just use explicit core nodes wherever possible :slight_smile:

1 Like

image

One explicit core node :rofl:

2 Likes

#UpYours!!!!! :slight_smile:

I could work up a Blockly example if you prefer! :rofl:

1 Like

I would be really interested in hearing from people what they use this for. What do you/would you use a bot to send to Mastodon?

I use mine to change #cheerlights if they've stayed the same colour for around 15 minutes.

Used to do it by posting directly to twitter but now I do it on Mastodon via @cheerlights@botsin.space account that cross-posts