Migration from twitter to Mastodon

Hi, sorry for opening a new topic but the other discussions are closed. I installed (after other discussion mastodon nodes Node-red-contrib-mastodon) 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

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

The node itself is simple to setup
image

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?

Hi @cymplecy,thanks for the reply, I have put the accesss token and i have tested the functionality with a sendMessage node .
mastodon

What should I enter in the hashtag field?

I haven't idea.

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 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

based on info

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

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

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

image
It returns last 20 status updates

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

[{"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"]]}]

And to search for #tags

[{"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"]]}]

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

[{"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"]]}]


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

1 Like

It kept me busy today - I learnt quite a lot :slight_smile:

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

2 Likes

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

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