Drupal is a registered trademark of Dries Buytaert

mastodon_api

No security coverage
View on drupal.org
Mastodon API

This module will integrate with the Mastodon API, allowing you to "Toot" from within the Drupal interface.

The idea is that you can install this module if you want to quickly share your content with a Mastodon instance. It has few dependencies and so should be compatible with most Drupal sites.

Usage

The configuration of this module is in two parts, with the Mastodon needing separate configuration to the Drupal site.

Mastodon

  • Go to the /settings/applications page on your Mastodon instance and create a new application. Fill in the application name and application website with your own values. The redirect URI should be left as the default that comes with the platform.
  • You will need to set the following permissions:
    • read:statuses
    • profile
    • write:media
    • write:statuses
  • Once the app has been approved then you are ready to install the Drupal module.

Drupal

  • Install the module as normal.
  • Head to the Mastodon API configuration pages at the path /admin/config/services/mastodon. This can be found in the Configuration > Web services menu.
  • Enter your Access Token into the Mastodon Auth settings form.
  • You can validate the authentication using the "Validate Auth" tab.
  • Once you have the authentication configured you can then run the "Fetch configuration from instance" function on the main auth settings form. This will pull in the instance configuration items and attempt to set any settings defined by the module.
  • Once everything is set up you can toot from the "Push Status" tab.

Permissions

The following permissions are defined.

Administer Mastodon API

  • Machine name: administer mastodon api
  • Description: Configure Mastodon API settings.

Sub Modules

Mastodon API Entity

This sub-module will attach the Mastodon push form to a content entity type and inject content from the entity into the push form ready for publishing. This way you can format your content ready to go and just click a button to toot.

The formatting is done via a plugin and so is fully configurable and can be overridden in your own modules.

Usage

  • Install the Mastodon API Entity sub-module.
  • Head to the Mastodon API configuration pages at the path /admin/config/services/mastodon. This can be found in the Configuration > Web services menu.
  • Go to the "Entity" tab and click the "Add Mastodon API Entity" action button.
  • If you want to attach the form to Content Types then select "Content Type" from the type list and then pick the bundles you want to target. Then, select the format type you want to use.
  • Save the form to create the entity. You can then see a "Mastodon" tab on the content item where you can create toots. The format type you selected will dictate the contents of the box. You can edit the contents before clicking the submit button.
Mastodon Entity Format Plugin

This plugin type exists to allow customisation of the Mastodon API push form. The following plugins exist in the sub-module.

  • Basic - This just prints the title of the content item.
  • Link - This prints the title and associated URL of the content item.
  • Token - This format type accepts a configuration setting that makes use of the token system to allow custom content to be set.

Alternatives

ActivityPub

The ActivityPub module is used to turn your Drupal site into a federated ActivityPub site. This allows users to follow content on your site from any ActivityPub site. In other words, it aggregates content on your site to ActivityPub instances where it will appear in user's timelines.

"AI" Policy

No "AI" was used in the creation of this module.

No "AI" contributions are welcome.

Activity

Total releases
1
First release
Jul 2025
Latest release
7 months ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.x-dev Dev Jul 25, 2025