# Migration from twitter to Mastodon

**URL:** https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959
**Category:** General
**Created:** [9 February 2023 18:46 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959 "2023-02-09T18:46:35Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Folgore](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Folgore](https://discourse.nodered.org/u/Folgore)
#### Post date: [9 February 2023 18:46 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/1 "2023-02-09T18:46:35Z")

</div>

Hi, sorry for opening a new topic but the other discussions are closed. I installed (after other discussion mastodon nodes [Node-red-contrib-mastodon](https://discourse.nodered.org/t/node-red-contrib-mastodon/70103)) Node-red-contrib-mastodon to receive and send a toot . I'm having trouble getting a message from @nodes@social.nodered.org. Which hashtag should I use in node configuration?

Thanks a lot

---

<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: [9 February 2023 20:00 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/2 "2023-02-09T20:00:51Z")

</div>

Hi  
I just setup another bot two days ago so I should be able to help you 🙂

The node itself is simple to setup  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bfe3a98ae35734daac1348f9f6fee5e16dedb250.png)

You just need to enter your applications access token and enter your API url

Once you've done that, you simply set msg.payload.text to whatever you want the bot to toot out and you should be off to the races

What problem are you having exactly?

---

<div class="post-metadata">

### Author: ![Folgore](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Folgore](https://discourse.nodered.org/u/Folgore)
#### Post date: [10 February 2023 07:21 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/3 "2023-02-10T07:21:28Z")

</div>

Hi @cymplecy,thanks for the reply, I have put the accesss token and i have tested the functionality with a sendMessage node .  
 ![mastodon](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/e/0ef64c1eb3e60a4ac8b694068202db7b35a1bf2c.jpeg)

What should I enter in the hashtag field?

I haven't idea.

---

<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: [10 February 2023 07:33 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/4 "2023-02-10T07:33:27Z")

</div>

Sorry - I've just realised your trying to receive not send - not done that myself (did it with Snap! but not NR) but I'll have a play

1st thing that occurs to me is make sure your bot is following @nodes@social.nodered.org as probably no other bot on botsin.space will be following anything from [social.nodred.org](http://social.nodred.org) so no #tags will be picked up by the botsin.space instance

But I've noticed that @nodes@social.nodered.org isn't posting using #NodeRED so I think we'll need that adding onto its posts

I'll try and see if my bot can pick up #tag stuff from another account

[edit 2] When I first started playing with mastodon, I was making direct API calls and when checking out API documention - I think the v1 method had been removed and since this mastodon node is quite old things may have moved on.  
Anyway I got this to return some results

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

based on info

> **[search API methods - Mastodon documentation](https://docs.joinmastodon.org/methods/search/#v2)**
>
> Search for content in accounts, statuses and hashtags.

[edit 3] Having found the id of @nodes@social.nodered.org - this API call seems to return the last two status updates

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

I'm stopping for the moment to see if any of this is of use to you 🙂

[edit 4]But I've carried on 🙂 Maybe the rss feed is the way to go ?

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/81992d3bfd8923754c97a60effe3c474da80f9e4.png)  
It returns last 20 status updates

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/657da1487769d6ba1a923854804323eca6e342cc.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: [10 February 2023 11:29 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/5 "2023-02-10T11:29:11Z")

</div>

Ignoring all my rambling above - this flow will get the last 20 status from  
`@nodes@social.nodered.org`  
🙂

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

```auto
[{"id":"f8763c2e1614896a","type":"function","z":"515cba3a2d3cfa9b","name":"function 1","func":"var oldPayload, newPayload, i2;\n\n\noldPayload = (msg['payload']);\nnewPayload = [];\nfor (i2 = 1; i2 <= 20; i2++) {\n newPayload.push(((oldPayload[(i2 - 1)])['description'])[0]);\n}\nmsg['payload'] = newPayload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":730,"y":700,"wires":[["dda1f3b644540cbc"]]},{"id":"01f38c57d51105fe","type":"inject","z":"515cba3a2d3cfa9b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":700,"wires":[["df5600641d01ef91"]]},{"id":"dda1f3b644540cbc","type":"debug","z":"515cba3a2d3cfa9b","name":"debug 44","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":700,"wires":[]},{"id":"df5600641d01ef91","type":"http request","z":"515cba3a2d3cfa9b","name":"rss","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://social.nodered.org/@nodes.rss","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":290,"y":700,"wires":[["689c06a9383b6398"]]},{"id":"689c06a9383b6398","type":"xml","z":"515cba3a2d3cfa9b","name":"","property":"payload","attr":"","chr":"","x":420,"y":700,"wires":[["49d83156e6778928"]]},{"id":"49d83156e6778928","type":"change","z":"515cba3a2d3cfa9b","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.rss.channel[0].item","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":700,"wires":[["f8763c2e1614896a"]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/6/06b59540ce74ddbc8d8b3525049ac34301145700.png)

And to search for #tags

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/72b91457361e4745ad8f4656e58f0995b07b72fd.png)

```auto
[{"id":"ae5da2d05ddd9d45","type":"inject","z":"515cba3a2d3cfa9b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"NodeRED","payloadType":"str","x":120,"y":840,"wires":[["0bfd84a6b2e93ca6"]]},{"id":"a3d1ad7a1715db26","type":"http request","z":"515cba3a2d3cfa9b","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"credentials":{},"x":480,"y":840,"wires":[["1983128f338848bb"]]},{"id":"0d00de4fbc88c282","type":"debug","z":"515cba3a2d3cfa9b","name":"debug 46","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":860,"y":840,"wires":[]},{"id":"0bfd84a6b2e93ca6","type":"template","z":"515cba3a2d3cfa9b","name":"","field":"url","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"https://botsin.space/api/v1/timelines/tag/{{payload}}","output":"str","x":270,"y":840,"wires":[["a3d1ad7a1715db26"]]},{"id":"1983128f338848bb","type":"function","z":"515cba3a2d3cfa9b","name":"function 2","func":"var oldPayload, newPayload, i2;\n\n\noldPayload = (msg['payload']);\nnewPayload = [];\nfor (i2 = 1; i2 <= 20; i2++) {\n newPayload.push(((oldPayload[(i2 - 1)])['content']));\n}\nmsg['payload'] = newPayload;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":660,"y":840,"wires":[["0d00de4fbc88c282"]]}]

```

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

And for completeness sake to remove any need for node-red-contrib-mastodon, you can use this to post from your bot - just add in your own token (and change the injected msg.payload)

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

```auto
[{"id":"d32f54d3569d2c58","type":"inject","z":"515cba3a2d3cfa9b","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"status=@cymplecy@fosstodon.org test from Node-RED! ","payloadType":"str","x":240,"y":1210,"wires":[["3abdfcbbe39e55dd"]]},{"id":"e3ac11c9ade30dc7","type":"debug","z":"515cba3a2d3cfa9b","name":"debug 50","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":630,"y":1210,"wires":[]},{"id":"3abdfcbbe39e55dd","type":"http request","z":"515cba3a2d3cfa9b","name":"","method":"POST","ret":"txt","paytoqs":"query","url":"https://botsin.space/api/v1/statuses","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"bearer","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"application/x-www-form-urlencoded"}],"credentials":{},"x":430,"y":1210,"wires":[["e3ac11c9ade30dc7"]]}]

```

---

<div class="post-metadata">

### Author: ![Folgore](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Folgore](https://discourse.nodered.org/u/Folgore)
#### Post date: [10 February 2023 17:03 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/6 "2023-02-10T17:03:43Z")

</div>

Very good, thaks a lot @cymplecy. I have uset a first flow that you publish.

---

<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: [10 February 2023 17:19 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/7 "2023-02-10T17:19:33Z")

</div>

It kept me busy today - I learnt quite a lot 🙂

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [10 February 2023 20:39 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/8 "2023-02-10T20:39:35Z")

</div>

> [@cymplecy](#):
>
> It kept me busy today

My 2 1/2 year old granddaughter kept me busy all day 🙂

---

<div class="post-metadata">

### Author: ![Folgore](https://avatars.discourse-cdn.com/v4/letter/f/edb3f5/32.png) [@Folgore](https://discourse.nodered.org/u/Folgore)
#### Post date: [13 February 2023 09:45 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/9 "2023-02-13T09:45:34Z")

</div>

Sorry for the disturbe... However, it's working very well..for send a new nodes to telegram channel.

---

<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: [27 February 2023 09:46 UTC](https://discourse.nodered.org/t/migration-from-twitter-to-mastodon/74959/10 "2023-02-27T09:46:33Z")

</div>

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