Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Anyone looking at Mastodon::Client?

by cavac (Vicar)
on Dec 19, 2022 at 10:22 UTC ( #11148975=note: print w/replies, xml ) Need Help??

in reply to Anyone looking at Mastodon::Client?

Well, my bot does it something like this:

print "Connecting to Mastodon...\n"; my $client = Mastodon::Client->new( instance => $config->{server}, name => 'TotallyLegitBot', client_id => $config->{key}, client_secret => $config->{secret}, access_token => $config->{token}, coerce_entities => 1, ); print "Posting message...\n"; $client->post_status('Dear Sir! I am prince Bob of Nigeria and i have +an offer for you...');

Hope that helps.

EDIT: For authentication, i went to my Mastodon account to Preferences/Development, clicked on "New Application", filled in application name and clicked submit. Then click the link with that application again and you get key+secret+token that you give your application. There are probably other ways to authorize it, but that's the one i found works without problems and with the least fuzzing about.

PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Replies are listed 'Best First'.
Re^2: Anyone looking at Mastodon::Client?
by Cody Fendant (Hermit) on Dec 20, 2022 at 07:15 UTC

    Oh that's great, it works the way you do it. Maybe I misunderstood the workflow. I thought I needed to authorise as a user in the Perl in another step. Thanks!

      There probably is another, more sleek way. Similar on how Twitter does it, when a "do you want to authorize this app" page pops up. And no, couldn't get that to work on Twitter or Mastodon.

      Still using the old Net::Twitter classes for that stuff. Didn't feel the need to upgrade my code when upgrading will probably take longer than the remaining livetime of our formerly beloved social media platform.

      PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148975]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2023-03-29 01:26 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (70 votes). Check out past polls.