About#

collective.mastodon is a package providing a Plone content rules action to post a status using a Mastodon account.

Code Health#

PyPI PyPI - Python Version PyPI - Wheel PyPI - License PyPI - Status

PyPI - Plone Versions

Meta Code Style

GitHub contributors GitHub Repo stars

Installation#

This package supports Plone sites using Volto and ClassicUI.

For proper Volto support, the requirements are:

  • plone.restapi >= 8.34.0

  • Volto >= 16.10.0

Add collective.mastodon to the Plone installation using pip:

pip install collective.mastodon

or add it as a dependency on your package's setup.py

    install_requires = [
        "collective.mastodon",
        "Plone",
        "plone.restapi",
        "setuptools",
    ],

Configuration#

Obtaining an Access Token#

Before you can use this package, you have to register an application on Mastodon. To do so, log in to your account, visit settings/applications/new and create the application. (Please select read and write scopes, and keep the default Redirect URI). Go to the newly created application page and copy the value of Your access token.

Configuring Plone#

This package is configured via the MASTODON_APPS environment variable which should contain a valid JSON array with your Mastodon Application information.

Each application registration requires the following information:

Key

Description

Example Value

name

Identifier for the application

localhost-user

instance

URL of your instance, without the trailing slash

http://localhost

token

Access token of your Mastodon Application

jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M

user

User on the Mastodon instance. (Only used to generate a friendly name on Plone)

user

Using the information above, the environment variable would look like:

MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]'

Starting Plone#

Now, you can start your local Plone installation with:

MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]' make start

or, if you are using a docker compose configuration, add the new environment variable under the environment key:

    environment:
      - MASTODON_APPS='[{"name": "localhost-user","instance":"http://localhost","token":"jutbgrhNDS1EvUvpoHD0ox4a7obSCT9_IpliStv799M","user":"user"}]'

After start-up visit the Content Rules Control Panel, and create a new content rule.

No additional configuration is needed for Volto support.