# Node-red-contrib-mastodon

**URL:** <https://discourse.nodered.org/t/node-red-contrib-mastodon/70103>\
**Category:** General\
**Created:** [4 November 2022 20:35 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103 "2022-11-04T20:35:18Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [4 November 2022 20:35 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/1 "2022-11-04T20:35:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [4 November 2022 20:37 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/2 "2022-11-04T20:37:23Z")

</div>

> [@cymplecy](#):
>
> it seems to work fine

Is there some context to this Si?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [4 November 2022 20:38 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/3 "2022-11-04T20:38:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [6 November 2022 11:55 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/4 "2022-11-06T11:55:24Z")

</div>

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/0/00b5b11d7c88af347025c66560be07d92bb75261.png)

add new application - submit and then click on it to see keys - its the access token that's needed  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/556a612888fc47eeec69e5f311a2053faac3584c.png)

edit a send message node  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e38c1e0d55f248f61553cd3661e827664614a5cf.png)

feed the node with something in msg.payload.text

Should get tooted out 🙂

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/3/e362c19bf2cbe31344799111ffed453de08e4741.png)

---

<div class="post-metadata">

**Author:** ![scottkuma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scottkuma/32/70714_2.png) [@scottkuma](https://discourse.nodered.org/u/scottkuma)\
**Post date:** [15 November 2022 03:54 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/5 "2022-11-15T03:54:48Z")

</div>

Awesome, thanks!

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [15 November 2022 10:40 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/6 "2022-11-15T10:40:39Z")

</div>

Haven't got to doing that yet

---

<div class="post-metadata">

**Author:** ![scottkuma](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scottkuma/32/70714_2.png) [@scottkuma](https://discourse.nodered.org/u/scottkuma)\
**Post date:** [15 November 2022 16:21 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/7 "2022-11-15T16:21:28Z")

</div>

GOT IT.

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

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [15 November 2022 17:33 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/8 "2022-11-15T17:33:40Z")

</div>

Excellent find and easy to use 🙂

> **[CympleCyRobot (@cymplerobot@botsin.space)](https://botsin.space/@cymplerobot/109349011088691206)**
>
> Attached: 1 image
> 
> Hi there from Node-RED @ Tue Nov 15 2022 17:31

---

<div class="post-metadata">

**Author:** ![ralphcrutzen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphcrutzen/32/70902_2.png) [@ralphcrutzen](https://discourse.nodered.org/u/ralphcrutzen)\
**Post date:** [17 November 2022 13:32 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/9 "2022-11-17T13:32:49Z")

</div>

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

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

 ![Schermafdruk van 2022-11-17 14-29-48](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/6/166c061d6f62b95f9e77768ef07bac8ea247163b.png)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 November 2022 14:17 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/10 "2022-11-17T14:17:38Z")

</div>

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

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

```

This woks for me

> **[CympleCyRobot (@cymplerobot@botsin.space)](https://botsin.space/@cymplerobot/109359562628192659)**
>
> Hello using function node in Node-RED

---

<div class="post-metadata">

**Author:** ![ralphcrutzen](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphcrutzen/32/70902_2.png) [@ralphcrutzen](https://discourse.nodered.org/u/ralphcrutzen)\
**Post date:** [17 November 2022 14:20 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/11 "2022-11-17T14:20:43Z")

</div>

That did the trick. Thank you!

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [17 November 2022 20:56 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/12 "2022-11-17T20:56:58Z")

</div>

or

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

```

Many ways to skin a cat

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 November 2022 21:14 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/13 "2022-11-17T21:14:43Z")

</div>

#YLSNED 🙂  
I just use explicit core nodes wherever possible 🙂

---

<div class="post-metadata">

**Author:** ![Buckskin](https://avatars.discourse-cdn.com/v4/letter/b/b9e5f3/32.png) [@Buckskin](https://discourse.nodered.org/u/Buckskin)\
**Post date:** [17 November 2022 21:35 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/14 "2022-11-17T21:35:20Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/6715f26497f429e5d5aec441e86359805f66ad38.png)

One explicit core node 🤣

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [17 November 2022 21:52 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/15 "2022-11-17T21:52:58Z")

</div>

#UpYours!!!!! 🙂

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 November 2022 09:51 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/16 "2022-11-18T09:51:08Z")

</div>

I could work up a Blockly example if you prefer! 🤣

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [18 November 2022 09:52 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/17 "2022-11-18T09:52:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [18 November 2022 10:21 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/18 "2022-11-18T10:21:35Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/c/5c1e86a66a5ba438fee2d42b20358b4a9c4e34a8.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 December 2022 10:22 UTC](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103/19 "2022-12-02T10:22:06Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
