Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(pieces): add AI-agent atomics to mastodon and output schemas to crypto (#15756)

Odai Ahmad23899c9eae92
diff --git a/bun.lock b/bun.lock
index c4e9e98326d..1486ea18d91 100644
--- a/bun.lock
+++ b/bun.lock
@@ -5493,7 +5493,7 @@
},
"packages/pieces/community/mastodon": {
"name": "@activepieces/piece-mastodon",
- "version": "0.6.0",
+ "version": "0.7.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
@@ -10301,7 +10301,7 @@
},
"packages/pieces/core/crypto": {
"name": "@activepieces/piece-crypto",
- "version": "0.0.28",
+ "version": "0.0.29",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/mastodon/package.json b/packages/pieces/community/mastodon/package.json
index 5ba020be9ec..80adc540dc9 100644
--- a/packages/pieces/community/mastodon/package.json
+++ b/packages/pieces/community/mastodon/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-mastodon",
- "version": "0.6.0",
+ "version": "0.7.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/mastodon/src/i18n/translation.json b/packages/pieces/community/mastodon/src/i18n/translation.json
index a27d1b8a092..632a419f437 100644
--- a/packages/pieces/community/mastodon/src/i18n/translation.json
+++ b/packages/pieces/community/mastodon/src/i18n/translation.json
@@ -4,7 +4,6 @@
"Access Token": "Access Token",
"The base URL of your Mastodon instance": "The base URL of your Mastodon instance",
"The access token for your Mastodon account, check the documentation for how to get this": "The access token for your Mastodon account, check the documentation for how to get this",
- "\n**Base Url**: The base url of your Mastodon instance (e.g `https://mastodon.social`)\n\n**Access Token**: To get your access token, follow the steps below:\n\n1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**\n2. Fill the Information\n3. Click on **Create Application**\n4. Copy access token from **Your access token**\n": "\n**Base Url**: The base url of your Mastodon instance (e.g `https://mastodon.social`)\n\n**Access Token**: To get your access token, follow the steps below:\n\n1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**\n2. Fill the Information\n3. Click on **Create Application**\n4. Copy access token from **Your access token**\n",
"Post Status": "Post Status",
"Custom API Call": "Custom API Call",
"Post a status to Mastodon": "Post a status to Mastodon",
@@ -33,5 +32,415 @@
"None": "None",
"JSON": "JSON",
"Form Data": "Form Data",
- "Raw": "Raw"
+ "Raw": "Raw",
+ "\n**Base Url**: The base url of your Mastodon instance (e.g `https://mastodon.social`)\n\n**Access Token**: To get your access token, follow the steps below:\n\n1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**\n2. Fill the Information\n3. Under **Scopes**, tick **read** and **write** (the form pre-selects only `profile`)\n4. Click on **Create Application**\n5. Copy access token from **Your access token**\n\nIf an existing connection fails with a missing-scope error, edit the appli": "\n**Base Url**: The base url of your Mastodon instance (e.g `https://mastodon.social`)\n\n**Access Token**: To get your access token, follow the steps below:\n\n1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**\n2. Fill the Information\n3. Under **Scopes**, tick **read** and **write** (the form pre-selects only `profile`)\n4. Click on **Create Application**\n5. Copy access token from **Your access token**\n\nIf an existing connection fails with a missing-scope error, edit the application in Mastodon, tick **read** and **write**, save (this regenerates the token) and paste the new token here.\n",
+ "Create Status": "Create Status",
+ "Schedule Status": "Schedule Status",
+ "Get Status": "Get Status",
+ "Edit Status": "Edit Status",
+ "Delete Status": "Delete Status",
+ "Get Status Thread": "Get Status Thread",
+ "List Accounts That Boosted a Status": "List Accounts That Boosted a Status",
+ "List Accounts That Favourited a Status": "List Accounts That Favourited a Status",
+ "Favourite Status": "Favourite Status",
+ "Unfavourite Status": "Unfavourite Status",
+ "Boost Status": "Boost Status",
+ "Unboost Status": "Unboost Status",
+ "Bookmark Status": "Bookmark Status",
+ "Remove Bookmark": "Remove Bookmark",
+ "Mute Conversation": "Mute Conversation",
+ "Unmute Conversation": "Unmute Conversation",
+ "Pin Status to Profile": "Pin Status to Profile",
+ "Unpin Status from Profile": "Unpin Status from Profile",
+ "List Scheduled Statuses": "List Scheduled Statuses",
+ "Get Scheduled Status": "Get Scheduled Status",
+ "Reschedule Status": "Reschedule Status",
+ "Cancel Scheduled Status": "Cancel Scheduled Status",
+ "Upload Media": "Upload Media",
+ "Get Media": "Get Media",
+ "Update Media": "Update Media",
+ "Delete Media": "Delete Media",
+ "Get My Account": "Get My Account",
+ "Update My Profile": "Update My Profile",
+ "Get Account": "Get Account",
+ "Lookup Account": "Lookup Account",
+ "Search Accounts": "Search Accounts",
+ "List Account Statuses": "List Account Statuses",
+ "List Account Followers": "List Account Followers",
+ "List Account Following": "List Account Following",
+ "Get Relationships": "Get Relationships",
+ "Follow Account": "Follow Account",
+ "Unfollow Account": "Unfollow Account",
+ "Block Account": "Block Account",
+ "Unblock Account": "Unblock Account",
+ "Mute Account": "Mute Account",
+ "Unmute Account": "Unmute Account",
+ "List Blocked Accounts": "List Blocked Accounts",
+ "List Muted Accounts": "List Muted Accounts",
+ "List Follow Requests": "List Follow Requests",
+ "Accept Follow Request": "Accept Follow Request",
+ "Reject Follow Request": "Reject Follow Request",
+ "List Bookmarks": "List Bookmarks",
+ "List Favourites": "List Favourites",
+ "Get Home Timeline": "Get Home Timeline",
+ "Get Public Timeline": "Get Public Timeline",
+ "Get Hashtag Timeline": "Get Hashtag Timeline",
+ "Get List Timeline": "Get List Timeline",
+ "List Notifications": "List Notifications",
+ "Get Notification": "Get Notification",
+ "Dismiss Notification": "Dismiss Notification",
+ "Clear All Notifications": "Clear All Notifications",
+ "Get Unread Notification Count": "Get Unread Notification Count",
+ "Search": "Search",
+ "List Lists": "List Lists",
+ "Get List": "Get List",
+ "Create List": "Create List",
+ "Update List": "Update List",
+ "Delete List": "Delete List",
+ "List Accounts in List": "List Accounts in List",
+ "Add Accounts to List": "Add Accounts to List",
+ "Remove Accounts from List": "Remove Accounts from List",
+ "Get Poll": "Get Poll",
+ "Vote in Poll": "Vote in Poll",
+ "List Conversations": "List Conversations",
+ "Mark Conversation as Read": "Mark Conversation as Read",
+ "Remove Conversation": "Remove Conversation",
+ "Get Hashtag": "Get Hashtag",
+ "Follow Hashtag": "Follow Hashtag",
+ "Unfollow Hashtag": "Unfollow Hashtag",
+ "List Followed Hashtags": "List Followed Hashtags",
+ "List Filters": "List Filters",
+ "Get Filter": "Get Filter",
+ "Create Filter": "Create Filter",
+ "Update Filter": "Update Filter",
+ "Delete Filter": "Delete Filter",
+ "Get Trending Hashtags": "Get Trending Hashtags",
+ "Get Trending Statuses": "Get Trending Statuses",
+ "Get Trending Links": "Get Trending Links",
+ "Get Instance Info": "Get Instance Info",
+ "Publish a status (toot), reply, or poll from the connected account.": "Publish a status (toot), reply, or poll from the connected account.",
+ "Schedule a status to be published automatically at a future time.": "Schedule a status to be published automatically at a future time.",
+ "Get a single status by its ID.": "Get a single status by its ID.",
+ "Edit the text, content warning, media or poll of one of your statuses.": "Edit the text, content warning, media or poll of one of your statuses.",
+ "Permanently delete one of your own statuses.": "Permanently delete one of your own statuses.",
+ "Get the ancestors and replies of a status.": "Get the ancestors and replies of a status.",
+ "List the accounts that boosted (reblogged) a status.": "List the accounts that boosted (reblogged) a status.",
+ "List the accounts that favourited a status.": "List the accounts that favourited a status.",
+ "Add a status to your favourites.": "Add a status to your favourites.",
+ "Remove a status from your favourites.": "Remove a status from your favourites.",
+ "Boost (reblog) a status to your followers.": "Boost (reblog) a status to your followers.",
+ "Undo a boost (reblog) of a status.": "Undo a boost (reblog) of a status.",
+ "Privately bookmark a status.": "Privately bookmark a status.",
+ "Remove a status from your bookmarks.": "Remove a status from your bookmarks.",
+ "Stop receiving notifications for a thread.": "Stop receiving notifications for a thread.",
+ "Resume notifications for a muted thread.": "Resume notifications for a muted thread.",
+ "Feature one of your statuses at the top of your profile.": "Feature one of your statuses at the top of your profile.",
+ "Remove a pinned status from your profile.": "Remove a pinned status from your profile.",
+ "List your statuses scheduled for future publication.": "List your statuses scheduled for future publication.",
+ "Get a scheduled status by its ID.": "Get a scheduled status by its ID.",
+ "Change the publication time of a scheduled status.": "Change the publication time of a scheduled status.",
+ "Cancel a scheduled status so it is never published.": "Cancel a scheduled status so it is never published.",
+ "Upload an image, video or audio file to attach to a status.": "Upload an image, video or audio file to attach to a status.",
+ "Check an uploaded media file, including whether it has finished processing.": "Check an uploaded media file, including whether it has finished processing.",
+ "Change the alt text or focal point of an uploaded media file.": "Change the alt text or focal point of an uploaded media file.",
+ "Delete an uploaded media file that is not attached to a status.": "Delete an uploaded media file that is not attached to a status.",
+ "Get the profile of the connected account.": "Get the profile of the connected account.",
+ "Update the display name, bio and settings of the connected account.": "Update the display name, bio and settings of the connected account.",
+ "Get a Mastodon account profile by its ID.": "Get a Mastodon account profile by its ID.",
+ "Find an account by its handle (username or user@domain).": "Find an account by its handle (username or user@domain).",
+ "Search for accounts by name or handle.": "Search for accounts by name or handle.",
+ "List the statuses posted by an account.": "List the statuses posted by an account.",
+ "List the followers of an account.": "List the followers of an account.",
+ "List the accounts an account follows.": "List the accounts an account follows.",
+ "Check how the connected account relates to other accounts.": "Check how the connected account relates to other accounts.",
+ "Follow an account, or send a follow request to a locked account.": "Follow an account, or send a follow request to a locked account.",
+ "Stop following an account.": "Stop following an account.",
+ "Block an account.": "Block an account.",
+ "Unblock an account.": "Unblock an account.",
+ "Hide an account's posts, and optionally its notifications.": "Hide an account's posts, and optionally its notifications.",
+ "Unmute an account.": "Unmute an account.",
+ "List the accounts you have blocked.": "List the accounts you have blocked.",
+ "List the accounts you have muted.": "List the accounts you have muted.",
+ "List pending requests to follow your account.": "List pending requests to follow your account.",
+ "Accept a pending follow request.": "Accept a pending follow request.",
+ "Reject a pending follow request.": "Reject a pending follow request.",
+ "List the statuses you have bookmarked.": "List the statuses you have bookmarked.",
+ "List the statuses you have favourited.": "List the statuses you have favourited.",
+ "Get statuses from accounts and hashtags you follow.": "Get statuses from accounts and hashtags you follow.",
+ "Get recent public statuses known to the server.": "Get recent public statuses known to the server.",
+ "Get recent public statuses that use a hashtag.": "Get recent public statuses that use a hashtag.",
+ "Get statuses from the members of one of your lists.": "Get statuses from the members of one of your lists.",
+ "List notifications of the connected account.": "List notifications of the connected account.",
+ "Get a single notification by its ID.": "Get a single notification by its ID.",
+ "Dismiss a single notification.": "Dismiss a single notification.",
+ "Remove all notifications of the connected account.": "Remove all notifications of the connected account.",
+ "Get the number of unread notifications.": "Get the number of unread notifications.",
+ "Search for accounts, statuses and hashtags.": "Search for accounts, statuses and hashtags.",
+ "List all of your lists.": "List all of your lists.",
+ "Get one of your lists by its ID.": "Get one of your lists by its ID.",
+ "Create a new list for grouping accounts you follow.": "Create a new list for grouping accounts you follow.",
+ "Rename a list or change its settings.": "Rename a list or change its settings.",
+ "Delete one of your lists.": "Delete one of your lists.",
+ "List the accounts that are members of one of your lists.": "List the accounts that are members of one of your lists.",
+ "Add accounts you follow to one of your lists.": "Add accounts you follow to one of your lists.",
+ "Remove accounts from one of your lists.": "Remove accounts from one of your lists.",
+ "Get a poll with its current results.": "Get a poll with its current results.",
+ "Cast a vote in a poll.": "Cast a vote in a poll.",
+ "List your direct-message conversations.": "List your direct-message conversations.",
+ "Mark a direct-message conversation as read.": "Mark a direct-message conversation as read.",
+ "Remove a direct-message conversation from your list.": "Remove a direct-message conversation from your list.",
+ "Get information about a hashtag.": "Get information about a hashtag.",
+ "Follow a hashtag so its posts appear in your home timeline.": "Follow a hashtag so its posts appear in your home timeline.",
+ "Stop following a hashtag.": "Stop following a hashtag.",
+ "List the hashtags you follow.": "List the hashtags you follow.",
+ "List all of your content filters.": "List all of your content filters.",
+ "Get one of your content filters by its ID.": "Get one of your content filters by its ID.",
+ "Create a content filter that hides or warns about matching posts.": "Create a content filter that hides or warns about matching posts.",
+ "Change the title, contexts, action or expiry of a content filter.": "Change the title, contexts, action or expiry of a content filter.",
+ "Delete one of your content filters.": "Delete one of your content filters.",
+ "Get hashtags that are trending on the server.": "Get hashtags that are trending on the server.",
+ "Get statuses that are trending on the server.": "Get statuses that are trending on the server.",
+ "Get news links that are trending on the server.": "Get news links that are trending on the server.",
+ "Get information about the connected Mastodon server.": "Get information about the connected Mastodon server.",
+ "Status Text": "Status Text",
+ "Visibility": "Visibility",
+ "In Reply To (Status ID)": "In Reply To (Status ID)",
+ "Content Warning": "Content Warning",
+ "Mark Media as Sensitive": "Mark Media as Sensitive",
+ "Language": "Language",
+ "Media IDs": "Media IDs",
+ "Poll Options": "Poll Options",
+ "Poll Duration (seconds)": "Poll Duration (seconds)",
+ "Allow Multiple Choices": "Allow Multiple Choices",
+ "Idempotency Key": "Idempotency Key",
+ "Scheduled At": "Scheduled At",
+ "Status ID": "Status ID",
+ "Delete Media Immediately": "Delete Media Immediately",
+ "Limit": "Limit",
+ "Max ID (older page)": "Max ID (older page)",
+ "Since ID (newer results)": "Since ID (newer results)",
+ "Min ID (newer page)": "Min ID (newer page)",
+ "Scheduled Status ID": "Scheduled Status ID",
+ "File": "File",
+ "Alt Text": "Alt Text",
+ "Focal Point": "Focal Point",
+ "Media ID": "Media ID",
+ "Display Name": "Display Name",
+ "Bio": "Bio",
+ "Require Follow Approval": "Require Follow Approval",
+ "Bot Account": "Bot Account",
+ "Discoverable": "Discoverable",
+ "Default Post Visibility": "Default Post Visibility",
+ "Default Post Language": "Default Post Language",
+ "Account ID": "Account ID",
+ "Handle": "Handle",
+ "Query": "Query",
+ "Offset": "Offset",
+ "Resolve Remote Accounts": "Resolve Remote Accounts",
+ "Only Accounts I Follow": "Only Accounts I Follow",
+ "Only Statuses With Media": "Only Statuses With Media",
+ "Exclude Replies": "Exclude Replies",
+ "Exclude Boosts": "Exclude Boosts",
+ "Only Pinned Statuses": "Only Pinned Statuses",
+ "Hashtag Filter": "Hashtag Filter",
+ "Account IDs": "Account IDs",
+ "Show Their Boosts": "Show Their Boosts",
+ "Notify When They Post": "Notify When They Post",
+ "Languages": "Languages",
+ "Mute Notifications": "Mute Notifications",
+ "Duration (seconds)": "Duration (seconds)",
+ "Only Local Statuses": "Only Local Statuses",
+ "Only Remote Statuses": "Only Remote Statuses",
+ "Hashtag": "Hashtag",
+ "Any of These Tags": "Any of These Tags",
+ "All of These Tags": "All of These Tags",
+ "None of These Tags": "None of These Tags",
+ "List ID": "List ID",
+ "Include Types": "Include Types",
+ "Exclude Types": "Exclude Types",
+ "From Account ID": "From Account ID",
+ "Notification ID": "Notification ID",
+ "Count Only Types": "Count Only Types",
+ "Maximum Count": "Maximum Count",
+ "Result Type": "Result Type",
+ "Resolve Remote Content": "Resolve Remote Content",
+ "Statuses By Account ID": "Statuses By Account ID",
+ "Exclude Unreviewed Hashtags": "Exclude Unreviewed Hashtags",
+ "Max ID": "Max ID",
+ "Min ID": "Min ID",
+ "Title": "Title",
+ "Show Replies To": "Show Replies To",
+ "Hide Members From Home Timeline": "Hide Members From Home Timeline",
+ "Poll ID": "Poll ID",
+ "Choices": "Choices",
+ "Conversation ID": "Conversation ID",
+ "Filter ID": "Filter ID",
+ "Apply In": "Apply In",
+ "Keywords": "Keywords",
+ "Match Whole Words Only": "Match Whole Words Only",
+ "Action": "Action",
+ "Expires In (seconds)": "Expires In (seconds)",
+ "The text of the post. Mentions (@user@domain), hashtags and links are parsed by Mastodon. Required unless Media IDs are provided. Use Get Instance Info to read the server character limit (500 by default).": "The text of the post. Mentions (@user@domain), hashtags and links are parsed by Mastodon. Required unless Media IDs are provided. Use Get Instance Info to read the server character limit (500 by default).",
+ "Who can see the post. Leave empty to use the account default posting privacy.": "Who can see the post. Leave empty to use the account default posting privacy.",
+ "Local ID of the status to reply to, for example 109372843234737004. Obtain it from Get Status, a timeline or Search (with resolve for remote URLs).": "Local ID of the status to reply to, for example 109372843234737004. Obtain it from Get Status, a timeline or Search (with resolve for remote URLs).",
+ "Optional content warning shown before the post text.": "Optional content warning shown before the post text.",
+ "Whether attached media should be hidden behind a sensitive-content warning. Leave empty for the account default.": "Whether attached media should be hidden behind a sensitive-content warning. Leave empty for the account default.",
+ "ISO 639-1 two-letter language code of the post, for example en or de.": "ISO 639-1 two-letter language code of the post, for example en or de.",
+ "IDs of media returned by Upload Media, one per item (up to the server limit, 4 by default). Cannot be combined with a poll.": "IDs of media returned by Upload Media, one per item (up to the server limit, 4 by default). Cannot be combined with a poll.",
+ "Answer choices for a poll, one per item (2 to 4 on most servers). Cannot be combined with media.": "Answer choices for a poll, one per item (2 to 4 on most servers). Cannot be combined with media.",
+ "How long the poll stays open, in seconds. Mastodon accepts 300 (5 minutes) to 2629746 (1 month). Required with Poll Options.": "How long the poll stays open, in seconds. Mastodon accepts 300 (5 minutes) to 2629746 (1 month). Required with Poll Options.",
+ "Whether voters may pick more than one option. Leave empty for single choice.": "Whether voters may pick more than one option. Leave empty for single choice.",
+ "Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and returns the original post instead of creating a duplicate when the same key is sent again.": "Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and returns the original post instead of creating a duplicate when the same key is sent again.",
+ "When to publish, as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.": "When to publish, as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.",
+ "Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and ignores a duplicate submission with the same key.": "Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and ignores a duplicate submission with the same key.",
+ "Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Create Status or Search.": "Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Create Status or Search.",
+ "Local ID of your own status to edit. Obtain it from Create Status, Get Status or List Account Statuses.": "Local ID of your own status to edit. Obtain it from Create Status, Get Status or List Account Statuses.",
+ "New text of the post. Leave empty to keep the current text.": "New text of the post. Leave empty to keep the current text.",
+ "New content warning. Leave empty to keep the current one.": "New content warning. Leave empty to keep the current one.",
+ "Leave empty to keep the current setting.": "Leave empty to keep the current setting.",
+ "New ISO 639-1 language code, for example en. Leave empty to keep the current language.": "New ISO 639-1 language code, for example en. Leave empty to keep the current language.",
+ "Replaces the attached media with these IDs (from Upload Media or the current media_attachments). Leave empty to keep the current media.": "Replaces the attached media with these IDs (from Upload Media or the current media_attachments). Leave empty to keep the current media.",
+ "New poll choices, one per item. Changing them resets all votes. Leave empty to keep the current poll.": "New poll choices, one per item. Changing them resets all votes. Leave empty to keep the current poll.",
+ "New poll duration from now, in seconds (300 to 2629746). Leave empty to keep the current closing time.": "New poll duration from now, in seconds (300 to 2629746). Leave empty to keep the current closing time.",
+ "Changing this resets all votes. Leave empty to keep the current setting.": "Changing this resets all votes. Leave empty to keep the current setting.",
+ "Local ID of your own status to delete. Obtain it from Create Status, Get Status or List Account Statuses.": "Local ID of your own status to delete. Obtain it from Create Status, Get Status or List Account Statuses.",
+ "Delete the attached media right away instead of keeping it for about 24 hours for reuse. Requires Mastodon 4.4 or later; older servers ignore it.": "Delete the attached media right away instead of keeping it for about 24 hours for reuse. Requires Mastodon 4.4 or later; older servers ignore it.",
+ "Local ID of the status whose thread to read. Obtain it from a timeline, Get Status or Search.": "Local ID of the status whose thread to read. Obtain it from a timeline, Get Status or Search.",
+ "Local ID of the status. Obtain it from a timeline, Get Status or Search.": "Local ID of the status. Obtain it from a timeline, Get Status or Search.",
+ "Maximum number of accounts to return in this page. Defaults to 40, maximum 80.": "Maximum number of accounts to return in this page. Defaults to 40, maximum 80.",
+ "Cursor for the next (older) page. Pass the `next_max_id` value from the previous page of this same action. Leave empty for the newest page.": "Cursor for the next (older) page. Pass the `next_max_id` value from the previous page of this same action. Leave empty for the newest page.",
+ "Cursor for newer results. Pass the `prev_since_id` value from a previous page of this same action to page back towards newer items.": "Cursor for newer results. Pass the `prev_since_id` value from a previous page of this same action to page back towards newer items.",
+ "Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).": "Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).",
+ "Local ID of the status to boost. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).": "Local ID of the status to boost. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).",
+ "Who sees the boost. Leave empty to use the account default posting privacy.": "Who sees the boost. Leave empty to use the account default posting privacy.",
+ "Local ID of your own status. Obtain it from Create Status, Get Status or List Account Statuses.": "Local ID of your own status. Obtain it from Create Status, Get Status or List Account Statuses.",
+ "Maximum number of scheduled statuses to return in this page. Defaults to 20, maximum 40.": "Maximum number of scheduled statuses to return in this page. Defaults to 20, maximum 40.",
+ "Cursor for the page immediately newer than a previous page. Pass the `prev_min_id` value from a previous page of this same action.": "Cursor for the page immediately newer than a previous page. Pass the `prev_min_id` value from a previous page of this same action.",
+ "ID of the scheduled status. Obtain it from Schedule Status or List Scheduled Statuses.": "ID of the scheduled status. Obtain it from Schedule Status or List Scheduled Statuses.",
+ "New publication time as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.": "New publication time as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.",
+ "The image, video or audio file to upload.": "The image, video or audio file to upload.",
+ "Plain-text description of the media for accessibility (alt text).": "Plain-text description of the media for accessibility (alt text).",
+ "Focal point for thumbnail cropping as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.": "Focal point for thumbnail cropping as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.",
+ "ID of the unattached media. Obtain it from Upload Media.": "ID of the unattached media. Obtain it from Upload Media.",
+ "New plain-text description of the media for accessibility.": "New plain-text description of the media for accessibility.",
+ "New focal point as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.": "New focal point as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.",
+ "ID of the media attachment. Obtain it from Upload Media.": "ID of the media attachment. Obtain it from Upload Media.",
+ "New display name shown on the profile.": "New display name shown on the profile.",
+ "New profile bio text.": "New profile bio text.",
+ "Whether new followers must be approved manually. Leave empty to keep the current setting.": "Whether new followers must be approved manually. Leave empty to keep the current setting.",
+ "Whether the profile is flagged as an automated (bot) account. Leave empty to keep the current setting.": "Whether the profile is flagged as an automated (bot) account. Leave empty to keep the current setting.",
+ "Whether the account is featured in the profile directory. Leave empty to keep the current setting.": "Whether the account is featured in the profile directory. Leave empty to keep the current setting.",
+ "Default privacy for new posts. Leave empty to keep the current setting.": "Default privacy for new posts. Leave empty to keep the current setting.",
+ "Default ISO 639-1 language code for new posts, for example en.": "Default ISO 639-1 language code for new posts, for example en.",
+ "Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).": "Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).",
+ "Username for a local account (for example Gargron) or user@domain for a remote one (for example [email protected]). A leading @ is removed automatically.": "Username for a local account (for example Gargron) or user@domain for a remote one (for example [email protected]). A leading @ is removed automatically.",
+ "Text to search for, for example a name, username or user@domain.": "Text to search for, for example a name, username or user@domain.",
+ "Number of results to skip, for paging. Defaults to 0.": "Number of results to skip, for paging. Defaults to 0.",
+ "Look up unknown remote accounts via WebFinger (slower). Leave empty for the server default (no).": "Look up unknown remote accounts via WebFinger (slower). Leave empty for the server default (no).",
+ "Limit results to accounts the connected account follows. Leave empty for no restriction.": "Limit results to accounts the connected account follows. Leave empty for no restriction.",
+ "Local ID of the account. Obtain it from Get My Account, Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).": "Local ID of the account. Obtain it from Get My Account, Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).",
+ "Only statuses using this hashtag, without the # sign, for example mastodon.": "Only statuses using this hashtag, without the # sign, for example mastodon.",
+ "Maximum number of statuses to return in this page. Defaults to 20, maximum 40.": "Maximum number of statuses to return in this page. Defaults to 20, maximum 40.",
+ "Local account IDs to check, one per item. Obtain them from Lookup Account, Search Accounts or Get Account.": "Local account IDs to check, one per item. Obtain them from Lookup Account, Search Accounts or Get Account.",
+ "Local ID of the account to follow. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).": "Local ID of the account to follow. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).",
+ "Whether their boosts appear in your home timeline. Leave empty for the default (yes).": "Whether their boosts appear in your home timeline. Leave empty for the default (yes).",
+ "Whether to get a notification for each of their posts. Leave empty for the default (no).": "Whether to get a notification for each of their posts. Leave empty for the default (no).",
+ "Only show their posts in these ISO 639-1 languages, one code per item (for example en). Leave empty for all languages.": "Only show their posts in these ISO 639-1 languages, one code per item (for example en). Leave empty for all languages.",
+ "Local ID of the account to mute. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).": "Local ID of the account to mute. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).",
+ "Also hide notifications from this account. Leave empty for the default (yes).": "Also hide notifications from this account. Leave empty for the default (yes).",
+ "How long the mute lasts, in seconds, for example 86400 for one day. Leave empty or 0 to mute indefinitely.": "How long the mute lasts, in seconds, for example 86400 for one day. Leave empty or 0 to mute indefinitely.",
+ "Local ID of the account that requested to follow you. Obtain it from List Follow Requests.": "Local ID of the account that requested to follow you. Obtain it from List Follow Requests.",
+ "Only statuses posted on this server.": "Only statuses posted on this server.",
+ "Only statuses from other servers.": "Only statuses from other servers.",
+ "Hashtag without the # sign, for example mastodon. A leading # is removed automatically.": "Hashtag without the # sign, for example mastodon. A leading # is removed automatically.",
+ "Also include statuses using any of these additional hashtags, one per item, without #.": "Also include statuses using any of these additional hashtags, one per item, without #.",
+ "Only statuses that also use all of these hashtags, one per item, without #.": "Only statuses that also use all of these hashtags, one per item, without #.",
+ "Exclude statuses using any of these hashtags, one per item, without #.": "Exclude statuses using any of these hashtags, one per item, without #.",
+ "ID of one of your lists. Obtain it from List Lists or Create List.": "ID of one of your lists. Obtain it from List Lists or Create List.",
+ "Only return these notification types. Leave empty for all types.": "Only return these notification types. Leave empty for all types.",
+ "Leave out these notification types.": "Leave out these notification types.",
+ "Only notifications caused by this account (local ID from Lookup Account or Search Accounts).": "Only notifications caused by this account (local ID from Lookup Account or Search Accounts).",
+ "Maximum number of notifications to return in this page. Defaults to 40, maximum 80.": "Maximum number of notifications to return in this page. Defaults to 40, maximum 80.",
+ "ID of the notification. Obtain it from List Notifications.": "ID of the notification. Obtain it from List Notifications.",
+ "Only count these notification types. Leave empty for all types.": "Only count these notification types. Leave empty for all types.",
+ "Do not count these notification types.": "Do not count these notification types.",
+ "Only count notifications caused by this account (local account ID).": "Only count notifications caused by this account (local account ID).",
+ "Stop counting at this number. Defaults to 100, maximum 1000.": "Stop counting at this number. Defaults to 100, maximum 1000.",
+ "Search text, a hashtag, a handle such as [email protected], or a status or profile URL such as https://mastodon.social/@Gargron/109372843234737004.": "Search text, a hashtag, a handle such as [email protected], or a status or profile URL such as https://mastodon.social/@Gargron/109372843234737004.",
+ "Only return one kind of result. Leave empty for all three.": "Only return one kind of result. Leave empty for all three.",
+ "Fetch unknown remote accounts or URLs from their server. Leave empty to resolve automatically when the query is a URL or user@domain handle.": "Fetch unknown remote accounts or URLs from their server. Leave empty to resolve automatically when the query is a URL or user@domain handle.",
+ "Only include accounts the connected account follows. Leave empty for no restriction.": "Only include accounts the connected account follows. Leave empty for no restriction.",
+ "Only return statuses authored by this account (local account ID).": "Only return statuses authored by this account (local account ID).",
+ "Leave out hashtags not yet reviewed by moderators. Leave empty for the default (no).": "Leave out hashtags not yet reviewed by moderators. Leave empty for the default (no).",
+ "Maximum number of results per type to return in this page. Defaults to 20, maximum 40.": "Maximum number of results per type to return in this page. Defaults to 20, maximum 40.",
+ "Number of results to skip, for paging. Only applies when Result Type is set.": "Number of results to skip, for paging. Only applies when Result Type is set.",
+ "Only return results with an ID lower than this.": "Only return results with an ID lower than this.",
+ "Only return results with an ID immediately higher than this.": "Only return results with an ID immediately higher than this.",
+ "Name of the list, for example News.": "Name of the list, for example News.",
+ "Which replies appear in the list timeline. Leave empty for the default (list members).": "Which replies appear in the list timeline. Leave empty for the default (list members).",
+ "Whether posts from list members are removed from the home timeline. Leave empty for the default (no).": "Whether posts from list members are removed from the home timeline. Leave empty for the default (no).",
+ "New name of the list. Leave empty to keep the current title.": "New name of the list. Leave empty to keep the current title.",
+ "Which replies appear in the list timeline. Leave empty to keep the current setting.": "Which replies appear in the list timeline. Leave empty to keep the current setting.",
+ "Whether posts from list members are removed from the home timeline. Leave empty to keep the current setting.": "Whether posts from list members are removed from the home timeline. Leave empty to keep the current setting.",
+ "Local IDs of followed accounts to add, one per item. Obtain them from List Account Following, Lookup Account or Search Accounts.": "Local IDs of followed accounts to add, one per item. Obtain them from List Account Following, Lookup Account or Search Accounts.",
+ "Local IDs of the accounts to remove, one per item. Obtain them from List Accounts in List.": "Local IDs of the accounts to remove, one per item. Obtain them from List Accounts in List.",
+ "ID of the poll (the poll.id field of a status). Obtain it from Get Status or a timeline.": "ID of the poll (the poll.id field of a status). Obtain it from Get Status or a timeline.",
+ "0-based index of each option to vote for, one per item; for example 0 for the first option.": "0-based index of each option to vote for, one per item; for example 0 for the first option.",
+ "Maximum number of conversations to return in this page. Defaults to 20, maximum 40.": "Maximum number of conversations to return in this page. Defaults to 20, maximum 40.",
+ "ID of the direct-message conversation. Obtain it from List Conversations.": "ID of the direct-message conversation. Obtain it from List Conversations.",
+ "Hashtag name without the # sign, for example mastodon. A leading # is removed automatically.": "Hashtag name without the # sign, for example mastodon. A leading # is removed automatically.",
+ "Maximum number of hashtags to return in this page. Defaults to 100, maximum 200.": "Maximum number of hashtags to return in this page. Defaults to 100, maximum 200.",
+ "ID of the filter. Obtain it from List Filters or Create Filter.": "ID of the filter. Obtain it from List Filters or Create Filter.",
+ "Name of the filter, for example Spoilers.": "Name of the filter, for example Spoilers.",
+ "Where the filter applies. Choose at least one.": "Where the filter applies. Choose at least one.",
+ "Words or phrases to filter, one per item.": "Words or phrases to filter, one per item.",
+ "Applies to every keyword above. Leave empty for the default (no, match inside words too).": "Applies to every keyword above. Leave empty for the default (no, match inside words too).",
+ "What happens to matching posts. Leave empty for the default (warn).": "What happens to matching posts. Leave empty for the default (warn).",
+ "Seconds from now until the filter expires, for example 86400 for one day. Leave empty to never expire.": "Seconds from now until the filter expires, for example 86400 for one day. Leave empty to never expire.",
+ "New name of the filter. Leave empty to keep the current title.": "New name of the filter. Leave empty to keep the current title.",
+ "Replaces where the filter applies. Leave empty to keep the current contexts.": "Replaces where the filter applies. Leave empty to keep the current contexts.",
+ "What happens to matching posts. Leave empty to keep the current action.": "What happens to matching posts. Leave empty to keep the current action.",
+ "New expiry, in seconds from now. Leave empty to keep the current expiry.": "New expiry, in seconds from now. Leave empty to keep the current expiry.",
+ "Maximum number of hashtags to return in this page. Defaults to 10, maximum 20.": "Maximum number of hashtags to return in this page. Defaults to 10, maximum 20.",
+ "Number of results to skip, for paging through the trend list. Defaults to 0.": "Number of results to skip, for paging through the trend list. Defaults to 0.",
+ "Maximum number of links to return in this page. Defaults to 10, maximum 20.": "Maximum number of links to return in this page. Defaults to 10, maximum 20.",
+ "Public": "Public",
+ "Unlisted (public, hidden from public timelines)": "Unlisted (public, hidden from public timelines)",
+ "Followers only": "Followers only",
+ "Direct (mentioned accounts only)": "Direct (mentioned accounts only)",
+ "Yes": "Yes",
+ "No": "No",
+ "Unlisted": "Unlisted",
+ "Mention": "Mention",
+ "New post from an account you enabled notifications for": "New post from an account you enabled notifications for",
+ "Boost": "Boost",
+ "Follow": "Follow",
+ "Follow request": "Follow request",
+ "Favourite": "Favourite",
+ "Poll ended": "Poll ended",
+ "Boosted post edited": "Boosted post edited",
+ "Quote": "Quote",
+ "Quoted post edited": "Quoted post edited",
+ "Relationships severed": "Relationships severed",
+ "Moderation warning": "Moderation warning",
+ "Admin: new sign-up": "Admin: new sign-up",
+ "Admin: new report": "Admin: new report",
+ "Accounts": "Accounts",
+ "Statuses": "Statuses",
+ "Hashtags": "Hashtags",
+ "Any followed user": "Any followed user",
+ "Members of the list": "Members of the list",
+ "No one": "No one",
+ "Home and lists": "Home and lists",
+ "Notifications": "Notifications",
+ "Public timelines": "Public timelines",
+ "Conversations (threads)": "Conversations (threads)",
+ "Profiles": "Profiles",
+ "Warn (hide behind a warning)": "Warn (hide behind a warning)",
+ "Hide completely": "Hide completely",
+ "Blur media (Mastodon 4.4+)": "Blur media (Mastodon 4.4+)",
+ "New content warning. Leave empty to keep the current one; an existing content warning cannot be removed here.": "New content warning. Leave empty to keep the current one; an existing content warning cannot be removed here.",
+ "Replaces the attached media with these IDs (from Upload Media or the current media_attachments). Leave empty to keep the current media; all media cannot be detached here.": "Replaces the attached media with these IDs (from Upload Media or the current media_attachments). Leave empty to keep the current media; all media cannot be detached here.",
+ "New display name shown on the profile. Leave empty to keep the current display name.": "New display name shown on the profile. Leave empty to keep the current display name.",
+ "New profile bio text. Leave empty to keep the current bio.": "New profile bio text. Leave empty to keep the current bio."
}
\ No newline at end of file
diff --git a/packages/pieces/community/mastodon/src/index.ts b/packages/pieces/community/mastodon/src/index.ts
index 8565bb7ba29..4e26d846d5e 100644
--- a/packages/pieces/community/mastodon/src/index.ts
+++ b/packages/pieces/community/mastodon/src/index.ts
@@ -6,6 +6,90 @@ import {
} from '@activepieces/pieces-framework';
import { PieceCategory } from '@activepieces/pieces-framework';
import { postStatus } from './lib/actions/post-status';
+import { createStatus } from './lib/actions/create-status';
+import { scheduleStatus } from './lib/actions/schedule-status';
+import { getStatus } from './lib/actions/get-status';
+import { editStatus } from './lib/actions/edit-status';
+import { deleteStatus } from './lib/actions/delete-status';
+import { getStatusContext } from './lib/actions/get-status-context';
+import { listStatusBoostedBy } from './lib/actions/list-status-boosted-by';
+import { listStatusFavouritedBy } from './lib/actions/list-status-favourited-by';
+import { favouriteStatus } from './lib/actions/favourite-status';
+import { unfavouriteStatus } from './lib/actions/unfavourite-status';
+import { boostStatus } from './lib/actions/boost-status';
+import { unboostStatus } from './lib/actions/unboost-status';
+import { bookmarkStatus } from './lib/actions/bookmark-status';
+import { unbookmarkStatus } from './lib/actions/unbookmark-status';
+import { muteConversation } from './lib/actions/mute-conversation';
+import { unmuteConversation } from './lib/actions/unmute-conversation';
+import { pinStatus } from './lib/actions/pin-status';
+import { unpinStatus } from './lib/actions/unpin-status';
+import { listScheduledStatuses } from './lib/actions/list-scheduled-statuses';
+import { getScheduledStatus } from './lib/actions/get-scheduled-status';
+import { rescheduleStatus } from './lib/actions/reschedule-status';
+import { cancelScheduledStatus } from './lib/actions/cancel-scheduled-status';
+import { uploadMedia } from './lib/actions/upload-media';
+import { getMedia } from './lib/actions/get-media';
+import { updateMedia } from './lib/actions/update-media';
+import { deleteMedia } from './lib/actions/delete-media';
+import { getMyAccount } from './lib/actions/get-my-account';
+import { updateMyProfile } from './lib/actions/update-my-profile';
+import { getAccount } from './lib/actions/get-account';
+import { lookupAccount } from './lib/actions/lookup-account';
+import { searchAccounts } from './lib/actions/search-accounts';
+import { listAccountStatuses } from './lib/actions/list-account-statuses';
+import { listAccountFollowers } from './lib/actions/list-account-followers';
+import { listAccountFollowing } from './lib/actions/list-account-following';
+import { getRelationships } from './lib/actions/get-relationships';
+import { followAccount } from './lib/actions/follow-account';
+import { unfollowAccount } from './lib/actions/unfollow-account';
+import { blockAccount } from './lib/actions/block-account';
+import { unblockAccount } from './lib/actions/unblock-account';
+import { muteAccount } from './lib/actions/mute-account';
+import { unmuteAccount } from './lib/actions/unmute-account';
+import { listBlockedAccounts } from './lib/actions/list-blocked-accounts';
+import { listMutedAccounts } from './lib/actions/list-muted-accounts';
+import { listFollowRequests } from './lib/actions/list-follow-requests';
+import { acceptFollowRequest } from './lib/actions/accept-follow-request';
+import { rejectFollowRequest } from './lib/actions/reject-follow-request';
+import { listBookmarks } from './lib/actions/list-bookmarks';
+import { listFavourites } from './lib/actions/list-favourites';
+import { getHomeTimeline } from './lib/actions/get-home-timeline';
+import { getPublicTimeline } from './lib/actions/get-public-timeline';
+import { getHashtagTimeline } from './lib/actions/get-hashtag-timeline';
+import { getListTimeline } from './lib/actions/get-list-timeline';
+import { listNotifications } from './lib/actions/list-notifications';
+import { getNotification } from './lib/actions/get-notification';
+import { dismissNotification } from './lib/actions/dismiss-notification';
+import { clearNotifications } from './lib/actions/clear-notifications';
+import { getUnreadNotificationCount } from './lib/actions/get-unread-notification-count';
+import { search } from './lib/actions/search';
+import { listLists } from './lib/actions/list-lists';
+import { getList } from './lib/actions/get-list';
+import { createList } from './lib/actions/create-list';
+import { updateList } from './lib/actions/update-list';
+import { deleteList } from './lib/actions/delete-list';
+import { listListAccounts } from './lib/actions/list-list-accounts';
+import { addAccountsToList } from './lib/actions/add-accounts-to-list';
+import { removeAccountsFromList } from './lib/actions/remove-accounts-from-list';
+import { getPoll } from './lib/actions/get-poll';
+import { voteInPoll } from './lib/actions/vote-in-poll';
+import { listConversations } from './lib/actions/list-conversations';
+import { markConversationRead } from './lib/actions/mark-conversation-read';
+import { deleteConversation } from './lib/actions/delete-conversation';
+import { getTag } from './lib/actions/get-tag';
+import { followTag } from './lib/actions/follow-tag';
+import { unfollowTag } from './lib/actions/unfollow-tag';
+import { listFollowedTags } from './lib/actions/list-followed-tags';
+import { listFilters } from './lib/actions/list-filters';
+import { getFilter } from './lib/actions/get-filter';
+import { createFilter } from './lib/actions/create-filter';
+import { updateFilter } from './lib/actions/update-filter';
+import { deleteFilter } from './lib/actions/delete-filter';
+import { getTrendingTags } from './lib/actions/get-trending-tags';
+import { getTrendingStatuses } from './lib/actions/get-trending-statuses';
+import { getTrendingLinks } from './lib/actions/get-trending-links';
+import { getInstanceInfo } from './lib/actions/get-instance-info';
const markdownDescription = `
**Base Url**: The base url of your Mastodon instance (e.g \`https://mastodon.social\`)
@@ -14,8 +98,11 @@ const markdownDescription = `
1. Go to your **Profile** -> **Preferences** -> **Development** -> **New Application**
2. Fill the Information
-3. Click on **Create Application**
-4. Copy access token from **Your access token**
+3. Under **Scopes**, tick **read** and **write** (the form pre-selects only \`profile\`)
+4. Click on **Create Application**
+5. Copy access token from **Your access token**
+
+If an existing connection fails with a missing-scope error, edit the application in Mastodon, tick **read** and **write**, save (this regenerates the token) and paste the new token here.
`;
export const mastodonAuth = PieceAuth.CustomAuth({
@@ -43,11 +130,95 @@ export const mastodon = createPiece({
logoUrl: 'https://cdn.activepieces.com/pieces/mastodon.png',
categories: [PieceCategory.COMMUNICATION],
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.87.0',
authors: ["denieler","kishanprmr","MoShizzle","khaledmashaly","abuaboud"],
auth: mastodonAuth,
actions: [
postStatus,
+ createStatus,
+ scheduleStatus,
+ getStatus,
+ editStatus,
+ deleteStatus,
+ getStatusContext,
+ listStatusBoostedBy,
+ listStatusFavouritedBy,
+ favouriteStatus,
+ unfavouriteStatus,
+ boostStatus,
+ unboostStatus,
+ bookmarkStatus,
+ unbookmarkStatus,
+ muteConversation,
+ unmuteConversation,
+ pinStatus,
+ unpinStatus,
+ listScheduledStatuses,
+ getScheduledStatus,
+ rescheduleStatus,
+ cancelScheduledStatus,
+ uploadMedia,
+ getMedia,
+ updateMedia,
+ deleteMedia,
+ getMyAccount,
+ updateMyProfile,
+ getAccount,
+ lookupAccount,
+ searchAccounts,
+ listAccountStatuses,
+ listAccountFollowers,
+ listAccountFollowing,
+ getRelationships,
+ followAccount,
+ unfollowAccount,
+ blockAccount,
+ unblockAccount,
+ muteAccount,
+ unmuteAccount,
+ listBlockedAccounts,
+ listMutedAccounts,
+ listFollowRequests,
+ acceptFollowRequest,
+ rejectFollowRequest,
+ listBookmarks,
+ listFavourites,
+ getHomeTimeline,
+ getPublicTimeline,
+ getHashtagTimeline,
+ getListTimeline,
+ listNotifications,
+ getNotification,
+ dismissNotification,
+ clearNotifications,
+ getUnreadNotificationCount,
+ search,
+ listLists,
+ getList,
+ createList,
+ updateList,
+ deleteList,
+ listListAccounts,
+ addAccountsToList,
+ removeAccountsFromList,
+ getPoll,
+ voteInPoll,
+ listConversations,
+ markConversationRead,
+ deleteConversation,
+ getTag,
+ followTag,
+ unfollowTag,
+ listFollowedTags,
+ listFilters,
+ getFilter,
+ createFilter,
+ updateFilter,
+ deleteFilter,
+ getTrendingTags,
+ getTrendingStatuses,
+ getTrendingLinks,
+ getInstanceInfo,
createCustomApiCallAction({
baseUrl: (auth) =>
auth?.props?.base_url.replace(/\/$/, '') + '/api/v1',
diff --git a/packages/pieces/community/mastodon/src/lib/actions/accept-follow-request.ts b/packages/pieces/community/mastodon/src/lib/actions/accept-follow-request.ts
new file mode 100644
index 00000000000..d3915584b5b
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/accept-follow-request.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const acceptFollowRequest = createAction({
+ auth: mastodonAuth,
+ name: 'accept_follow_request',
+ classification: 'WRITE',
+ displayName: 'Accept Follow Request',
+ description: 'Accept a pending follow request.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Accepts a pending follow request so the requesting account becomes a follower of the connected (locked) account. Get the account ID from List Follow Requests. Repeating the call fails with not found once the request is handled. Returns the updated relationship.',
+ idempotent: false,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account that requested to follow you. Obtain it from List Follow Requests.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/follow_requests/${encodeURIComponent(context.propsValue.account_id)}/authorize`,
+ operation: 'Accept Follow Request',
+ scope: 'write:follows',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/add-accounts-to-list.ts b/packages/pieces/community/mastodon/src/lib/actions/add-accounts-to-list.ts
new file mode 100644
index 00000000000..b5730fa4846
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/add-accounts-to-list.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient, mastodonUtils } from '../common/client';
+import { listAcknowledgementOutputSchema } from '../output-schemas';
+
+export const addAccountsToList = createAction({
+ auth: mastodonAuth,
+ name: 'add_accounts_to_list',
+ classification: 'WRITE',
+ displayName: 'Add Accounts to List',
+ description: 'Add accounts you follow to one of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Adds one or more accounts to one of the connected account\'s lists. The connected account must already follow each of them (use Follow Account first), otherwise Mastodon rejects the call. Adding an account that is already in the list may be rejected, so check List Accounts in List before retrying.',
+ idempotent: false,
+ },
+ outputSchema: listAcknowledgementOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description: 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ account_ids: Property.Array({
+ displayName: 'Account IDs',
+ description:
+ 'Local IDs of followed accounts to add, one per item. Obtain them from List Account Following, Lookup Account or Search Accounts.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { list_id } = context.propsValue;
+ const accountIds = mastodonUtils.toStringArray(context.propsValue.account_ids);
+ if (accountIds === undefined) {
+ throw new Error('Provide at least one Account ID.');
+ }
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/lists/${encodeURIComponent(list_id)}/accounts`,
+ operation: 'Add Accounts to List',
+ scope: 'write:lists',
+ body: { account_ids: accountIds },
+ });
+ return { success: true, list_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/block-account.ts b/packages/pieces/community/mastodon/src/lib/actions/block-account.ts
new file mode 100644
index 00000000000..5165052dc6c
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/block-account.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const blockAccount = createAction({
+ auth: mastodonAuth,
+ name: 'block_account',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Block Account',
+ description: 'Block an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Blocks an account: it can no longer see or interact with the connected account, and any follow in either direction is removed (re-following is needed after an unblock). Use Mute Account to hide someone without them noticing. Safe to retry. Returns the updated relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/block`,
+ operation: 'Block Account',
+ scope: 'write:blocks',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/bookmark-status.ts b/packages/pieces/community/mastodon/src/lib/actions/bookmark-status.ts
new file mode 100644
index 00000000000..9cd0bb16aea
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/bookmark-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const bookmarkStatus = createAction({
+ auth: mastodonAuth,
+ name: 'bookmark_status',
+ classification: 'WRITE',
+ displayName: 'Bookmark Status',
+ description: 'Privately bookmark a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Bookmarks a status privately for the connected account (the author is not notified); read bookmarks back with List Bookmarks. Use Favourite Status for a public like. Safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/bookmark`,
+ operation: 'Bookmark Status',
+ scope: 'write:bookmarks',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/boost-status.ts b/packages/pieces/community/mastodon/src/lib/actions/boost-status.ts
new file mode 100644
index 00000000000..3f05eea728e
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/boost-status.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonUtils } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const boostStatus = createAction({
+ auth: mastodonAuth,
+ name: 'boost_status',
+ classification: 'WRITE',
+ displayName: 'Boost Status',
+ description: 'Boost (reblog) a status to your followers.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Boosts (reblogs) a status so it appears to the connected account\'s followers and the author is notified. Visibility defaults to the account\'s default posting privacy, not public; set it explicitly to control reach. Boosting an already-boosted status returns the existing boost, so it is safe to retry. Use Unboost Status to undo.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status to boost. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ visibility: Property.StaticDropdown({
+ displayName: 'Visibility',
+ description:
+ 'Who sees the boost. Leave empty to use the account default posting privacy.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Public', value: 'public' },
+ { label: 'Unlisted', value: 'unlisted' },
+ { label: 'Followers only', value: 'private' },
+ ],
+ },
+ }),
+ },
+ async run(context) {
+ const { status_id, visibility } = context.propsValue;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(status_id)}/reblog`,
+ operation: 'Boost Status',
+ scope: 'write:statuses',
+ body: mastodonUtils.hasValue(visibility) ? { visibility } : {},
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/cancel-scheduled-status.ts b/packages/pieces/community/mastodon/src/lib/actions/cancel-scheduled-status.ts
new file mode 100644
index 00000000000..a9bb80f1965
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/cancel-scheduled-status.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { cancelledScheduledStatusOutputSchema } from '../output-schemas';
+
+export const cancelScheduledStatus = createAction({
+ auth: mastodonAuth,
+ name: 'cancel_scheduled_status',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Cancel Scheduled Status',
+ description: 'Cancel a scheduled status so it is never published.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Cancels and deletes a scheduled status so it is never published. Use Reschedule Status to move it instead. Irreversible; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: cancelledScheduledStatusOutputSchema,
+ props: {
+ scheduled_status_id: Property.ShortText({
+ displayName: 'Scheduled Status ID',
+ description:
+ 'ID of the scheduled status. Obtain it from Schedule Status or List Scheduled Statuses.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/scheduled_statuses/${encodeURIComponent(context.propsValue.scheduled_status_id)}`,
+ operation: 'Cancel Scheduled Status',
+ scope: 'write:statuses',
+ });
+ return { success: true, scheduled_status_id: context.propsValue.scheduled_status_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/clear-notifications.ts b/packages/pieces/community/mastodon/src/lib/actions/clear-notifications.ts
new file mode 100644
index 00000000000..d5131a3f128
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/clear-notifications.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { clearedNotificationsOutputSchema } from '../output-schemas';
+
+export const clearNotifications = createAction({
+ auth: mastodonAuth,
+ name: 'clear_notifications',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Clear All Notifications',
+ description: 'Remove all notifications of the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently removes ALL notifications of the connected account in one call; this cannot be undone. Prefer Dismiss Notification to remove a single one. Repeating it is harmless.',
+ idempotent: true,
+ },
+ outputSchema: clearedNotificationsOutputSchema,
+ props: {
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v1/notifications/clear',
+ operation: 'Clear All Notifications',
+ scope: 'write:notifications',
+ });
+ return { success: true };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/create-filter.ts b/packages/pieces/community/mastodon/src/lib/actions/create-filter.ts
new file mode 100644
index 00000000000..ee2755c91c1
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/create-filter.ts
@@ -0,0 +1,103 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+
+const CONTEXT_OPTIONS = [
+ { label: 'Home and lists', value: 'home' },
+ { label: 'Notifications', value: 'notifications' },
+ { label: 'Public timelines', value: 'public' },
+ { label: 'Conversations (threads)', value: 'thread' },
+ { label: 'Profiles', value: 'account' },
+];
+
+const FILTER_ACTION_OPTIONS = [
+ { label: 'Warn (hide behind a warning)', value: 'warn' },
+ { label: 'Hide completely', value: 'hide' },
+ { label: 'Blur media (Mastodon 4.4+)', value: 'blur' },
+];
+import { filterOutputSchema } from '../output-schemas';
+
+export const createFilter = createAction({
+ auth: mastodonAuth,
+ name: 'create_filter',
+ classification: 'WRITE',
+ displayName: 'Create Filter',
+ description: 'Create a content filter that hides or warns about matching posts.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a content filter for the connected account that warns about, hides or blurs posts matching the given keywords in the chosen contexts, optionally expiring after a duration. Each call creates a new filter; check List Filters first to avoid duplicates. Requires Mastodon 4.0 or later.',
+ idempotent: false,
+ },
+ outputSchema: filterOutputSchema,
+ props: {
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Name of the filter, for example Spoilers.',
+ required: true,
+ }),
+ context: Property.StaticMultiSelectDropdown({
+ displayName: 'Apply In',
+ description: 'Where the filter applies. Choose at least one.',
+ required: true,
+ options: { disabled: false, options: CONTEXT_OPTIONS },
+ }),
+ keywords: Property.Array({
+ displayName: 'Keywords',
+ description: 'Words or phrases to filter, one per item.',
+ required: false,
+ }),
+ whole_word: mastodonProps.optionalBoolean({
+ displayName: 'Match Whole Words Only',
+ description: 'Applies to every keyword above. Leave empty for the default (no, match inside words too).',
+ }),
+ filter_action: Property.StaticDropdown({
+ displayName: 'Action',
+ description: 'What happens to matching posts. Leave empty for the default (warn).',
+ required: false,
+ options: { disabled: false, options: FILTER_ACTION_OPTIONS },
+ }),
+ expires_in: Property.Number({
+ displayName: 'Expires In (seconds)',
+ description: 'Seconds from now until the filter expires, for example 86400 for one day. Leave empty to never expire.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ if (props.context.length === 0) {
+ throw new Error('Choose at least one context in Apply In.');
+ }
+ const keywords = mastodonUtils.toStringArray(props.keywords);
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v2/filters',
+ operation: 'Create Filter',
+ scope: 'write:filters',
+ minVersion: '4.0.0',
+ body: {
+ title: props.title,
+ context: props.context,
+ ...(mastodonUtils.hasValue(props.filter_action) ? { filter_action: props.filter_action } : {}),
+ ...(props.expires_in !== undefined && props.expires_in !== null
+ ? { expires_in: props.expires_in }
+ : {}),
+ ...(keywords !== undefined
+ ? {
+ keywords_attributes: keywords.map((keyword) => ({
+ keyword,
+ ...(props.whole_word !== undefined ? { whole_word: props.whole_word } : {}),
+ })),
+ }
+ : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/create-list.ts b/packages/pieces/community/mastodon/src/lib/actions/create-list.ts
new file mode 100644
index 00000000000..db3fa9a8693
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/create-list.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+
+const REPLIES_POLICY_OPTIONS = [
+ { label: 'Any followed user', value: 'followed' },
+ { label: 'Members of the list', value: 'list' },
+ { label: 'No one', value: 'none' },
+];
+import { listOutputSchema } from '../output-schemas';
+
+export const createList = createAction({
+ auth: mastodonAuth,
+ name: 'create_list',
+ classification: 'WRITE',
+ displayName: 'Create List',
+ description: 'Create a new list for grouping accounts you follow.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Creates a private list owned by the connected account, used to group followed accounts into a separate timeline. Add members with Add Accounts to List (they must already be followed). Each call creates a new list, even with the same title; check List Lists first to avoid duplicates.',
+ idempotent: false,
+ },
+ outputSchema: listOutputSchema,
+ props: {
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'Name of the list, for example News.',
+ required: true,
+ }),
+ replies_policy: Property.StaticDropdown({
+ displayName: 'Show Replies To',
+ description: 'Which replies appear in the list timeline. Leave empty for the default (list members).',
+ required: false,
+ options: { disabled: false, options: REPLIES_POLICY_OPTIONS },
+ }),
+ exclusive: mastodonProps.optionalBoolean({
+ displayName: 'Hide Members From Home Timeline',
+ description: 'Whether posts from list members are removed from the home timeline. Leave empty for the default (no).',
+ }),
+ },
+ async run(context) {
+ const { title, replies_policy, exclusive } = context.propsValue;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v1/lists',
+ operation: 'Create List',
+ scope: 'write:lists',
+ body: {
+ title,
+ ...(mastodonUtils.hasValue(replies_policy) ? { replies_policy } : {}),
+ ...(exclusive !== undefined ? { exclusive } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/create-status.ts b/packages/pieces/community/mastodon/src/lib/actions/create-status.ts
new file mode 100644
index 00000000000..eab8af22dc3
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/create-status.ts
@@ -0,0 +1,61 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const createStatus = createAction({
+ auth: mastodonAuth,
+ name: 'create_status',
+ classification: 'WRITE',
+ displayName: 'Create Status',
+ description: 'Publish a status (toot), reply, or poll from the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Publishes a new status from the connected account, with control over visibility, content warning, language, attached media (IDs from Upload Media) or a poll; replies are this action with In Reply To set. Use Schedule Status instead to publish later. Media and a poll cannot be combined. Each call creates a new post; an optional Idempotency Key makes Mastodon ignore a duplicate submitted within about an hour, but retries after that duplicate the post.',
+ idempotent: false,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ ...mastodonProps.compose(),
+ idempotency_key: Property.ShortText({
+ displayName: 'Idempotency Key',
+ description:
+ 'Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and returns the original post instead of creating a duplicate when the same key is sent again.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const body = mastodonUtils.buildComposeBody({
+ status: props.status,
+ visibility: props.visibility,
+ inReplyToId: props.in_reply_to_id,
+ spoilerText: props.spoiler_text,
+ sensitive: props.sensitive,
+ language: props.language,
+ mediaIds: mastodonUtils.toStringArray(props.media_ids),
+ pollOptions: mastodonUtils.toStringArray(props.poll_options),
+ pollExpiresIn: props.poll_expires_in,
+ pollMultiple: props.poll_multiple,
+ });
+ const idempotencyKey = props.idempotency_key;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v1/statuses',
+ operation: 'Create Status',
+ scope: 'write:statuses',
+ body,
+ headers: mastodonUtils.hasValue(idempotencyKey)
+ ? { 'Idempotency-Key': String(idempotencyKey) }
+ : undefined,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/delete-conversation.ts b/packages/pieces/community/mastodon/src/lib/actions/delete-conversation.ts
new file mode 100644
index 00000000000..0f408de2883
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/delete-conversation.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { removedConversationOutputSchema } from '../output-schemas';
+
+export const deleteConversation = createAction({
+ auth: mastodonAuth,
+ name: 'delete_conversation',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Remove Conversation',
+ description: 'Remove a direct-message conversation from your list.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes a direct-message conversation from the connected account\'s conversation list only; the statuses themselves are not deleted and other participants keep it. Repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: removedConversationOutputSchema,
+ props: {
+ conversation_id: Property.ShortText({
+ displayName: 'Conversation ID',
+ description:
+ 'ID of the direct-message conversation. Obtain it from List Conversations.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/conversations/${encodeURIComponent(context.propsValue.conversation_id)}`,
+ operation: 'Remove Conversation',
+ scope: 'write:conversations',
+ });
+ return { success: true, conversation_id: context.propsValue.conversation_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/delete-filter.ts b/packages/pieces/community/mastodon/src/lib/actions/delete-filter.ts
new file mode 100644
index 00000000000..6eee444d224
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/delete-filter.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { deletedFilterOutputSchema } from '../output-schemas';
+
+export const deleteFilter = createAction({
+ auth: mastodonAuth,
+ name: 'delete_filter',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Filter',
+ description: 'Delete one of your content filters.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes one of the connected account\'s content filters with all its keywords. Requires Mastodon 4.0 or later. Irreversible; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: deletedFilterOutputSchema,
+ props: {
+ filter_id: Property.ShortText({
+ displayName: 'Filter ID',
+ description:
+ 'ID of the filter. Obtain it from List Filters or Create Filter.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v2/filters/${encodeURIComponent(context.propsValue.filter_id)}`,
+ operation: 'Delete Filter',
+ scope: 'write:filters',
+ minVersion: '4.0.0',
+ });
+ return { success: true, filter_id: context.propsValue.filter_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/delete-list.ts b/packages/pieces/community/mastodon/src/lib/actions/delete-list.ts
new file mode 100644
index 00000000000..9e7c1561f49
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/delete-list.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { listAcknowledgementOutputSchema } from '../output-schemas';
+
+export const deleteList = createAction({
+ auth: mastodonAuth,
+ name: 'delete_list',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete List',
+ description: 'Delete one of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes one of the connected account\'s lists (the accounts in it are not affected). Irreversible; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: listAcknowledgementOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description:
+ 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/lists/${encodeURIComponent(context.propsValue.list_id)}`,
+ operation: 'Delete List',
+ scope: 'write:lists',
+ });
+ return { success: true, list_id: context.propsValue.list_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/delete-media.ts b/packages/pieces/community/mastodon/src/lib/actions/delete-media.ts
new file mode 100644
index 00000000000..f4fefc76d52
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/delete-media.ts
@@ -0,0 +1,41 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { deletedMediaOutputSchema } from '../output-schemas';
+
+export const deleteMedia = createAction({
+ auth: mastodonAuth,
+ name: 'delete_media',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Media',
+ description: 'Delete an uploaded media file that is not attached to a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Deletes an uploaded media attachment that has not been attached to a status yet (attached media is removed by deleting the status). Requires Mastodon 4.4 or later. Irreversible; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: deletedMediaOutputSchema,
+ props: {
+ media_id: Property.ShortText({
+ displayName: 'Media ID',
+ description:
+ 'ID of the media attachment. Obtain it from Upload Media.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/media/${encodeURIComponent(context.propsValue.media_id)}`,
+ operation: 'Delete Media',
+ scope: 'write:media',
+ minVersion: '4.4.0',
+ notFoundMessage:
+ 'Mastodon could not find this unattached media. Delete Media only works for media not yet attached to a status (and requires Mastodon 4.4 or later); attached media is removed together with its status.',
+ });
+ return { success: true, media_id: context.propsValue.media_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/delete-status.ts b/packages/pieces/community/mastodon/src/lib/actions/delete-status.ts
new file mode 100644
index 00000000000..278e126d71a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/delete-status.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { deletedStatusOutputSchema } from '../output-schemas';
+
+export const deleteStatus = createAction({
+ auth: mastodonAuth,
+ name: 'delete_status',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Delete Status',
+ description: 'Permanently delete one of your own statuses.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Permanently deletes a status posted by the connected account and returns the deleted status including its source text (useful to redraft). Followers and remote servers may already have received it, so deletion cannot recall copies. Only works on your own posts; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: deletedStatusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of your own status to delete. Obtain it from Create Status, Get Status or List Account Statuses.',
+ required: true,
+ }),
+ delete_media: Property.Checkbox({
+ displayName: 'Delete Media Immediately',
+ description:
+ 'Delete the attached media right away instead of keeping it for about 24 hours for reuse. Requires Mastodon 4.4 or later; older servers ignore it.',
+ required: false,
+ defaultValue: false,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}`,
+ operation: 'Delete Status',
+ scope: 'write:statuses',
+ query: context.propsValue.delete_media === true ? { delete_media: true } : undefined,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/dismiss-notification.ts b/packages/pieces/community/mastodon/src/lib/actions/dismiss-notification.ts
new file mode 100644
index 00000000000..ce6e8ff0258
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/dismiss-notification.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { dismissedNotificationOutputSchema } from '../output-schemas';
+
+export const dismissNotification = createAction({
+ auth: mastodonAuth,
+ name: 'dismiss_notification',
+ classification: 'DESTRUCTIVE',
+ displayName: 'Dismiss Notification',
+ description: 'Dismiss a single notification.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Dismisses (removes) one notification of the connected account. Use Clear Notifications to remove all of them. Irreversible; repeating the call fails with not found.',
+ idempotent: false,
+ },
+ outputSchema: dismissedNotificationOutputSchema,
+ props: {
+ notification_id: Property.ShortText({
+ displayName: 'Notification ID',
+ description:
+ 'ID of the notification. Obtain it from List Notifications.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/notifications/${encodeURIComponent(context.propsValue.notification_id)}/dismiss`,
+ operation: 'Dismiss Notification',
+ scope: 'write:notifications',
+ });
+ return { success: true, notification_id: context.propsValue.notification_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/edit-status.ts b/packages/pieces/community/mastodon/src/lib/actions/edit-status.ts
new file mode 100644
index 00000000000..a58a04f3646
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/edit-status.ts
@@ -0,0 +1,227 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonConnection,
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+
+const POLL_MIN_REMAINING_MS = (5 * 60 + 60) * 1000;
+import { statusOutputSchema } from '../output-schemas';
+
+export const editStatus = createAction({
+ auth: mastodonAuth,
+ name: 'edit_status',
+ classification: 'WRITE',
+ displayName: 'Edit Status',
+ description: 'Edit the text, content warning, media or poll of one of your statuses.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Edits a status posted by the connected account; only the fields you set change, everything else (text, content warning, sensitivity, media, poll) is carried over from the current post. An existing poll keeps its votes when you leave the poll fields empty, but its hidden-totals setting is reset to visible, and the edit is refused if the poll has ended or closes in under 5 minutes. Setting Poll Options or Allow Multiple Choices to different values resets all votes. Media IDs replace the attached media set. It cannot remove an existing content warning or detach all media; to do that, delete the status and create it again.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of your own status to edit. Obtain it from Create Status, Get Status or List Account Statuses.',
+ required: true,
+ }),
+ status: Property.LongText({
+ displayName: 'Status Text',
+ description: 'New text of the post. Leave empty to keep the current text.',
+ required: false,
+ }),
+ spoiler_text: Property.ShortText({
+ displayName: 'Content Warning',
+ description: 'New content warning. Leave empty to keep the current one; an existing content warning cannot be removed here.',
+ required: false,
+ }),
+ sensitive: mastodonProps.optionalBoolean({
+ displayName: 'Mark Media as Sensitive',
+ description: 'Leave empty to keep the current setting.',
+ }),
+ language: Property.ShortText({
+ displayName: 'Language',
+ description:
+ 'New ISO 639-1 language code, for example en. Leave empty to keep the current language.',
+ required: false,
+ }),
+ media_ids: Property.Array({
+ displayName: 'Media IDs',
+ description:
+ 'Replaces the attached media with these IDs (from Upload Media or the current media_attachments). Leave empty to keep the current media; all media cannot be detached here.',
+ required: false,
+ }),
+ poll_options: Property.Array({
+ displayName: 'Poll Options',
+ description:
+ 'New poll choices, one per item. Changing them resets all votes. Leave empty to keep the current poll.',
+ required: false,
+ }),
+ poll_expires_in: Property.Number({
+ displayName: 'Poll Duration (seconds)',
+ description:
+ 'New poll duration from now, in seconds (300 to 2629746). Leave empty to keep the current closing time.',
+ required: false,
+ }),
+ poll_multiple: mastodonProps.optionalBoolean({
+ displayName: 'Allow Multiple Choices',
+ description: 'Changing this resets all votes. Leave empty to keep the current setting.',
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const auth = context.auth.props;
+ const statusPath = `/api/v1/statuses/${encodeURIComponent(props.status_id)}`;
+
+ const source = await mastodonClient.request<StatusSource>({
+ auth,
+ method: HttpMethod.GET,
+ path: `${statusPath}/source`,
+ operation: 'Edit Status (read current source)',
+ scope: 'read:statuses',
+ });
+ const current = await mastodonClient.request<StatusForEdit>({
+ auth,
+ method: HttpMethod.GET,
+ path: statusPath,
+ operation: 'Edit Status (read current status)',
+ scope: 'read:statuses',
+ });
+
+ const callerMediaIds = mastodonUtils.toStringArray(props.media_ids);
+ const mediaIds =
+ callerMediaIds ?? (current.media_attachments ?? []).map((attachment) => attachment.id);
+ const poll = resolvePoll({
+ current: current.poll,
+ options: mastodonUtils.toStringArray(props.poll_options),
+ expiresIn: props.poll_expires_in,
+ multiple: props.poll_multiple,
+ });
+ if (poll !== undefined && mediaIds.length > 0) {
+ throw new Error(
+ 'A status cannot have both media and a poll. Remove the Media IDs or the poll fields.'
+ );
+ }
+
+ const body = {
+ status: mastodonUtils.hasValue(props.status) ? props.status : source.text,
+ spoiler_text: mastodonUtils.hasValue(props.spoiler_text)
+ ? props.spoiler_text
+ : source.spoiler_text,
+ sensitive: props.sensitive ?? current.sensitive,
+ media_ids: mediaIds,
+ ...(mastodonUtils.hasValue(props.language) ? { language: props.language } : {}),
+ ...(poll !== undefined ? { poll } : {}),
+ };
+
+ return sendEdit({ auth, statusPath, body });
+ },
+});
+
+function resolvePoll({
+ current,
+ options,
+ expiresIn,
+ multiple,
+}: {
+ current: CurrentPoll | null | undefined;
+ options: string[] | undefined;
+ expiresIn: number | null | undefined;
+ multiple: boolean | undefined;
+}): PollPayload | undefined {
+ const callerExpiresIn = expiresIn === null ? undefined : expiresIn;
+ const callerSetPoll =
+ options !== undefined || callerExpiresIn !== undefined || multiple !== undefined;
+ const hasCurrentPoll = current !== undefined && current !== null;
+
+ if (!callerSetPoll) {
+ if (!hasCurrentPoll) {
+ return undefined;
+ }
+ return {
+ options: current.options.map((option) => option.title),
+ expires_in: remainingPollSeconds({ poll: current }),
+ multiple: current.multiple,
+ };
+ }
+
+ const resolvedOptions =
+ options ?? (hasCurrentPoll ? current.options.map((option) => option.title) : undefined);
+ if (resolvedOptions === undefined) {
+ throw new Error(
+ 'This status has no poll. Provide Poll Options and Poll Duration to add one.'
+ );
+ }
+ const resolvedExpiresIn =
+ callerExpiresIn ??
+ (hasCurrentPoll ? remainingPollSeconds({ poll: current }) : undefined);
+ if (resolvedExpiresIn === undefined) {
+ throw new Error('Poll Duration (seconds) is required when adding a poll.');
+ }
+ return {
+ options: resolvedOptions,
+ expires_in: resolvedExpiresIn,
+ multiple: multiple ?? (hasCurrentPoll ? current.multiple : false),
+ };
+}
+
+function remainingPollSeconds({ poll }: { poll: CurrentPoll }): number {
+ const expiresAt = poll.expires_at === null ? Number.NaN : new Date(poll.expires_at).getTime();
+ const remainingMs = expiresAt - Date.now();
+ if (poll.expired || Number.isNaN(expiresAt) || remainingMs < POLL_MIN_REMAINING_MS) {
+ throw new Error(
+ 'This status has a poll that has ended or closes in under 5 minutes. Mastodon re-validates the poll on every edit (5 minutes to 1 month), so the edit would fail or delete the poll. Nothing was changed.'
+ );
+ }
+ return Math.floor(remainingMs / 1000);
+}
+
+async function sendEdit({
+ auth,
+ statusPath,
+ body,
+}: {
+ auth: MastodonConnection;
+ statusPath: string;
+ body: Record<string, unknown>;
+}): Promise<MastodonEntity> {
+ return mastodonClient.request<MastodonEntity>({
+ auth,
+ method: HttpMethod.PUT,
+ path: statusPath,
+ operation: 'Edit Status',
+ scope: 'write:statuses',
+ body,
+ });
+}
+
+type StatusSource = {
+ text: string;
+ spoiler_text: string;
+};
+
+type CurrentPoll = {
+ expires_at: string | null;
+ expired: boolean;
+ multiple: boolean;
+ options: { title: string }[];
+};
+
+type StatusForEdit = {
+ sensitive: boolean;
+ media_attachments?: { id: string }[];
+ poll?: CurrentPoll | null;
+};
+
+type PollPayload = {
+ options: string[];
+ expires_in: number;
+ multiple: boolean;
+};
diff --git a/packages/pieces/community/mastodon/src/lib/actions/favourite-status.ts b/packages/pieces/community/mastodon/src/lib/actions/favourite-status.ts
new file mode 100644
index 00000000000..69dc278c455
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/favourite-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const favouriteStatus = createAction({
+ auth: mastodonAuth,
+ name: 'favourite_status',
+ classification: 'WRITE',
+ displayName: 'Favourite Status',
+ description: 'Add a status to your favourites.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Favourites (likes) a status as the connected account; the author is notified. Use Bookmark Status to save privately instead. Favouriting an already-favourited status changes nothing, so it is safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/favourite`,
+ operation: 'Favourite Status',
+ scope: 'write:favourites',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/follow-account.ts b/packages/pieces/community/mastodon/src/lib/actions/follow-account.ts
new file mode 100644
index 00000000000..f9abeb091e3
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/follow-account.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const followAccount = createAction({
+ auth: mastodonAuth,
+ name: 'follow_account',
+ classification: 'WRITE',
+ displayName: 'Follow Account',
+ description: 'Follow an account, or send a follow request to a locked account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Follows an account as the connected account (for a locked account this sends a follow request); the target is notified. Calling it again on an account you already follow does not error and just updates the boost, notification and language options. Returns the relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account to follow. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ reblogs: mastodonProps.optionalBoolean({
+ displayName: 'Show Their Boosts',
+ description: 'Whether their boosts appear in your home timeline. Leave empty for the default (yes).',
+ }),
+ notify: mastodonProps.optionalBoolean({
+ displayName: 'Notify When They Post',
+ description: 'Whether to get a notification for each of their posts. Leave empty for the default (no).',
+ }),
+ languages: Property.Array({
+ displayName: 'Languages',
+ description:
+ 'Only show their posts in these ISO 639-1 languages, one code per item (for example en). Leave empty for all languages.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { account_id, reblogs, notify, languages } = context.propsValue;
+ const languageCodes = mastodonUtils.toStringArray(languages);
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(account_id)}/follow`,
+ operation: 'Follow Account',
+ scope: 'write:follows',
+ body: {
+ ...(reblogs !== undefined ? { reblogs } : {}),
+ ...(notify !== undefined ? { notify } : {}),
+ ...(languageCodes !== undefined ? { languages: languageCodes } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/follow-tag.ts b/packages/pieces/community/mastodon/src/lib/actions/follow-tag.ts
new file mode 100644
index 00000000000..281bddc4e4f
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/follow-tag.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { tagOutputSchema } from '../output-schemas';
+
+export const followTag = createAction({
+ auth: mastodonAuth,
+ name: 'follow_tag',
+ classification: 'WRITE',
+ displayName: 'Follow Hashtag',
+ description: 'Follow a hashtag so its posts appear in your home timeline.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Follows a hashtag so posts using it appear in the connected account\'s home timeline. Requires Mastodon 4.0 or later; repeating it is harmless on 4.1 and later. Returns the hashtag.',
+ idempotent: true,
+ },
+ outputSchema: tagOutputSchema,
+ props: {
+ tag_name: Property.ShortText({
+ displayName: 'Hashtag',
+ description:
+ 'Hashtag name without the # sign, for example mastodon. A leading # is removed automatically.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/tags/${encodeURIComponent(context.propsValue.tag_name.replace(/^#/, ''))}/follow`,
+ operation: 'Follow Hashtag',
+ scope: 'write:follows',
+ minVersion: '4.0.0',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-account.ts b/packages/pieces/community/mastodon/src/lib/actions/get-account.ts
new file mode 100644
index 00000000000..60a24f6cc4e
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-account.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { accountOutputSchema } from '../output-schemas';
+
+export const getAccount = createAction({
+ auth: mastodonAuth,
+ name: 'get_account',
+ classification: 'READ',
+ displayName: 'Get Account',
+ description: 'Get a Mastodon account profile by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches an account profile by its local ID. If you only have a handle, use Lookup Account (known accounts) or Search with resolve (remote accounts) to get the ID first. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}`,
+ operation: 'Get Account',
+ scope: 'read:accounts',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-filter.ts b/packages/pieces/community/mastodon/src/lib/actions/get-filter.ts
new file mode 100644
index 00000000000..18d29c697bf
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-filter.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { filterOutputSchema } from '../output-schemas';
+
+export const getFilter = createAction({
+ auth: mastodonAuth,
+ name: 'get_filter',
+ classification: 'READ',
+ displayName: 'Get Filter',
+ description: 'Get one of your content filters by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches one of the connected account\'s content filters by ID, with its keywords, contexts and action. Use List Filters to find IDs. Requires Mastodon 4.0 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: filterOutputSchema,
+ props: {
+ filter_id: Property.ShortText({
+ displayName: 'Filter ID',
+ description:
+ 'ID of the filter. Obtain it from List Filters or Create Filter.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v2/filters/${encodeURIComponent(context.propsValue.filter_id)}`,
+ operation: 'Get Filter',
+ scope: 'read:filters',
+ minVersion: '4.0.0',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-hashtag-timeline.ts b/packages/pieces/community/mastodon/src/lib/actions/get-hashtag-timeline.ts
new file mode 100644
index 00000000000..b2a80a34909
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-hashtag-timeline.ts
@@ -0,0 +1,94 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const getHashtagTimeline = createAction({
+ auth: mastodonAuth,
+ name: 'get_hashtag_timeline',
+ classification: 'SEARCH',
+ displayName: 'Get Hashtag Timeline',
+ description: 'Get recent public statuses that use a hashtag.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of recent public statuses using a hashtag, newest first, with cursors for further pages; combine extra tags with any, all or none. Use Search for free-text queries. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ hashtag: Property.ShortText({
+ displayName: 'Hashtag',
+ description: 'Hashtag without the # sign, for example mastodon. A leading # is removed automatically.',
+ required: true,
+ }),
+ any: Property.Array({
+ displayName: 'Any of These Tags',
+ description: 'Also include statuses using any of these additional hashtags, one per item, without #.',
+ required: false,
+ }),
+ all: Property.Array({
+ displayName: 'All of These Tags',
+ description: 'Only statuses that also use all of these hashtags, one per item, without #.',
+ required: false,
+ }),
+ none: Property.Array({
+ displayName: 'None of These Tags',
+ description: 'Exclude statuses using any of these hashtags, one per item, without #.',
+ required: false,
+ }),
+ local: Property.Checkbox({
+ displayName: 'Only Local Statuses',
+ required: false,
+ defaultValue: false,
+ }),
+ remote: Property.Checkbox({
+ displayName: 'Only Remote Statuses',
+ required: false,
+ defaultValue: false,
+ }),
+ only_media: Property.Checkbox({
+ displayName: 'Only Statuses With Media',
+ required: false,
+ defaultValue: false,
+ }),
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const hashtag = props.hashtag.trim().replace(/^#/, '');
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/timelines/tag/${encodeURIComponent(hashtag)}`,
+ operation: 'Get Hashtag Timeline',
+ scope: 'read:statuses',
+ query: {
+ any: stripHashes({ tags: mastodonUtils.toStringArray(props.any) }),
+ all: stripHashes({ tags: mastodonUtils.toStringArray(props.all) }),
+ none: stripHashes({ tags: mastodonUtils.toStringArray(props.none) }),
+ local: props.local === true ? true : undefined,
+ remote: props.remote === true ? true : undefined,
+ only_media: props.only_media === true ? true : undefined,
+ limit: props.limit,
+ max_id: props.max_id,
+ since_id: props.since_id,
+ min_id: props.min_id,
+ },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
+
+function stripHashes({ tags }: { tags: string[] | undefined }): string[] | undefined {
+ return tags?.map((tag) => tag.replace(/^#/, ''));
+}
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-home-timeline.ts b/packages/pieces/community/mastodon/src/lib/actions/get-home-timeline.ts
new file mode 100644
index 00000000000..56ee2dc7b88
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-home-timeline.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const getHomeTimeline = createAction({
+ auth: mastodonAuth,
+ name: 'get_home_timeline',
+ classification: 'SEARCH',
+ displayName: 'Get Home Timeline',
+ description: 'Get statuses from accounts and hashtags you follow.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of the connected account\'s home timeline (posts and boosts from followed accounts and hashtags), newest first, with cursors for older or newer pages. Use Get Public Timeline for posts from everyone. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/timelines/home',
+ operation: 'Get Home Timeline',
+ scope: 'read:statuses',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-instance-info.ts b/packages/pieces/community/mastodon/src/lib/actions/get-instance-info.ts
new file mode 100644
index 00000000000..480d44ee2d1
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-instance-info.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { instanceOutputSchema } from '../output-schemas';
+
+export const getInstanceInfo = createAction({
+ auth: mastodonAuth,
+ name: 'get_instance_info',
+ classification: 'READ',
+ displayName: 'Get Instance Info',
+ description: 'Get information about the connected Mastodon server.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns information about the connected Mastodon server: version, API versions, character limit, media and poll limits, registration and contact details. Use it to check limits before posting or to see whether a newer endpoint is supported. Requires Mastodon 4.0 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: instanceOutputSchema,
+ props: {
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v2/instance',
+ operation: 'Get Instance Info',
+ minVersion: '4.0.0',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-list-timeline.ts b/packages/pieces/community/mastodon/src/lib/actions/get-list-timeline.ts
new file mode 100644
index 00000000000..1f41c54108a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-list-timeline.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const getListTimeline = createAction({
+ auth: mastodonAuth,
+ name: 'get_list_timeline',
+ classification: 'SEARCH',
+ displayName: 'Get List Timeline',
+ description: 'Get statuses from the members of one of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of statuses from the members of one of the connected account\'s lists, newest first, with cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description:
+ 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/timelines/list/${encodeURIComponent(context.propsValue.list_id)}`,
+ operation: 'Get List Timeline',
+ scope: 'read:lists',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-list.ts b/packages/pieces/community/mastodon/src/lib/actions/get-list.ts
new file mode 100644
index 00000000000..fcbb5eacc04
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-list.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { listOutputSchema } from '../output-schemas';
+
+export const getList = createAction({
+ auth: mastodonAuth,
+ name: 'get_list',
+ classification: 'READ',
+ displayName: 'Get List',
+ description: 'Get one of your lists by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches one of the connected account\'s lists by ID (title, replies policy, exclusive flag). Use List Lists to find IDs and List Accounts in List for its members. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: listOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description:
+ 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/lists/${encodeURIComponent(context.propsValue.list_id)}`,
+ operation: 'Get List',
+ scope: 'read:lists',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-media.ts b/packages/pieces/community/mastodon/src/lib/actions/get-media.ts
new file mode 100644
index 00000000000..5eacfb37590
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-media.ts
@@ -0,0 +1,55 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient } from '../common/client';
+import { mappedMediaOutputSchema } from '../output-schemas';
+
+export const getMedia = createAction({
+ auth: mastodonAuth,
+ name: 'get_media',
+ classification: 'READ',
+ displayName: 'Get Media',
+ description: 'Check an uploaded media file, including whether it has finished processing.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Reads an uploaded media attachment to check whether processing has finished (processing false and url non-null); poll it after Upload Media before attaching large video or audio. Only works for media not yet attached to a status; to read attached media use Get Status (media_attachments). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: mappedMediaOutputSchema,
+ props: {
+ media_id: Property.ShortText({
+ displayName: 'Media ID',
+ description: 'ID of the unattached media. Obtain it from Upload Media.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const response = await mastodonClient.sendRequest<MediaAttachment>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/media/${encodeURIComponent(context.propsValue.media_id)}`,
+ operation: 'Get Media',
+ scope: 'write:media',
+ notFoundMessage:
+ 'Mastodon could not find this media. Get Media only works for media not yet attached to a status; to read attached media use Get Status (media_attachments).',
+ });
+ const media = response.body;
+ return {
+ id: media.id,
+ type: media.type,
+ url: media.url ?? null,
+ preview_url: media.preview_url ?? null,
+ description: media.description ?? null,
+ processing: response.status === 206,
+ };
+ },
+});
+
+type MediaAttachment = {
+ id: string;
+ type: string;
+ url: string | null;
+ preview_url: string | null;
+ description: string | null;
+};
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-my-account.ts b/packages/pieces/community/mastodon/src/lib/actions/get-my-account.ts
new file mode 100644
index 00000000000..e3e318cc40a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-my-account.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { myAccountOutputSchema } from '../output-schemas';
+
+export const getMyAccount = createAction({
+ auth: mastodonAuth,
+ name: 'get_my_account',
+ classification: 'READ',
+ displayName: 'Get My Account',
+ description: 'Get the profile of the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the connected account\'s own profile, including its ID, username, counts and default posting settings. Call it first to learn the account ID for actions like List Account Statuses. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: myAccountOutputSchema,
+ props: {
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/accounts/verify_credentials',
+ operation: 'Get My Account',
+ scope: 'profile or read:accounts',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-notification.ts b/packages/pieces/community/mastodon/src/lib/actions/get-notification.ts
new file mode 100644
index 00000000000..f5bd40b9d54
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-notification.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { notificationOutputSchema } from '../output-schemas';
+
+export const getNotification = createAction({
+ auth: mastodonAuth,
+ name: 'get_notification',
+ classification: 'READ',
+ displayName: 'Get Notification',
+ description: 'Get a single notification by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches one notification of the connected account by ID, including its type, the account that triggered it and the related status. Use List Notifications to find IDs. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: notificationOutputSchema,
+ props: {
+ notification_id: Property.ShortText({
+ displayName: 'Notification ID',
+ description:
+ 'ID of the notification. Obtain it from List Notifications.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/notifications/${encodeURIComponent(context.propsValue.notification_id)}`,
+ operation: 'Get Notification',
+ scope: 'read:notifications',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-poll.ts b/packages/pieces/community/mastodon/src/lib/actions/get-poll.ts
new file mode 100644
index 00000000000..64127a1a6b0
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-poll.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { pollOutputSchema } from '../output-schemas';
+
+export const getPoll = createAction({
+ auth: mastodonAuth,
+ name: 'get_poll',
+ classification: 'READ',
+ displayName: 'Get Poll',
+ description: 'Get a poll with its current results.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a poll by ID with its options, vote counts, expiry and whether the connected account has voted. Use Vote in Poll to vote. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: pollOutputSchema,
+ props: {
+ poll_id: Property.ShortText({
+ displayName: 'Poll ID',
+ description:
+ 'ID of the poll (the poll.id field of a status). Obtain it from Get Status or a timeline.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/polls/${encodeURIComponent(context.propsValue.poll_id)}`,
+ operation: 'Get Poll',
+ scope: 'read:statuses',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-public-timeline.ts b/packages/pieces/community/mastodon/src/lib/actions/get-public-timeline.ts
new file mode 100644
index 00000000000..25248f973c8
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-public-timeline.ts
@@ -0,0 +1,63 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const getPublicTimeline = createAction({
+ auth: mastodonAuth,
+ name: 'get_public_timeline',
+ classification: 'SEARCH',
+ displayName: 'Get Public Timeline',
+ description: 'Get recent public statuses known to the server.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of recent public statuses known to the connected server (optionally only local or only remote, or only with media), newest first, with cursors for further pages. Use Get Hashtag Timeline for a topic or Get Home Timeline for followed accounts. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ local: Property.Checkbox({
+ displayName: 'Only Local Statuses',
+ description: 'Only statuses posted on this server.',
+ required: false,
+ defaultValue: false,
+ }),
+ remote: Property.Checkbox({
+ displayName: 'Only Remote Statuses',
+ description: 'Only statuses from other servers.',
+ required: false,
+ defaultValue: false,
+ }),
+ only_media: Property.Checkbox({
+ displayName: 'Only Statuses With Media',
+ required: false,
+ defaultValue: false,
+ }),
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/timelines/public',
+ operation: 'Get Public Timeline',
+ scope: 'read:statuses',
+ query: {
+ local: props.local === true ? true : undefined,
+ remote: props.remote === true ? true : undefined,
+ only_media: props.only_media === true ? true : undefined,
+ limit: props.limit,
+ max_id: props.max_id,
+ since_id: props.since_id,
+ min_id: props.min_id,
+ },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-relationships.ts b/packages/pieces/community/mastodon/src/lib/actions/get-relationships.ts
new file mode 100644
index 00000000000..3aba75a0dee
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-relationships.ts
@@ -0,0 +1,43 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonUtils } from '../common/client';
+import { relationshipsOutputSchema } from '../output-schemas';
+
+export const getRelationships = createAction({
+ auth: mastodonAuth,
+ name: 'get_relationships',
+ classification: 'READ',
+ displayName: 'Get Relationships',
+ description: 'Check how the connected account relates to other accounts.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the connected account\'s relationship with each given account: following, followed by, requested, blocking, muting and more. Use it to check state before Follow Account, Block Account or Mute Account. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: relationshipsOutputSchema,
+ props: {
+ account_ids: Property.Array({
+ displayName: 'Account IDs',
+ description:
+ 'Local account IDs to check, one per item. Obtain them from Lookup Account, Search Accounts or Get Account.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const accountIds = mastodonUtils.toStringArray(context.propsValue.account_ids);
+ if (accountIds === undefined) {
+ throw new Error('Provide at least one Account ID.');
+ }
+ const relationships = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/accounts/relationships',
+ operation: 'Get Relationships',
+ scope: 'read:follows',
+ query: { id: accountIds },
+ });
+ return { relationships, count: relationships.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-scheduled-status.ts b/packages/pieces/community/mastodon/src/lib/actions/get-scheduled-status.ts
new file mode 100644
index 00000000000..b4d9ef19c09
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-scheduled-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { scheduledStatusOutputSchema } from '../output-schemas';
+
+export const getScheduledStatus = createAction({
+ auth: mastodonAuth,
+ name: 'get_scheduled_status',
+ classification: 'READ',
+ displayName: 'Get Scheduled Status',
+ description: 'Get a scheduled status by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches one scheduled (not yet published) status by ID, including its scheduled time and parameters. Use List Scheduled Statuses to find IDs. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: scheduledStatusOutputSchema,
+ props: {
+ scheduled_status_id: Property.ShortText({
+ displayName: 'Scheduled Status ID',
+ description:
+ 'ID of the scheduled status. Obtain it from Schedule Status or List Scheduled Statuses.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/scheduled_statuses/${encodeURIComponent(context.propsValue.scheduled_status_id)}`,
+ operation: 'Get Scheduled Status',
+ scope: 'read:statuses',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-status-context.ts b/packages/pieces/community/mastodon/src/lib/actions/get-status-context.ts
new file mode 100644
index 00000000000..e958bf08842
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-status-context.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusContextOutputSchema } from '../output-schemas';
+
+export const getStatusContext = createAction({
+ auth: mastodonAuth,
+ name: 'get_status_context',
+ classification: 'READ',
+ displayName: 'Get Status Thread',
+ description: 'Get the ancestors and replies of a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns the conversation thread around a status: its ancestors (the posts it replies to) and descendants (replies). Use it to read a whole discussion before replying; use Get Status for just the one post. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusContextOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status whose thread to read. Obtain it from a timeline, Get Status or Search.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/context`,
+ operation: 'Get Status Thread',
+ scope: 'read:statuses',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-status.ts b/packages/pieces/community/mastodon/src/lib/actions/get-status.ts
new file mode 100644
index 00000000000..3527030add2
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const getStatus = createAction({
+ auth: mastodonAuth,
+ name: 'get_status',
+ classification: 'READ',
+ displayName: 'Get Status',
+ description: 'Get a single status by its ID.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches one status by its local ID, including text, author, counts, media attachments and poll. Use it to read a post before replying, editing or engaging with it; for a status URL from another server, first import it with Search (resolve) to get a local ID. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Create Status or Search.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}`,
+ operation: 'Get Status',
+ scope: 'read:statuses',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-tag.ts b/packages/pieces/community/mastodon/src/lib/actions/get-tag.ts
new file mode 100644
index 00000000000..c8d473cfb21
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-tag.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { tagOutputSchema } from '../output-schemas';
+
+export const getTag = createAction({
+ auth: mastodonAuth,
+ name: 'get_tag',
+ classification: 'READ',
+ displayName: 'Get Hashtag',
+ description: 'Get information about a hashtag.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Fetches a hashtag with its recent usage history and whether the connected account follows it. Use Get Hashtag Timeline for posts using it. Requires Mastodon 4.0 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: tagOutputSchema,
+ props: {
+ tag_name: Property.ShortText({
+ displayName: 'Hashtag',
+ description:
+ 'Hashtag name without the # sign, for example mastodon. A leading # is removed automatically.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/tags/${encodeURIComponent(context.propsValue.tag_name.replace(/^#/, ''))}`,
+ operation: 'Get Hashtag',
+ minVersion: '4.0.0',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-trending-links.ts b/packages/pieces/community/mastodon/src/lib/actions/get-trending-links.ts
new file mode 100644
index 00000000000..731aec9f608
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-trending-links.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { trendingLinksOutputSchema } from '../output-schemas';
+
+export const getTrendingLinks = createAction({
+ auth: mastodonAuth,
+ name: 'get_trending_links',
+ classification: 'SEARCH',
+ displayName: 'Get Trending Links',
+ description: 'Get news links that are trending on the server.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns links (news articles and pages) currently shared the most on the connected server, with preview card details. Servers can disable trends, in which case the list is empty. Use offset to page. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: trendingLinksOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'links', defaultLimit: 10, maxLimit: 20 }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of results to skip, for paging through the trend list. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { limit, offset } = context.propsValue;
+ const links = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/trends/links',
+ operation: 'Get Trending Links',
+ query: { limit, offset },
+ });
+ return { links, count: links.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-trending-statuses.ts b/packages/pieces/community/mastodon/src/lib/actions/get-trending-statuses.ts
new file mode 100644
index 00000000000..e46b154215e
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-trending-statuses.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { trendingStatusesOutputSchema } from '../output-schemas';
+
+export const getTrendingStatuses = createAction({
+ auth: mastodonAuth,
+ name: 'get_trending_statuses',
+ classification: 'SEARCH',
+ displayName: 'Get Trending Statuses',
+ description: 'Get statuses that are trending on the server.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns statuses currently trending on the connected server (most interacted-with). Servers can disable trends, in which case the list is empty. Use offset to page. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: trendingStatusesOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of results to skip, for paging through the trend list. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { limit, offset } = context.propsValue;
+ const statuses = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/trends/statuses',
+ operation: 'Get Trending Statuses',
+ query: { limit, offset },
+ });
+ return { statuses, count: statuses.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-trending-tags.ts b/packages/pieces/community/mastodon/src/lib/actions/get-trending-tags.ts
new file mode 100644
index 00000000000..3b538e21b8a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-trending-tags.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { trendingTagsOutputSchema } from '../output-schemas';
+
+export const getTrendingTags = createAction({
+ auth: mastodonAuth,
+ name: 'get_trending_tags',
+ classification: 'SEARCH',
+ displayName: 'Get Trending Hashtags',
+ description: 'Get hashtags that are trending on the server.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns hashtags currently trending on the connected server, with usage history. Servers can disable trends, in which case the list is empty. Use offset to page. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: trendingTagsOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'hashtags', defaultLimit: 10, maxLimit: 20 }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of results to skip, for paging through the trend list. Defaults to 0.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { limit, offset } = context.propsValue;
+ const tags = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/trends/tags',
+ operation: 'Get Trending Hashtags',
+ query: { limit, offset },
+ });
+ return { tags, count: tags.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/get-unread-notification-count.ts b/packages/pieces/community/mastodon/src/lib/actions/get-unread-notification-count.ts
new file mode 100644
index 00000000000..8ee79b6d681
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/get-unread-notification-count.ts
@@ -0,0 +1,64 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient, mastodonProps } from '../common/client';
+import { unreadNotificationCountOutputSchema } from '../output-schemas';
+
+export const getUnreadNotificationCount = createAction({
+ auth: mastodonAuth,
+ name: 'get_unread_notification_count',
+ classification: 'READ',
+ displayName: 'Get Unread Notification Count',
+ description: 'Get the number of unread notifications.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns how many unread notifications the connected account has (capped by Limit), optionally counting only some types or one account. Use List Notifications to read them. Requires Mastodon 4.3 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: unreadNotificationCountOutputSchema,
+ props: {
+ types: mastodonProps.notificationTypes({
+ displayName: 'Count Only Types',
+ description: 'Only count these notification types. Leave empty for all types.',
+ }),
+ exclude_types: mastodonProps.notificationTypes({
+ displayName: 'Exclude Types',
+ description: 'Do not count these notification types.',
+ }),
+ account_id: Property.ShortText({
+ displayName: 'From Account ID',
+ description: 'Only count notifications caused by this account (local account ID).',
+ required: false,
+ }),
+ limit: Property.Number({
+ displayName: 'Maximum Count',
+ description: 'Stop counting at this number. Defaults to 100, maximum 1000.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ return mastodonClient.request<UnreadCount>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/notifications/unread_count',
+ operation: 'Get Unread Notification Count',
+ scope: 'read:notifications',
+ minVersion: '4.3.0',
+ query: {
+ types: props.types !== undefined && props.types.length > 0 ? props.types : undefined,
+ exclude_types:
+ props.exclude_types !== undefined && props.exclude_types.length > 0
+ ? props.exclude_types
+ : undefined,
+ account_id: props.account_id,
+ limit: props.limit,
+ },
+ });
+ },
+});
+
+type UnreadCount = {
+ count: number;
+};
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-account-followers.ts b/packages/pieces/community/mastodon/src/lib/actions/list-account-followers.ts
new file mode 100644
index 00000000000..a12b8d5b2ef
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-account-followers.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listAccountFollowers = createAction({
+ auth: mastodonAuth,
+ name: 'list_account_followers',
+ classification: 'SEARCH',
+ displayName: 'List Account Followers',
+ description: 'List the followers of an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts following the given account, with Link-header cursors for further pages. Empty when the account hides its social graph. Use List Account Following for the reverse direction. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/followers`,
+ operation: 'List Account Followers',
+ scope: 'read:accounts',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-account-following.ts b/packages/pieces/community/mastodon/src/lib/actions/list-account-following.ts
new file mode 100644
index 00000000000..d2cb4791840
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-account-following.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listAccountFollowing = createAction({
+ auth: mastodonAuth,
+ name: 'list_account_following',
+ classification: 'SEARCH',
+ displayName: 'List Account Following',
+ description: 'List the accounts an account follows.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts the given account follows, with Link-header cursors for further pages. Empty when the account hides its social graph. Use List Account Followers for the reverse direction. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/following`,
+ operation: 'List Account Following',
+ scope: 'read:accounts',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-account-statuses.ts b/packages/pieces/community/mastodon/src/lib/actions/list-account-statuses.ts
new file mode 100644
index 00000000000..89c1c5756bd
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-account-statuses.ts
@@ -0,0 +1,79 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const listAccountStatuses = createAction({
+ auth: mastodonAuth,
+ name: 'list_account_statuses',
+ classification: 'SEARCH',
+ displayName: 'List Account Statuses',
+ description: 'List the statuses posted by an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of statuses posted or boosted by an account, newest first, with cursors for further pages; filter to media, pinned posts, a hashtag, or exclude replies and boosts. For your own posts, get your account ID from Get My Account. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account. Obtain it from Get My Account, Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ only_media: Property.Checkbox({
+ displayName: 'Only Statuses With Media',
+ required: false,
+ defaultValue: false,
+ }),
+ exclude_replies: Property.Checkbox({
+ displayName: 'Exclude Replies',
+ required: false,
+ defaultValue: false,
+ }),
+ exclude_reblogs: Property.Checkbox({
+ displayName: 'Exclude Boosts',
+ required: false,
+ defaultValue: false,
+ }),
+ pinned: Property.Checkbox({
+ displayName: 'Only Pinned Statuses',
+ required: false,
+ defaultValue: false,
+ }),
+ tagged: Property.ShortText({
+ displayName: 'Hashtag Filter',
+ description: 'Only statuses using this hashtag, without the # sign, for example mastodon.',
+ required: false,
+ }),
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/accounts/${encodeURIComponent(props.account_id)}/statuses`,
+ operation: 'List Account Statuses',
+ scope: 'read:statuses',
+ query: {
+ only_media: props.only_media === true ? true : undefined,
+ exclude_replies: props.exclude_replies === true ? true : undefined,
+ exclude_reblogs: props.exclude_reblogs === true ? true : undefined,
+ pinned: props.pinned === true ? true : undefined,
+ tagged: props.tagged?.replace(/^#/, ''),
+ limit: props.limit,
+ max_id: props.max_id,
+ since_id: props.since_id,
+ min_id: props.min_id,
+ },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-blocked-accounts.ts b/packages/pieces/community/mastodon/src/lib/actions/list-blocked-accounts.ts
new file mode 100644
index 00000000000..0b0d74e600c
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-blocked-accounts.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listBlockedAccounts = createAction({
+ auth: mastodonAuth,
+ name: 'list_blocked_accounts',
+ classification: 'SEARCH',
+ displayName: 'List Blocked Accounts',
+ description: 'List the accounts you have blocked.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts blocked by the connected account, with Link-header cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/blocks',
+ operation: 'List Blocked Accounts',
+ scope: 'read:blocks',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-bookmarks.ts b/packages/pieces/community/mastodon/src/lib/actions/list-bookmarks.ts
new file mode 100644
index 00000000000..dd9aa13b2d9
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-bookmarks.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const listBookmarks = createAction({
+ auth: mastodonAuth,
+ name: 'list_bookmarks',
+ classification: 'SEARCH',
+ displayName: 'List Bookmarks',
+ description: 'List the statuses you have bookmarked.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of statuses bookmarked by the connected account, newest bookmark first, with Link-header cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/bookmarks',
+ operation: 'List Bookmarks',
+ scope: 'read:bookmarks',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-conversations.ts b/packages/pieces/community/mastodon/src/lib/actions/list-conversations.ts
new file mode 100644
index 00000000000..125997b4cfd
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-conversations.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { conversationPageOutputSchema } from '../output-schemas';
+
+export const listConversations = createAction({
+ auth: mastodonAuth,
+ name: 'list_conversations',
+ classification: 'SEARCH',
+ displayName: 'List Conversations',
+ description: 'List your direct-message conversations.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of the connected account\'s direct-message conversations (participants, last status, unread flag), with cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: conversationPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'conversations', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/conversations',
+ operation: 'List Conversations',
+ scope: 'read:statuses',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { conversations: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-favourites.ts b/packages/pieces/community/mastodon/src/lib/actions/list-favourites.ts
new file mode 100644
index 00000000000..c970dd71f46
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-favourites.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { statusPageOutputSchema } from '../output-schemas';
+
+export const listFavourites = createAction({
+ auth: mastodonAuth,
+ name: 'list_favourites',
+ classification: 'SEARCH',
+ displayName: 'List Favourites',
+ description: 'List the statuses you have favourited.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of statuses favourited by the connected account, newest favourite first, with Link-header cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: statusPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/favourites',
+ operation: 'List Favourites',
+ scope: 'read:favourites',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-filters.ts b/packages/pieces/community/mastodon/src/lib/actions/list-filters.ts
new file mode 100644
index 00000000000..69076fb19f9
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-filters.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { filtersOutputSchema } from '../output-schemas';
+
+export const listFilters = createAction({
+ auth: mastodonAuth,
+ name: 'list_filters',
+ classification: 'SEARCH',
+ displayName: 'List Filters',
+ description: 'List all of your content filters.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns all content filters of the connected account with their keywords, contexts and actions. Requires Mastodon 4.0 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: filtersOutputSchema,
+ props: {},
+ async run(context) {
+ const filters = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v2/filters',
+ operation: 'List Filters',
+ scope: 'read:filters',
+ minVersion: '4.0.0',
+ });
+ return { filters, count: filters.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-follow-requests.ts b/packages/pieces/community/mastodon/src/lib/actions/list-follow-requests.ts
new file mode 100644
index 00000000000..96558ad7f5d
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-follow-requests.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listFollowRequests = createAction({
+ auth: mastodonAuth,
+ name: 'list_follow_requests',
+ classification: 'SEARCH',
+ displayName: 'List Follow Requests',
+ description: 'List pending requests to follow your account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts with a pending request to follow the connected (locked) account, with Link-header cursors for further pages. Handle them with Accept Follow Request or Reject Follow Request. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/follow_requests',
+ operation: 'List Follow Requests',
+ scope: 'read:follows',
+ query: { limit, max_id, since_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-followed-tags.ts b/packages/pieces/community/mastodon/src/lib/actions/list-followed-tags.ts
new file mode 100644
index 00000000000..cef3fbb492c
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-followed-tags.ts
@@ -0,0 +1,39 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { tagPageOutputSchema } from '../output-schemas';
+
+export const listFollowedTags = createAction({
+ auth: mastodonAuth,
+ name: 'list_followed_tags',
+ classification: 'SEARCH',
+ displayName: 'List Followed Hashtags',
+ description: 'List the hashtags you follow.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of hashtags followed by the connected account. Cursors come from Link headers, which servers before 4.1 do not send (then everything is returned in one page with null cursors). Requires Mastodon 4.0 or later. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: tagPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'hashtags', defaultLimit: 100, maxLimit: 200 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/followed_tags',
+ operation: 'List Followed Hashtags',
+ scope: 'read:follows',
+ minVersion: '4.0.0',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { tags: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-list-accounts.ts b/packages/pieces/community/mastodon/src/lib/actions/list-list-accounts.ts
new file mode 100644
index 00000000000..8da065b2287
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-list-accounts.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listListAccounts = createAction({
+ auth: mastodonAuth,
+ name: 'list_list_accounts',
+ classification: 'SEARCH',
+ displayName: 'List Accounts in List',
+ description: 'List the accounts that are members of one of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts in one of the connected account\'s lists, with Link-header cursors for further pages (the previous-page cursor comes back as prev_since_id). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description:
+ 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/lists/${encodeURIComponent(context.propsValue.list_id)}/accounts`,
+ operation: 'List Accounts in List',
+ scope: 'read:lists',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-lists.ts b/packages/pieces/community/mastodon/src/lib/actions/list-lists.ts
new file mode 100644
index 00000000000..a65aa41d828
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-lists.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { listsOutputSchema } from '../output-schemas';
+
+export const listLists = createAction({
+ auth: mastodonAuth,
+ name: 'list_lists',
+ classification: 'SEARCH',
+ displayName: 'List Lists',
+ description: 'List all of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns all lists owned by the connected account with their IDs, titles and settings; use it to resolve a list name to the List ID other list actions need. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: listsOutputSchema,
+ props: {},
+ async run(context) {
+ const lists = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/lists',
+ operation: 'List Lists',
+ scope: 'read:lists',
+ });
+ return { lists, count: lists.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-muted-accounts.ts b/packages/pieces/community/mastodon/src/lib/actions/list-muted-accounts.ts
new file mode 100644
index 00000000000..27b7ed67814
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-muted-accounts.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { mutedAccountPageOutputSchema } from '../output-schemas';
+
+export const listMutedAccounts = createAction({
+ auth: mastodonAuth,
+ name: 'list_muted_accounts',
+ classification: 'SEARCH',
+ displayName: 'List Muted Accounts',
+ description: 'List the accounts you have muted.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts muted by the connected account (each with mute_expires_at for timed mutes), with Link-header cursors for further pages. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: mutedAccountPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/mutes',
+ operation: 'List Muted Accounts',
+ scope: 'read:mutes',
+ query: { limit, max_id, since_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-notifications.ts b/packages/pieces/community/mastodon/src/lib/actions/list-notifications.ts
new file mode 100644
index 00000000000..065e939993d
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-notifications.ts
@@ -0,0 +1,64 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { notificationPageOutputSchema } from '../output-schemas';
+
+export const listNotifications = createAction({
+ auth: mastodonAuth,
+ name: 'list_notifications',
+ classification: 'SEARCH',
+ displayName: 'List Notifications',
+ description: 'List notifications of the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of the connected account\'s notifications (mentions, follows, favourites, boosts, polls and more), newest first, with cursors for further pages; filter by type or by the account that caused them. Use Get Unread Notification Count for just a number. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: notificationPageOutputSchema,
+ props: {
+ types: mastodonProps.notificationTypes({
+ displayName: 'Include Types',
+ description: 'Only return these notification types. Leave empty for all types.',
+ }),
+ exclude_types: mastodonProps.notificationTypes({
+ displayName: 'Exclude Types',
+ description: 'Leave out these notification types.',
+ }),
+ account_id: Property.ShortText({
+ displayName: 'From Account ID',
+ description:
+ 'Only notifications caused by this account (local ID from Lookup Account or Search Accounts).',
+ required: false,
+ }),
+ limit: mastodonProps.limit({ noun: 'notifications', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/notifications',
+ operation: 'List Notifications',
+ scope: 'read:notifications',
+ query: {
+ types: nonEmpty({ values: props.types }),
+ exclude_types: nonEmpty({ values: props.exclude_types }),
+ account_id: props.account_id,
+ limit: props.limit,
+ max_id: props.max_id,
+ since_id: props.since_id,
+ min_id: props.min_id,
+ },
+ });
+ return { notifications: items, ...cursors };
+ },
+});
+
+function nonEmpty({ values }: { values: string[] | undefined }): string[] | undefined {
+ return values === undefined || values.length === 0 ? undefined : values;
+}
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-scheduled-statuses.ts b/packages/pieces/community/mastodon/src/lib/actions/list-scheduled-statuses.ts
new file mode 100644
index 00000000000..55f53d58c50
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-scheduled-statuses.ts
@@ -0,0 +1,38 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { scheduledStatusPageOutputSchema } from '../output-schemas';
+
+export const listScheduledStatuses = createAction({
+ auth: mastodonAuth,
+ name: 'list_scheduled_statuses',
+ classification: 'SEARCH',
+ displayName: 'List Scheduled Statuses',
+ description: 'List your statuses scheduled for future publication.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of the connected account\'s scheduled (not yet published) statuses with cursors for further pages. Use Get Scheduled Status for one item. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: scheduledStatusPageOutputSchema,
+ props: {
+ limit: mastodonProps.limit({ noun: 'scheduled statuses', defaultLimit: 20, maxLimit: 40 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ min_id: mastodonProps.minId(),
+ },
+ async run(context) {
+ const { limit, max_id, since_id, min_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/scheduled_statuses',
+ operation: 'List Scheduled Statuses',
+ scope: 'read:statuses',
+ query: { limit, max_id, since_id, min_id },
+ });
+ return { scheduled_statuses: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-status-boosted-by.ts b/packages/pieces/community/mastodon/src/lib/actions/list-status-boosted-by.ts
new file mode 100644
index 00000000000..27c02111611
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-status-boosted-by.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listStatusBoostedBy = createAction({
+ auth: mastodonAuth,
+ name: 'list_status_boosted_by',
+ classification: 'SEARCH',
+ displayName: 'List Accounts That Boosted a Status',
+ description: 'List the accounts that boosted (reblogged) a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts that boosted a given status, with cursors for further pages (pass next_max_id as Max ID, prev_since_id as Since ID). Use List Accounts That Favourited a Status for favourites. Needs the read:accounts scope. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description: 'Local ID of the status. Obtain it from a timeline, Get Status or Search.',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ },
+ async run(context) {
+ const { status_id, limit, max_id, since_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/statuses/${encodeURIComponent(status_id)}/reblogged_by`,
+ operation: 'List Accounts That Boosted a Status',
+ scope: 'read:accounts',
+ query: { limit, max_id, since_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/list-status-favourited-by.ts b/packages/pieces/community/mastodon/src/lib/actions/list-status-favourited-by.ts
new file mode 100644
index 00000000000..4e1d23586a5
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/list-status-favourited-by.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { accountPageOutputSchema } from '../output-schemas';
+
+export const listStatusFavouritedBy = createAction({
+ auth: mastodonAuth,
+ name: 'list_status_favourited_by',
+ classification: 'SEARCH',
+ displayName: 'List Accounts That Favourited a Status',
+ description: 'List the accounts that favourited a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Returns one page of accounts that favourited a given status, with cursors for further pages (pass next_max_id as Max ID, prev_since_id as Since ID). Use List Accounts That Boosted a Status for boosts. Needs the read:accounts scope. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountPageOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description: 'Local ID of the status. Obtain it from a timeline, Get Status or Search.',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ max_id: mastodonProps.maxId(),
+ since_id: mastodonProps.sinceId(),
+ },
+ async run(context) {
+ const { status_id, limit, max_id, since_id } = context.propsValue;
+ const { items, ...cursors } = await mastodonClient.requestPage<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: `/api/v1/statuses/${encodeURIComponent(status_id)}/favourited_by`,
+ operation: 'List Accounts That Favourited a Status',
+ scope: 'read:accounts',
+ query: { limit, max_id, since_id },
+ });
+ return { accounts: items, ...cursors };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/lookup-account.ts b/packages/pieces/community/mastodon/src/lib/actions/lookup-account.ts
new file mode 100644
index 00000000000..77db8b091e4
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/lookup-account.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { accountOutputSchema } from '../output-schemas';
+
+export const lookupAccount = createAction({
+ auth: mastodonAuth,
+ name: 'lookup_account',
+ classification: 'READ',
+ displayName: 'Lookup Account',
+ description: 'Find an account by its handle (username or user@domain).',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Resolves a handle such as Gargron or [email protected] to the account profile and local ID, without a fuzzy search. Only finds accounts already known to this server; for a remote user@domain that 404s, use Search with resolve=true (type accounts). Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: accountOutputSchema,
+ props: {
+ acct: Property.ShortText({
+ displayName: 'Handle',
+ description:
+ 'Username for a local account (for example Gargron) or user@domain for a remote one (for example [email protected]). A leading @ is removed automatically.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/accounts/lookup',
+ operation: 'Lookup Account',
+ scope: 'read:accounts',
+ notFoundMessage:
+ 'Mastodon found no account with this handle. Lookup Account only finds accounts already known to this server; for a remote user@domain, use Search with resolve=true (type accounts) to import it and get its local ID.',
+ query: { acct: context.propsValue.acct.trim().replace(/^@/, '') },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/mark-conversation-read.ts b/packages/pieces/community/mastodon/src/lib/actions/mark-conversation-read.ts
new file mode 100644
index 00000000000..a7ec09f67e0
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/mark-conversation-read.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { conversationOutputSchema } from '../output-schemas';
+
+export const markConversationRead = createAction({
+ auth: mastodonAuth,
+ name: 'mark_conversation_read',
+ classification: 'WRITE',
+ displayName: 'Mark Conversation as Read',
+ description: 'Mark a direct-message conversation as read.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Marks a direct-message conversation of the connected account as read. Get the conversation ID from List Conversations. Safe to retry. Returns the updated conversation.',
+ idempotent: true,
+ },
+ outputSchema: conversationOutputSchema,
+ props: {
+ conversation_id: Property.ShortText({
+ displayName: 'Conversation ID',
+ description:
+ 'ID of the direct-message conversation. Obtain it from List Conversations.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/conversations/${encodeURIComponent(context.propsValue.conversation_id)}/read`,
+ operation: 'Mark Conversation as Read',
+ scope: 'write:conversations',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/mute-account.ts b/packages/pieces/community/mastodon/src/lib/actions/mute-account.ts
new file mode 100644
index 00000000000..fa0c16ae4c7
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/mute-account.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const muteAccount = createAction({
+ auth: mastodonAuth,
+ name: 'mute_account',
+ classification: 'WRITE',
+ displayName: 'Mute Account',
+ description: 'Hide an account\'s posts, and optionally its notifications.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Mutes an account so its posts are hidden from the connected account (the muted account is not told). Unset Mute Notifications also hides their notifications; unset Duration mutes indefinitely. Calling it on an already-muted account overwrites the existing mute\'s duration and notification setting, so pass both to keep them. Use Block Account to also stop them seeing you. Returns the relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account to mute. Obtain it from Lookup Account, Search Accounts or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ notifications: mastodonProps.optionalBoolean({
+ displayName: 'Mute Notifications',
+ description: 'Also hide notifications from this account. Leave empty for the default (yes).',
+ }),
+ duration: Property.Number({
+ displayName: 'Duration (seconds)',
+ description: 'How long the mute lasts, in seconds, for example 86400 for one day. Leave empty or 0 to mute indefinitely.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { account_id, notifications, duration } = context.propsValue;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(account_id)}/mute`,
+ operation: 'Mute Account',
+ scope: 'write:mutes',
+ body: {
+ ...(notifications !== undefined ? { notifications } : {}),
+ ...(duration !== undefined && duration !== null ? { duration } : {}),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/mute-conversation.ts b/packages/pieces/community/mastodon/src/lib/actions/mute-conversation.ts
new file mode 100644
index 00000000000..7656f30baf8
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/mute-conversation.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const muteConversation = createAction({
+ auth: mastodonAuth,
+ name: 'mute_conversation',
+ classification: 'WRITE',
+ displayName: 'Mute Conversation',
+ description: 'Stop receiving notifications for a thread.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Mutes notifications from the conversation thread a status belongs to, for a thread the connected account participates in. Use Mute Account to silence a person instead. Safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/mute`,
+ operation: 'Mute Conversation',
+ scope: 'write:mutes',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/pin-status.ts b/packages/pieces/community/mastodon/src/lib/actions/pin-status.ts
new file mode 100644
index 00000000000..cae35652acc
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/pin-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const pinStatus = createAction({
+ auth: mastodonAuth,
+ name: 'pin_status',
+ classification: 'WRITE',
+ displayName: 'Pin Status to Profile',
+ description: 'Feature one of your statuses at the top of your profile.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Pins one of the connected account\'s own public, unlisted or (Mastodon 3.5+) followers-only statuses to the top of its profile, visible to profile visitors; direct messages cannot be pinned and servers cap the number of pins. Pinning an already-pinned status may be rejected, so do not blindly retry. Returns the updated status.',
+ idempotent: false,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of your own status. Obtain it from Create Status, Get Status or List Account Statuses.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/pin`,
+ operation: 'Pin Status to Profile',
+ scope: 'write:accounts',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/post-status.ts b/packages/pieces/community/mastodon/src/lib/actions/post-status.ts
index d88297420c5..4325528a350 100644
--- a/packages/pieces/community/mastodon/src/lib/actions/post-status.ts
+++ b/packages/pieces/community/mastodon/src/lib/actions/post-status.ts
@@ -6,6 +6,7 @@ import {
HttpMethod,
} from '@activepieces/pieces-common';
import { mastodonAuth } from '../..';
+import { postStatusOutputSchema } from '../output-schemas';
const uploadMedia = async (media: ApFile, baseUrl: string, token: string) => {
const formData = new FormData();
@@ -33,8 +34,9 @@ export const postStatus = createAction({
classification: 'WRITE',
displayName: 'Post Status',
description: 'Post a status to Mastodon',
- audience: 'both',
+ audience: 'human',
aiMetadata: { description: 'Publishes a new status (toot) to a Mastodon instance from the authenticated account, optionally attaching a single media file uploaded alongside the post. Use to broadcast a message or share content on Mastodon. Requires status text; not idempotent — each call creates a separate post.', idempotent: false },
+ outputSchema: postStatusOutputSchema,
props: {
status: Property.LongText({
displayName: 'Status',
diff --git a/packages/pieces/community/mastodon/src/lib/actions/reject-follow-request.ts b/packages/pieces/community/mastodon/src/lib/actions/reject-follow-request.ts
new file mode 100644
index 00000000000..2adb3e65884
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/reject-follow-request.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const rejectFollowRequest = createAction({
+ auth: mastodonAuth,
+ name: 'reject_follow_request',
+ classification: 'WRITE',
+ displayName: 'Reject Follow Request',
+ description: 'Reject a pending follow request.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Rejects a pending follow request to the connected (locked) account. Get the account ID from List Follow Requests. Repeating the call fails with not found once the request is handled. Returns the updated relationship.',
+ idempotent: false,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account that requested to follow you. Obtain it from List Follow Requests.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/follow_requests/${encodeURIComponent(context.propsValue.account_id)}/reject`,
+ operation: 'Reject Follow Request',
+ scope: 'write:follows',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/remove-accounts-from-list.ts b/packages/pieces/community/mastodon/src/lib/actions/remove-accounts-from-list.ts
new file mode 100644
index 00000000000..cecf985169b
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/remove-accounts-from-list.ts
@@ -0,0 +1,49 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient, mastodonUtils } from '../common/client';
+import { listAcknowledgementOutputSchema } from '../output-schemas';
+
+export const removeAccountsFromList = createAction({
+ auth: mastodonAuth,
+ name: 'remove_accounts_from_list',
+ classification: 'WRITE',
+ displayName: 'Remove Accounts from List',
+ description: 'Remove accounts from one of your lists.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes one or more accounts from one of the connected account\'s lists; it does not unfollow them. Removing an account that is not in the list changes nothing, so it is safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: listAcknowledgementOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description: 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ account_ids: Property.Array({
+ displayName: 'Account IDs',
+ description:
+ 'Local IDs of the accounts to remove, one per item. Obtain them from List Accounts in List.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { list_id } = context.propsValue;
+ const accountIds = mastodonUtils.toStringArray(context.propsValue.account_ids);
+ if (accountIds === undefined) {
+ throw new Error('Provide at least one Account ID.');
+ }
+ await mastodonClient.request<unknown>({
+ auth: context.auth.props,
+ method: HttpMethod.DELETE,
+ path: `/api/v1/lists/${encodeURIComponent(list_id)}/accounts`,
+ operation: 'Remove Accounts from List',
+ scope: 'write:lists',
+ query: { account_ids: accountIds },
+ });
+ return { success: true, list_id };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/reschedule-status.ts b/packages/pieces/community/mastodon/src/lib/actions/reschedule-status.ts
new file mode 100644
index 00000000000..b4ea740cc3c
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/reschedule-status.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonUtils } from '../common/client';
+import { scheduledStatusOutputSchema } from '../output-schemas';
+
+export const rescheduleStatus = createAction({
+ auth: mastodonAuth,
+ name: 'reschedule_status',
+ classification: 'WRITE',
+ displayName: 'Reschedule Status',
+ description: 'Change the publication time of a scheduled status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Moves a scheduled status to a new publication time (at least 6 minutes ahead); its content cannot be changed here. Use Cancel Scheduled Status to drop it instead. Setting the same time again converges, so it is safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: scheduledStatusOutputSchema,
+ props: {
+ scheduled_status_id: Property.ShortText({
+ displayName: 'Scheduled Status ID',
+ description:
+ 'ID of the scheduled status. Obtain it from Schedule Status or List Scheduled Statuses.',
+ required: true,
+ }),
+ scheduled_at: Property.DateTime({
+ displayName: 'Scheduled At',
+ description:
+ 'New publication time as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { scheduled_status_id, scheduled_at } = context.propsValue;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.PUT,
+ path: `/api/v1/scheduled_statuses/${encodeURIComponent(scheduled_status_id)}`,
+ operation: 'Reschedule Status',
+ scope: 'write:statuses',
+ body: { scheduled_at: mastodonUtils.assertScheduledAt(scheduled_at) },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/schedule-status.ts b/packages/pieces/community/mastodon/src/lib/actions/schedule-status.ts
new file mode 100644
index 00000000000..f65b65feb4d
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/schedule-status.ts
@@ -0,0 +1,68 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+import { scheduledStatusOutputSchema } from '../output-schemas';
+
+export const scheduleStatus = createAction({
+ auth: mastodonAuth,
+ name: 'schedule_status',
+ classification: 'WRITE',
+ displayName: 'Schedule Status',
+ description: 'Schedule a status to be published automatically at a future time.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Schedules a status to be published by Mastodon at a future date-time (at least 6 minutes ahead) and returns the scheduled status, not a published post. Use Create Status to post immediately; manage the result with List Scheduled Statuses, Reschedule Status or Cancel Scheduled Status. Each call schedules another post.',
+ idempotent: false,
+ },
+ outputSchema: scheduledStatusOutputSchema,
+ props: {
+ scheduled_at: Property.DateTime({
+ displayName: 'Scheduled At',
+ description:
+ 'When to publish, as an ISO 8601 date-time such as 2026-10-01T09:30:00Z. Must be at least 6 minutes in the future.',
+ required: true,
+ }),
+ ...mastodonProps.compose(),
+ idempotency_key: Property.ShortText({
+ displayName: 'Idempotency Key',
+ description:
+ 'Optional unique string (for example a UUID). Mastodon keeps it for up to 1 hour and ignores a duplicate submission with the same key.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const scheduledAt = mastodonUtils.assertScheduledAt(props.scheduled_at);
+ const body = mastodonUtils.buildComposeBody({
+ status: props.status,
+ visibility: props.visibility,
+ inReplyToId: props.in_reply_to_id,
+ spoilerText: props.spoiler_text,
+ sensitive: props.sensitive,
+ language: props.language,
+ mediaIds: mastodonUtils.toStringArray(props.media_ids),
+ pollOptions: mastodonUtils.toStringArray(props.poll_options),
+ pollExpiresIn: props.poll_expires_in,
+ pollMultiple: props.poll_multiple,
+ });
+ const idempotencyKey = props.idempotency_key;
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v1/statuses',
+ operation: 'Schedule Status',
+ scope: 'write:statuses',
+ body: { ...body, scheduled_at: scheduledAt },
+ headers: mastodonUtils.hasValue(idempotencyKey)
+ ? { 'Idempotency-Key': String(idempotencyKey) }
+ : undefined,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/search-accounts.ts b/packages/pieces/community/mastodon/src/lib/actions/search-accounts.ts
new file mode 100644
index 00000000000..de291dcd9aa
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/search-accounts.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+import { searchAccountsOutputSchema } from '../output-schemas';
+
+export const searchAccounts = createAction({
+ auth: mastodonAuth,
+ name: 'search_accounts',
+ classification: 'SEARCH',
+ displayName: 'Search Accounts',
+ description: 'Search for accounts by name or handle.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Searches accounts by display name, username or handle and returns matching profiles with their local IDs. Use Lookup Account for an exact handle, or Search to find statuses and hashtags too. Set Resolve to fetch an unknown remote user@domain via WebFinger. Page with Offset. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: searchAccountsOutputSchema,
+ props: {
+ q: Property.ShortText({
+ displayName: 'Query',
+ description: 'Text to search for, for example a name, username or user@domain.',
+ required: true,
+ }),
+ limit: mastodonProps.limit({ noun: 'accounts', defaultLimit: 40, maxLimit: 80 }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of results to skip, for paging. Defaults to 0.',
+ required: false,
+ }),
+ resolve: mastodonProps.optionalBoolean({
+ displayName: 'Resolve Remote Accounts',
+ description: 'Look up unknown remote accounts via WebFinger (slower). Leave empty for the server default (no).',
+ }),
+ following: mastodonProps.optionalBoolean({
+ displayName: 'Only Accounts I Follow',
+ description: 'Limit results to accounts the connected account follows. Leave empty for no restriction.',
+ }),
+ },
+ async run(context) {
+ const { q, limit, offset, resolve, following } = context.propsValue;
+ const accounts = await mastodonClient.request<MastodonEntity[]>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v1/accounts/search',
+ operation: 'Search Accounts',
+ scope: 'read:accounts',
+ query: { q, limit, offset, resolve, following },
+ });
+ return { accounts, count: accounts.length };
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/search.ts b/packages/pieces/community/mastodon/src/lib/actions/search.ts
new file mode 100644
index 00000000000..dfa3256e7bb
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/search.ts
@@ -0,0 +1,105 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonProps } from '../common/client';
+
+const URL_PATTERN = /^https?:\/\//i;
+const HANDLE_PATTERN = /^@?[^@\s]+@[^@\s]+\.[^@\s]+$/;
+import { searchOutputSchema } from '../output-schemas';
+
+export const search = createAction({
+ auth: mastodonAuth,
+ name: 'search',
+ classification: 'SEARCH',
+ displayName: 'Search',
+ description: 'Search for accounts, statuses and hashtags.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Searches accounts, statuses and hashtags on the connected server. It is also how to import remote content: a status URL or a user@domain handle with resolve=true fetches it from the other server and returns its local ID for other actions; resolve is turned on automatically for such queries unless you set it. Full-text status search depends on the server and may only match your own posts. Read-only and safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: searchOutputSchema,
+ props: {
+ q: Property.ShortText({
+ displayName: 'Query',
+ description:
+ 'Search text, a hashtag, a handle such as [email protected], or a status or profile URL such as https://mastodon.social/@Gargron/109372843234737004.',
+ required: true,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Result Type',
+ description: 'Only return one kind of result. Leave empty for all three.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Accounts', value: 'accounts' },
+ { label: 'Statuses', value: 'statuses' },
+ { label: 'Hashtags', value: 'hashtags' },
+ ],
+ },
+ }),
+ resolve: mastodonProps.optionalBoolean({
+ displayName: 'Resolve Remote Content',
+ description:
+ 'Fetch unknown remote accounts or URLs from their server. Leave empty to resolve automatically when the query is a URL or user@domain handle.',
+ }),
+ following: mastodonProps.optionalBoolean({
+ displayName: 'Only Accounts I Follow',
+ description: 'Only include accounts the connected account follows. Leave empty for no restriction.',
+ }),
+ account_id: Property.ShortText({
+ displayName: 'Statuses By Account ID',
+ description: 'Only return statuses authored by this account (local account ID).',
+ required: false,
+ }),
+ exclude_unreviewed: mastodonProps.optionalBoolean({
+ displayName: 'Exclude Unreviewed Hashtags',
+ description: 'Leave out hashtags not yet reviewed by moderators. Leave empty for the default (no).',
+ }),
+ limit: mastodonProps.limit({ noun: 'results per type', defaultLimit: 20, maxLimit: 40 }),
+ offset: Property.Number({
+ displayName: 'Offset',
+ description: 'Number of results to skip, for paging. Only applies when Result Type is set.',
+ required: false,
+ }),
+ max_id: Property.ShortText({
+ displayName: 'Max ID',
+ description: 'Only return results with an ID lower than this.',
+ required: false,
+ }),
+ min_id: Property.ShortText({
+ displayName: 'Min ID',
+ description: 'Only return results with an ID immediately higher than this.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const query = props.q.trim();
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.GET,
+ path: '/api/v2/search',
+ operation: 'Search',
+ scope: 'read:search',
+ query: {
+ q: query,
+ type: props.type,
+ resolve: props.resolve ?? (shouldAutoResolve({ query }) ? true : undefined),
+ following: props.following,
+ account_id: props.account_id,
+ exclude_unreviewed: props.exclude_unreviewed,
+ limit: props.limit,
+ offset: props.offset,
+ max_id: props.max_id,
+ min_id: props.min_id,
+ },
+ });
+ },
+});
+
+function shouldAutoResolve({ query }: { query: string }): boolean {
+ return URL_PATTERN.test(query) || HANDLE_PATTERN.test(query);
+}
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unblock-account.ts b/packages/pieces/community/mastodon/src/lib/actions/unblock-account.ts
new file mode 100644
index 00000000000..99f702acced
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unblock-account.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const unblockAccount = createAction({
+ auth: mastodonAuth,
+ name: 'unblock_account',
+ classification: 'WRITE',
+ displayName: 'Unblock Account',
+ description: 'Unblock an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes a block on an account. Follows removed by the block are not restored. Safe to retry. Returns the updated relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/unblock`,
+ operation: 'Unblock Account',
+ scope: 'write:blocks',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unbookmark-status.ts b/packages/pieces/community/mastodon/src/lib/actions/unbookmark-status.ts
new file mode 100644
index 00000000000..0249db24ae0
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unbookmark-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const unbookmarkStatus = createAction({
+ auth: mastodonAuth,
+ name: 'unbookmark_status',
+ classification: 'WRITE',
+ displayName: 'Remove Bookmark',
+ description: 'Remove a status from your bookmarks.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes a status from the connected account\'s bookmarks. Safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/unbookmark`,
+ operation: 'Remove Bookmark',
+ scope: 'write:bookmarks',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unboost-status.ts b/packages/pieces/community/mastodon/src/lib/actions/unboost-status.ts
new file mode 100644
index 00000000000..efa13823cb2
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unboost-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const unboostStatus = createAction({
+ auth: mastodonAuth,
+ name: 'unboost_status',
+ classification: 'WRITE',
+ displayName: 'Unboost Status',
+ description: 'Undo a boost (reblog) of a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes the connected account\'s boost of a status. Pass the original status ID, not the ID of the boost itself. Safe to retry; counts against the rate limit of 30 deletes and unboosts per 30 minutes. Returns the original status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/unreblog`,
+ operation: 'Unboost Status',
+ scope: 'write:statuses',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unfavourite-status.ts b/packages/pieces/community/mastodon/src/lib/actions/unfavourite-status.ts
new file mode 100644
index 00000000000..1ed4b60c4be
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unfavourite-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const unfavouriteStatus = createAction({
+ auth: mastodonAuth,
+ name: 'unfavourite_status',
+ classification: 'WRITE',
+ displayName: 'Unfavourite Status',
+ description: 'Remove a status from your favourites.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes the connected account\'s favourite from a status. Safe to retry; unfavouriting a status that is not favourited changes nothing. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/unfavourite`,
+ operation: 'Unfavourite Status',
+ scope: 'write:favourites',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unfollow-account.ts b/packages/pieces/community/mastodon/src/lib/actions/unfollow-account.ts
new file mode 100644
index 00000000000..071809a6a1d
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unfollow-account.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const unfollowAccount = createAction({
+ auth: mastodonAuth,
+ name: 'unfollow_account',
+ classification: 'WRITE',
+ displayName: 'Unfollow Account',
+ description: 'Stop following an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Unfollows an account (or withdraws a pending follow request) as the connected account. Safe to retry. Returns the updated relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/unfollow`,
+ operation: 'Unfollow Account',
+ scope: 'write:follows',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unfollow-tag.ts b/packages/pieces/community/mastodon/src/lib/actions/unfollow-tag.ts
new file mode 100644
index 00000000000..b46a7568953
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unfollow-tag.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { tagOutputSchema } from '../output-schemas';
+
+export const unfollowTag = createAction({
+ auth: mastodonAuth,
+ name: 'unfollow_tag',
+ classification: 'WRITE',
+ displayName: 'Unfollow Hashtag',
+ description: 'Stop following a hashtag.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Stops following a hashtag. Requires Mastodon 4.0 or later. Safe to retry. Returns the hashtag.',
+ idempotent: true,
+ },
+ outputSchema: tagOutputSchema,
+ props: {
+ tag_name: Property.ShortText({
+ displayName: 'Hashtag',
+ description:
+ 'Hashtag name without the # sign, for example mastodon. A leading # is removed automatically.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/tags/${encodeURIComponent(context.propsValue.tag_name.replace(/^#/, ''))}/unfollow`,
+ operation: 'Unfollow Hashtag',
+ scope: 'write:follows',
+ minVersion: '4.0.0',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unmute-account.ts b/packages/pieces/community/mastodon/src/lib/actions/unmute-account.ts
new file mode 100644
index 00000000000..61f16333741
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unmute-account.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { relationshipOutputSchema } from '../output-schemas';
+
+export const unmuteAccount = createAction({
+ auth: mastodonAuth,
+ name: 'unmute_account',
+ classification: 'WRITE',
+ displayName: 'Unmute Account',
+ description: 'Unmute an account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Removes a mute on an account so its posts and notifications show again. Safe to retry. Returns the updated relationship.',
+ idempotent: true,
+ },
+ outputSchema: relationshipOutputSchema,
+ props: {
+ account_id: Property.ShortText({
+ displayName: 'Account ID',
+ description:
+ 'Local ID of the account on this server, for example 109302436954721982. Obtain it from Lookup Account, Search Accounts, Get Account or Search (use resolve for a remote user@domain).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/accounts/${encodeURIComponent(context.propsValue.account_id)}/unmute`,
+ operation: 'Unmute Account',
+ scope: 'write:mutes',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unmute-conversation.ts b/packages/pieces/community/mastodon/src/lib/actions/unmute-conversation.ts
new file mode 100644
index 00000000000..0e5ec99ec25
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unmute-conversation.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const unmuteConversation = createAction({
+ auth: mastodonAuth,
+ name: 'unmute_conversation',
+ classification: 'WRITE',
+ displayName: 'Unmute Conversation',
+ description: 'Resume notifications for a muted thread.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Unmutes notifications for the conversation thread a status belongs to. Safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of the status on this server, for example 109372843234737004. Obtain it from a timeline, Get Status or Search (use resolve for a status URL from another server).',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/unmute`,
+ operation: 'Unmute Conversation',
+ scope: 'write:mutes',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/unpin-status.ts b/packages/pieces/community/mastodon/src/lib/actions/unpin-status.ts
new file mode 100644
index 00000000000..04d6f329f23
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/unpin-status.ts
@@ -0,0 +1,37 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { statusOutputSchema } from '../output-schemas';
+
+export const unpinStatus = createAction({
+ auth: mastodonAuth,
+ name: 'unpin_status',
+ classification: 'WRITE',
+ displayName: 'Unpin Status from Profile',
+ description: 'Remove a pinned status from your profile.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Unpins one of the connected account\'s statuses from its profile. Safe to retry. Returns the updated status.',
+ idempotent: true,
+ },
+ outputSchema: statusOutputSchema,
+ props: {
+ status_id: Property.ShortText({
+ displayName: 'Status ID',
+ description:
+ 'Local ID of your own status. Obtain it from Create Status, Get Status or List Account Statuses.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/statuses/${encodeURIComponent(context.propsValue.status_id)}/unpin`,
+ operation: 'Unpin Status from Profile',
+ scope: 'write:accounts',
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/update-filter.ts b/packages/pieces/community/mastodon/src/lib/actions/update-filter.ts
new file mode 100644
index 00000000000..25ece72df62
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/update-filter.ts
@@ -0,0 +1,88 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonUtils } from '../common/client';
+
+const CONTEXT_OPTIONS = [
+ { label: 'Home and lists', value: 'home' },
+ { label: 'Notifications', value: 'notifications' },
+ { label: 'Public timelines', value: 'public' },
+ { label: 'Conversations (threads)', value: 'thread' },
+ { label: 'Profiles', value: 'account' },
+];
+
+const FILTER_ACTION_OPTIONS = [
+ { label: 'Warn (hide behind a warning)', value: 'warn' },
+ { label: 'Hide completely', value: 'hide' },
+ { label: 'Blur media (Mastodon 4.4+)', value: 'blur' },
+];
+import { filterOutputSchema } from '../output-schemas';
+
+export const updateFilter = createAction({
+ auth: mastodonAuth,
+ name: 'update_filter',
+ classification: 'WRITE',
+ displayName: 'Update Filter',
+ description: 'Change the title, contexts, action or expiry of a content filter.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates one of the connected account\'s content filters; only the fields you set are sent. Apply In replaces the whole context list when set. Keywords are not changed here. Setting the same values again converges, so it is safe to retry. Requires Mastodon 4.0 or later.',
+ idempotent: true,
+ },
+ outputSchema: filterOutputSchema,
+ props: {
+ filter_id: Property.ShortText({
+ displayName: 'Filter ID',
+ description: 'ID of the filter. Obtain it from List Filters or Create Filter.',
+ required: true,
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'New name of the filter. Leave empty to keep the current title.',
+ required: false,
+ }),
+ context: Property.StaticMultiSelectDropdown({
+ displayName: 'Apply In',
+ description: 'Replaces where the filter applies. Leave empty to keep the current contexts.',
+ required: false,
+ options: { disabled: false, options: CONTEXT_OPTIONS },
+ }),
+ filter_action: Property.StaticDropdown({
+ displayName: 'Action',
+ description: 'What happens to matching posts. Leave empty to keep the current action.',
+ required: false,
+ options: { disabled: false, options: FILTER_ACTION_OPTIONS },
+ }),
+ expires_in: Property.Number({
+ displayName: 'Expires In (seconds)',
+ description: 'New expiry, in seconds from now. Leave empty to keep the current expiry.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const body = {
+ ...(mastodonUtils.hasValue(props.title) ? { title: props.title } : {}),
+ ...(props.context !== undefined && props.context.length > 0
+ ? { context: props.context }
+ : {}),
+ ...(mastodonUtils.hasValue(props.filter_action) ? { filter_action: props.filter_action } : {}),
+ ...(props.expires_in !== undefined && props.expires_in !== null
+ ? { expires_in: props.expires_in }
+ : {}),
+ };
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set at least one field to update.');
+ }
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.PUT,
+ path: `/api/v2/filters/${encodeURIComponent(props.filter_id)}`,
+ operation: 'Update Filter',
+ scope: 'write:filters',
+ minVersion: '4.0.0',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/update-list.ts b/packages/pieces/community/mastodon/src/lib/actions/update-list.ts
new file mode 100644
index 00000000000..8e500a9a60c
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/update-list.ts
@@ -0,0 +1,72 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+
+const REPLIES_POLICY_OPTIONS = [
+ { label: 'Any followed user', value: 'followed' },
+ { label: 'Members of the list', value: 'list' },
+ { label: 'No one', value: 'none' },
+];
+import { listOutputSchema } from '../output-schemas';
+
+export const updateList = createAction({
+ auth: mastodonAuth,
+ name: 'update_list',
+ classification: 'WRITE',
+ displayName: 'Update List',
+ description: 'Rename a list or change its settings.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Changes the title, replies policy or exclusive setting of one of the connected account\'s lists; only the fields you set change. Use Add Accounts to List or Remove Accounts from List to change members. Setting the same values again converges, so it is safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: listOutputSchema,
+ props: {
+ list_id: Property.ShortText({
+ displayName: 'List ID',
+ description: 'ID of one of your lists. Obtain it from List Lists or Create List.',
+ required: true,
+ }),
+ title: Property.ShortText({
+ displayName: 'Title',
+ description: 'New name of the list. Leave empty to keep the current title.',
+ required: false,
+ }),
+ replies_policy: Property.StaticDropdown({
+ displayName: 'Show Replies To',
+ description: 'Which replies appear in the list timeline. Leave empty to keep the current setting.',
+ required: false,
+ options: { disabled: false, options: REPLIES_POLICY_OPTIONS },
+ }),
+ exclusive: mastodonProps.optionalBoolean({
+ displayName: 'Hide Members From Home Timeline',
+ description: 'Whether posts from list members are removed from the home timeline. Leave empty to keep the current setting.',
+ }),
+ },
+ async run(context) {
+ const { list_id, title, replies_policy, exclusive } = context.propsValue;
+ const body = {
+ ...(mastodonUtils.hasValue(title) ? { title } : {}),
+ ...(mastodonUtils.hasValue(replies_policy) ? { replies_policy } : {}),
+ ...(exclusive !== undefined ? { exclusive } : {}),
+ };
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set Title, Show Replies To or Hide Members From Home Timeline; there is nothing to update.');
+ }
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.PUT,
+ path: `/api/v1/lists/${encodeURIComponent(list_id)}`,
+ operation: 'Update List',
+ scope: 'write:lists',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/update-media.ts b/packages/pieces/community/mastodon/src/lib/actions/update-media.ts
new file mode 100644
index 00000000000..7753535b755
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/update-media.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient, mastodonUtils } from '../common/client';
+import { mediaAttachmentOutputSchema } from '../output-schemas';
+
+export const updateMedia = createAction({
+ auth: mastodonAuth,
+ name: 'update_media',
+ classification: 'WRITE',
+ displayName: 'Update Media',
+ description: 'Change the alt text or focal point of an uploaded media file.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates the alt text and/or focal point of an uploaded media attachment before it is posted; only the fields you set are sent. Only works for media not yet attached to a status; to change media on a published post use Edit Status. Setting the same values again converges, so it is safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: mediaAttachmentOutputSchema,
+ props: {
+ media_id: Property.ShortText({
+ displayName: 'Media ID',
+ description: 'ID of the unattached media. Obtain it from Upload Media.',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Alt Text',
+ description: 'New plain-text description of the media for accessibility.',
+ required: false,
+ }),
+ focus: Property.ShortText({
+ displayName: 'Focal Point',
+ description:
+ 'New focal point as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { media_id, description, focus } = context.propsValue;
+ const body = {
+ ...(mastodonUtils.hasValue(description) ? { description } : {}),
+ ...(mastodonUtils.hasValue(focus) ? { focus } : {}),
+ };
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set Alt Text or Focal Point; there is nothing to update.');
+ }
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.PUT,
+ path: `/api/v1/media/${encodeURIComponent(media_id)}`,
+ operation: 'Update Media',
+ scope: 'write:media',
+ notFoundMessage:
+ 'Mastodon could not find this media. Update Media only works for media not yet attached to a status; to change media on a published post use Edit Status.',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/update-my-profile.ts b/packages/pieces/community/mastodon/src/lib/actions/update-my-profile.ts
new file mode 100644
index 00000000000..ce19190889a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/update-my-profile.ts
@@ -0,0 +1,97 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import {
+ MastodonEntity,
+ mastodonClient,
+ mastodonProps,
+ mastodonUtils,
+} from '../common/client';
+import { myAccountOutputSchema } from '../output-schemas';
+
+export const updateMyProfile = createAction({
+ auth: mastodonAuth,
+ name: 'update_my_profile',
+ classification: 'WRITE',
+ displayName: 'Update My Profile',
+ description: 'Update the display name, bio and settings of the connected account.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Updates the connected account\'s public profile and posting defaults; only the fields you set change, the rest stay as they are. Profile metadata fields, avatar and header are not handled here. Changes are visible to everyone who views the profile. Setting the same values again converges, so it is safe to retry.',
+ idempotent: true,
+ },
+ outputSchema: myAccountOutputSchema,
+ props: {
+ display_name: Property.ShortText({
+ displayName: 'Display Name',
+ description: 'New display name shown on the profile. Leave empty to keep the current display name.',
+ required: false,
+ }),
+ note: Property.LongText({
+ displayName: 'Bio',
+ description: 'New profile bio text. Leave empty to keep the current bio.',
+ required: false,
+ }),
+ locked: mastodonProps.optionalBoolean({
+ displayName: 'Require Follow Approval',
+ description: 'Whether new followers must be approved manually. Leave empty to keep the current setting.',
+ }),
+ bot: mastodonProps.optionalBoolean({
+ displayName: 'Bot Account',
+ description: 'Whether the profile is flagged as an automated (bot) account. Leave empty to keep the current setting.',
+ }),
+ discoverable: mastodonProps.optionalBoolean({
+ displayName: 'Discoverable',
+ description: 'Whether the account is featured in the profile directory. Leave empty to keep the current setting.',
+ }),
+ default_visibility: Property.StaticDropdown({
+ displayName: 'Default Post Visibility',
+ description: 'Default privacy for new posts. Leave empty to keep the current setting.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Public', value: 'public' },
+ { label: 'Unlisted', value: 'unlisted' },
+ { label: 'Followers only', value: 'private' },
+ ],
+ },
+ }),
+ default_language: Property.ShortText({
+ displayName: 'Default Post Language',
+ description: 'Default ISO 639-1 language code for new posts, for example en.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const props = context.propsValue;
+ const source = {
+ ...(mastodonUtils.hasValue(props.default_visibility)
+ ? { privacy: props.default_visibility }
+ : {}),
+ ...(mastodonUtils.hasValue(props.default_language)
+ ? { language: props.default_language }
+ : {}),
+ };
+ const body = {
+ ...(mastodonUtils.hasValue(props.display_name) ? { display_name: props.display_name } : {}),
+ ...(mastodonUtils.hasValue(props.note) ? { note: props.note } : {}),
+ ...(props.locked !== undefined ? { locked: props.locked } : {}),
+ ...(props.bot !== undefined ? { bot: props.bot } : {}),
+ ...(props.discoverable !== undefined ? { discoverable: props.discoverable } : {}),
+ ...(Object.keys(source).length > 0 ? { source } : {}),
+ };
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set at least one profile field to update.');
+ }
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.PATCH,
+ path: '/api/v1/accounts/update_credentials',
+ operation: 'Update My Profile',
+ scope: 'write:accounts',
+ body,
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/actions/upload-media.ts b/packages/pieces/community/mastodon/src/lib/actions/upload-media.ts
new file mode 100644
index 00000000000..ad6ff2b08e4
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/upload-media.ts
@@ -0,0 +1,75 @@
+import FormData from 'form-data';
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { mastodonClient, mastodonUtils } from '../common/client';
+import { mappedMediaOutputSchema } from '../output-schemas';
+
+export const uploadMedia = createAction({
+ auth: mastodonAuth,
+ name: 'upload_media',
+ classification: 'WRITE',
+ displayName: 'Upload Media',
+ description: 'Upload an image, video or audio file to attach to a status.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Uploads a media file and returns its ID to pass as Media IDs to Create Status, Schedule Status or Edit Status. Large video and audio are processed asynchronously: when processing is true the url is still null, so call Get Media until url is non-null before attaching it. Unattached uploads expire after a while. Each call uploads a new file.',
+ idempotent: false,
+ },
+ outputSchema: mappedMediaOutputSchema,
+ props: {
+ file: Property.File({
+ displayName: 'File',
+ description: 'The image, video or audio file to upload.',
+ required: true,
+ }),
+ description: Property.LongText({
+ displayName: 'Alt Text',
+ description: 'Plain-text description of the media for accessibility (alt text).',
+ required: false,
+ }),
+ focus: Property.ShortText({
+ displayName: 'Focal Point',
+ description:
+ 'Focal point for thumbnail cropping as two comma-separated numbers from -1.0 to 1.0, for example 0.0,0.5.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { file, description, focus } = context.propsValue;
+ const form = new FormData();
+ form.append('file', file.data, file.filename);
+ if (mastodonUtils.hasValue(description)) {
+ form.append('description', String(description));
+ }
+ if (mastodonUtils.hasValue(focus)) {
+ form.append('focus', String(focus));
+ }
+ const response = await mastodonClient.sendRequest<MediaAttachment>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: '/api/v2/media',
+ operation: 'Upload Media',
+ scope: 'write:media',
+ body: form,
+ });
+ const media = response.body;
+ return {
+ id: media.id,
+ type: media.type,
+ url: media.url ?? null,
+ preview_url: media.preview_url ?? null,
+ description: media.description ?? null,
+ processing: response.status === 202,
+ };
+ },
+});
+
+type MediaAttachment = {
+ id: string;
+ type: string;
+ url: string | null;
+ preview_url: string | null;
+ description: string | null;
+};
diff --git a/packages/pieces/community/mastodon/src/lib/actions/vote-in-poll.ts b/packages/pieces/community/mastodon/src/lib/actions/vote-in-poll.ts
new file mode 100644
index 00000000000..63fe656d8cb
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/actions/vote-in-poll.ts
@@ -0,0 +1,50 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { HttpMethod } from '@activepieces/pieces-common';
+import { mastodonAuth } from '../..';
+import { MastodonEntity, mastodonClient } from '../common/client';
+import { pollOutputSchema } from '../output-schemas';
+
+export const voteInPoll = createAction({
+ auth: mastodonAuth,
+ name: 'vote_in_poll',
+ classification: 'WRITE',
+ displayName: 'Vote in Poll',
+ description: 'Cast a vote in a poll.',
+ audience: 'ai',
+ aiMetadata: {
+ description:
+ 'Casts the connected account\'s vote in a poll using 0-based option indexes (read the options with Get Poll or Get Status). Pass several indexes only when the poll allows multiple choices. A vote cannot be changed: voting again or voting in an expired poll is rejected, so do not retry. Returns the updated poll.',
+ idempotent: false,
+ },
+ outputSchema: pollOutputSchema,
+ props: {
+ poll_id: Property.ShortText({
+ displayName: 'Poll ID',
+ description: 'ID of the poll (the poll.id field of a status). Obtain it from Get Status or a timeline.',
+ required: true,
+ }),
+ choices: Property.Array({
+ displayName: 'Choices',
+ description:
+ '0-based index of each option to vote for, one per item; for example 0 for the first option.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { poll_id, choices } = context.propsValue;
+ const indexes = choices
+ .map((choice) => (typeof choice === 'number' ? choice : Number(String(choice).trim())))
+ .filter((choice) => Number.isInteger(choice) && choice >= 0);
+ if (indexes.length === 0 || indexes.length !== choices.length) {
+ throw new Error('Choices must be 0-based option indexes such as 0 or 1.');
+ }
+ return mastodonClient.request<MastodonEntity>({
+ auth: context.auth.props,
+ method: HttpMethod.POST,
+ path: `/api/v1/polls/${encodeURIComponent(poll_id)}/votes`,
+ operation: 'Vote in Poll',
+ scope: 'write:statuses',
+ body: { choices: indexes },
+ });
+ },
+});
diff --git a/packages/pieces/community/mastodon/src/lib/common/client.ts b/packages/pieces/community/mastodon/src/lib/common/client.ts
new file mode 100644
index 00000000000..4caf24d984a
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/common/client.ts
@@ -0,0 +1,534 @@
+import {
+ AuthenticationType,
+ httpClient,
+ HttpError,
+ HttpHeaders,
+ HttpMethod,
+ HttpResponse,
+} from '@activepieces/pieces-common';
+import { Property } from '@activepieces/pieces-framework';
+
+const RATE_LIMIT_GUIDANCE =
+ 'Mastodon allows about 300 requests per 5 minutes per account by default (media uploads 30 per 30 minutes; status deletes and unboosts 30 per 30 minutes combined), and instances can tune these limits. Wait a few minutes before retrying.';
+
+const SCOPE_GUIDANCE =
+ 'In Mastodon, open Preferences > Development, select the application, tick the top-level read and write scopes and save. Saving regenerates the access token, so paste the new token into this Activepieces connection.';
+
+const MIN_SCHEDULE_AHEAD_MS = 5 * 60 * 1000;
+const SCHEDULE_SAFETY_MARGIN_MS = 60 * 1000;
+
+const NOTIFICATION_TYPE_OPTIONS = [
+ { label: 'Mention', value: 'mention' },
+ { label: 'New post from an account you enabled notifications for', value: 'status' },
+ { label: 'Boost', value: 'reblog' },
+ { label: 'Follow', value: 'follow' },
+ { label: 'Follow request', value: 'follow_request' },
+ { label: 'Favourite', value: 'favourite' },
+ { label: 'Poll ended', value: 'poll' },
+ { label: 'Boosted post edited', value: 'update' },
+ { label: 'Quote', value: 'quote' },
+ { label: 'Quoted post edited', value: 'quoted_update' },
+ { label: 'Relationships severed', value: 'severed_relationships' },
+ { label: 'Moderation warning', value: 'moderation_warning' },
+ { label: 'Admin: new sign-up', value: 'admin.sign_up' },
+ { label: 'Admin: new report', value: 'admin.report' },
+];
+
+function getBaseUrl(auth: MastodonConnection): string {
+ return auth.base_url.replace(/\/$/, '');
+}
+
+function buildQueryString(query: MastodonQuery | undefined): string {
+ if (query === undefined) {
+ return '';
+ }
+ const params = new URLSearchParams();
+ for (const [key, value] of Object.entries(query)) {
+ if (value === undefined || value === null || value === '') {
+ continue;
+ }
+ if (Array.isArray(value)) {
+ for (const item of value) {
+ params.append(`${key}[]`, item);
+ }
+ continue;
+ }
+ params.append(key, String(value));
+ }
+ const queryString = params.toString();
+ return queryString === '' ? '' : `?${queryString}`;
+}
+
+function extractVendorError(body: unknown): string | undefined {
+ if (typeof body === 'string' && body.trim() !== '') {
+ return body;
+ }
+ if (typeof body === 'object' && body !== null) {
+ if ('error' in body && typeof body.error === 'string') {
+ return body.error;
+ }
+ if ('error_description' in body && typeof body.error_description === 'string') {
+ return body.error_description;
+ }
+ }
+ return undefined;
+}
+
+function describeFailure({
+ status,
+ body,
+ operation,
+ scope,
+ minVersion,
+ notFoundMessage,
+}: {
+ status: number;
+ body: unknown;
+ operation: string;
+ scope?: string;
+ minVersion?: string;
+ notFoundMessage?: string;
+}): string {
+ const vendorError = extractVendorError(body);
+ const vendorSuffix = vendorError === undefined ? '' : ` Mastodon said: "${vendorError}".`;
+ switch (status) {
+ case 401:
+ return `Mastodon rejected the access token while running ${operation}: it is invalid or has been revoked. Create a new access token under Preferences > Development and update the connection.${vendorSuffix}`;
+ case 403: {
+ const isScopeError =
+ vendorError === undefined || /authorized scopes|scope/i.test(vendorError);
+ if (isScopeError && scope !== undefined) {
+ return `Mastodon refused ${operation} because the connection's access token lacks the "${scope}" scope.${vendorSuffix} ${SCOPE_GUIDANCE}`;
+ }
+ return `Mastodon refused ${operation}: the connected account is not allowed to perform this action on this resource.${vendorSuffix}`;
+ }
+ case 404: {
+ if (notFoundMessage !== undefined) {
+ return `${notFoundMessage}${vendorSuffix}`;
+ }
+ const versionHint =
+ minVersion === undefined
+ ? ''
+ : ` This endpoint requires Mastodon ${minVersion} or later; use Get Instance Info to check the server version.`;
+ return `Mastodon could not find the resource for ${operation}. It may not exist, may not be visible to the connected account, or the server may not support this endpoint.${versionHint}${vendorSuffix}`;
+ }
+ case 422:
+ return `Mastodon rejected ${operation}: ${vendorError ?? 'the request was invalid'}.`;
+ case 429:
+ return `Mastodon rate limit reached while running ${operation}. ${RATE_LIMIT_GUIDANCE}`;
+ default:
+ return `Mastodon returned HTTP ${status} for ${operation}.${vendorSuffix}`;
+ }
+}
+
+async function sendRequest<T>({
+ auth,
+ method,
+ path,
+ query,
+ body,
+ headers,
+ operation,
+ scope,
+ minVersion,
+ notFoundMessage,
+}: MastodonRequestParams): Promise<HttpResponse<T>> {
+ try {
+ return await httpClient.sendRequest<T>({
+ method,
+ url: `${getBaseUrl(auth)}${path}${buildQueryString(query)}`,
+ authentication: {
+ type: AuthenticationType.BEARER_TOKEN,
+ token: auth.access_token,
+ },
+ headers,
+ body,
+ });
+ } catch (error) {
+ if (error instanceof HttpError) {
+ const status = error.response.status;
+ throw new MastodonApiError({
+ status,
+ message: describeFailure({
+ status,
+ body: error.response.body,
+ operation,
+ scope,
+ minVersion,
+ notFoundMessage,
+ }),
+ });
+ }
+ throw error;
+ }
+}
+
+async function request<T>(params: MastodonRequestParams): Promise<T> {
+ const response = await sendRequest<T>(params);
+ return response.body;
+}
+
+function readLinkHeader(headers: HttpHeaders | undefined): string | undefined {
+ if (headers === undefined) {
+ return undefined;
+ }
+ for (const [key, value] of Object.entries(headers)) {
+ if (key.toLowerCase() !== 'link' || value === undefined) {
+ continue;
+ }
+ return Array.isArray(value) ? value.join(', ') : value;
+ }
+ return undefined;
+}
+
+function parseLinkHeader(headers: HttpHeaders | undefined): MastodonCursors {
+ const cursors: MastodonCursors = {
+ next_max_id: null,
+ prev_min_id: null,
+ prev_since_id: null,
+ };
+ const linkHeader = readLinkHeader(headers);
+ if (linkHeader === undefined) {
+ return cursors;
+ }
+ const linkPattern = /<([^>]+)>\s*;\s*rel="([^"]+)"/g;
+ for (const match of linkHeader.matchAll(linkPattern)) {
+ const url = safeParseUrl(match[1]);
+ if (url === null) {
+ continue;
+ }
+ const rel = match[2];
+ if (rel === 'next') {
+ cursors.next_max_id = url.searchParams.get('max_id');
+ }
+ if (rel === 'prev') {
+ cursors.prev_min_id = url.searchParams.get('min_id');
+ cursors.prev_since_id = url.searchParams.get('since_id');
+ }
+ }
+ return cursors;
+}
+
+function safeParseUrl(value: string): URL | null {
+ try {
+ return new URL(value);
+ } catch {
+ return null;
+ }
+}
+
+async function requestPage<T>(params: MastodonRequestParams): Promise<MastodonPage<T>> {
+ const response = await sendRequest<T[]>(params);
+ const items = Array.isArray(response.body) ? response.body : [];
+ return {
+ items,
+ count: items.length,
+ ...parseLinkHeader(response.headers),
+ };
+}
+
+function toStringArray(value: unknown[] | undefined): string[] | undefined {
+ if (value === undefined) {
+ return undefined;
+ }
+ const items = value
+ .filter((item) => typeof item === 'string' || typeof item === 'number')
+ .map((item) => String(item).trim())
+ .filter((item) => item !== '');
+ return items.length === 0 ? undefined : items;
+}
+
+function hasValue(value: unknown): boolean {
+ return value !== undefined && value !== null && value !== '';
+}
+
+function optionalBooleanProp({
+ displayName,
+ description,
+}: {
+ displayName: string;
+ description: string;
+}) {
+ return Property.StaticDropdown<boolean>({
+ displayName,
+ description,
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Yes', value: true },
+ { label: 'No', value: false },
+ ],
+ },
+ });
+}
+
+function limitProp({
+ noun,
+ defaultLimit,
+ maxLimit,
+}: {
+ noun: string;
+ defaultLimit: number;
+ maxLimit: number;
+}) {
+ return Property.Number({
+ displayName: 'Limit',
+ description: `Maximum number of ${noun} to return in this page. Defaults to ${defaultLimit}, maximum ${maxLimit}.`,
+ required: false,
+ });
+}
+
+function notificationTypesProp({
+ displayName,
+ description,
+}: {
+ displayName: string;
+ description: string;
+}) {
+ return Property.StaticMultiSelectDropdown({
+ displayName,
+ description,
+ required: false,
+ options: { disabled: false, options: NOTIFICATION_TYPE_OPTIONS },
+ });
+}
+
+function maxIdProp() {
+ return Property.ShortText({
+ displayName: 'Max ID (older page)',
+ description:
+ 'Cursor for the next (older) page. Pass the `next_max_id` value from the previous page of this same action. Leave empty for the newest page.',
+ required: false,
+ });
+}
+
+function sinceIdProp() {
+ return Property.ShortText({
+ displayName: 'Since ID (newer results)',
+ description:
+ 'Cursor for newer results. Pass the `prev_since_id` value from a previous page of this same action to page back towards newer items.',
+ required: false,
+ });
+}
+
+function minIdProp() {
+ return Property.ShortText({
+ displayName: 'Min ID (newer page)',
+ description:
+ 'Cursor for the page immediately newer than a previous page. Pass the `prev_min_id` value from a previous page of this same action.',
+ required: false,
+ });
+}
+
+function assertScheduledAt(scheduledAt: string): string {
+ const scheduledTime = new Date(scheduledAt).getTime();
+ if (Number.isNaN(scheduledTime)) {
+ throw new Error(
+ `Scheduled At must be an ISO 8601 date-time such as 2026-10-01T09:30:00Z, got "${scheduledAt}".`
+ );
+ }
+ if (scheduledTime - Date.now() < MIN_SCHEDULE_AHEAD_MS + SCHEDULE_SAFETY_MARGIN_MS) {
+ throw new Error(
+ 'Scheduled At must be at least 6 minutes in the future; Mastodon rejects anything under 5 minutes, and the extra minute absorbs clock skew.'
+ );
+ }
+ return new Date(scheduledTime).toISOString();
+}
+
+function buildComposeBody({
+ status,
+ visibility,
+ inReplyToId,
+ spoilerText,
+ sensitive,
+ language,
+ mediaIds,
+ pollOptions,
+ pollExpiresIn,
+ pollMultiple,
+}: ComposeInput): Record<string, unknown> {
+ const hasMedia = mediaIds !== undefined && mediaIds.length > 0;
+ const hasPoll = pollOptions !== undefined && pollOptions.length > 0;
+ const hasText = status !== undefined && status.trim() !== '';
+ if (!hasText && !hasMedia) {
+ throw new Error('Provide the status text, or at least one Media ID to post media without text.');
+ }
+ if (hasMedia && hasPoll) {
+ throw new Error(
+ 'A status cannot have both media and a poll. Remove the Media IDs or the Poll Options.'
+ );
+ }
+ if (hasPoll && (pollExpiresIn === undefined || pollExpiresIn === null)) {
+ throw new Error('Poll Duration (seconds) is required when Poll Options are provided.');
+ }
+ const hasPollSettings =
+ (pollExpiresIn !== undefined && pollExpiresIn !== null) || pollMultiple !== undefined;
+ if (!hasPoll && hasPollSettings) {
+ throw new Error('Poll Duration and Allow Multiple Choices only apply when Poll Options are provided.');
+ }
+ return {
+ ...(hasText ? { status } : {}),
+ ...(hasValue(visibility) ? { visibility } : {}),
+ ...(hasValue(inReplyToId) ? { in_reply_to_id: inReplyToId } : {}),
+ ...(hasValue(spoilerText) ? { spoiler_text: spoilerText } : {}),
+ ...(sensitive !== undefined ? { sensitive } : {}),
+ ...(hasValue(language) ? { language } : {}),
+ ...(hasMedia ? { media_ids: mediaIds } : {}),
+ ...(hasPoll
+ ? {
+ poll: {
+ options: pollOptions,
+ expires_in: pollExpiresIn,
+ ...(pollMultiple !== undefined ? { multiple: pollMultiple } : {}),
+ },
+ }
+ : {}),
+ };
+}
+
+function composeProps() {
+ return {
+ status: Property.LongText({
+ displayName: 'Status Text',
+ description:
+ 'The text of the post. Mentions (@user@domain), hashtags and links are parsed by Mastodon. Required unless Media IDs are provided. Use Get Instance Info to read the server character limit (500 by default).',
+ required: false,
+ }),
+ visibility: Property.StaticDropdown({
+ displayName: 'Visibility',
+ description:
+ 'Who can see the post. Leave empty to use the account default posting privacy.',
+ required: false,
+ options: {
+ disabled: false,
+ options: [
+ { label: 'Public', value: 'public' },
+ { label: 'Unlisted (public, hidden from public timelines)', value: 'unlisted' },
+ { label: 'Followers only', value: 'private' },
+ { label: 'Direct (mentioned accounts only)', value: 'direct' },
+ ],
+ },
+ }),
+ in_reply_to_id: Property.ShortText({
+ displayName: 'In Reply To (Status ID)',
+ description:
+ 'Local ID of the status to reply to, for example 109372843234737004. Obtain it from Get Status, a timeline or Search (with resolve for remote URLs).',
+ required: false,
+ }),
+ spoiler_text: Property.ShortText({
+ displayName: 'Content Warning',
+ description: 'Optional content warning shown before the post text.',
+ required: false,
+ }),
+ sensitive: optionalBooleanProp({
+ displayName: 'Mark Media as Sensitive',
+ description: 'Whether attached media should be hidden behind a sensitive-content warning. Leave empty for the account default.',
+ }),
+ language: Property.ShortText({
+ displayName: 'Language',
+ description: 'ISO 639-1 two-letter language code of the post, for example en or de.',
+ required: false,
+ }),
+ media_ids: Property.Array({
+ displayName: 'Media IDs',
+ description:
+ 'IDs of media returned by Upload Media, one per item (up to the server limit, 4 by default). Cannot be combined with a poll.',
+ required: false,
+ }),
+ poll_options: Property.Array({
+ displayName: 'Poll Options',
+ description:
+ 'Answer choices for a poll, one per item (2 to 4 on most servers). Cannot be combined with media.',
+ required: false,
+ }),
+ poll_expires_in: Property.Number({
+ displayName: 'Poll Duration (seconds)',
+ description:
+ 'How long the poll stays open, in seconds. Mastodon accepts 300 (5 minutes) to 2629746 (1 month). Required with Poll Options.',
+ required: false,
+ }),
+ poll_multiple: optionalBooleanProp({
+ displayName: 'Allow Multiple Choices',
+ description: 'Whether voters may pick more than one option. Leave empty for single choice.',
+ }),
+ };
+}
+
+export class MastodonApiError extends Error {
+ public readonly status: number;
+
+ constructor({ status, message }: { status: number; message: string }) {
+ super(message);
+ this.name = 'MastodonApiError';
+ this.status = status;
+ }
+}
+
+export const mastodonClient = { sendRequest, request, requestPage };
+
+export const mastodonProps = {
+ optionalBoolean: optionalBooleanProp,
+ limit: limitProp,
+ notificationTypes: notificationTypesProp,
+ maxId: maxIdProp,
+ sinceId: sinceIdProp,
+ minId: minIdProp,
+ compose: composeProps,
+};
+
+export const mastodonUtils = {
+ toStringArray,
+ hasValue,
+ assertScheduledAt,
+ buildComposeBody,
+};
+
+export type MastodonConnection = {
+ base_url: string;
+ access_token: string;
+};
+
+export type MastodonQuery = Record<
+ string,
+ string | number | boolean | string[] | undefined | null
+>;
+
+export type MastodonRequestParams = {
+ auth: MastodonConnection;
+ method: HttpMethod;
+ path: string;
+ operation: string;
+ scope?: string;
+ minVersion?: string;
+ notFoundMessage?: string;
+ query?: MastodonQuery;
+ body?: unknown;
+ headers?: Record<string, string>;
+};
+
+export type MastodonCursors = {
+ next_max_id: string | null;
+ prev_min_id: string | null;
+ prev_since_id: string | null;
+};
+
+export type MastodonPage<T> = MastodonCursors & {
+ items: T[];
+ count: number;
+};
+
+export type MastodonEntity = Record<string, unknown>;
+
+export type ComposeInput = {
+ status?: string;
+ visibility?: string;
+ inReplyToId?: string;
+ spoilerText?: string;
+ sensitive?: boolean;
+ language?: string;
+ mediaIds?: string[];
+ pollOptions?: string[];
+ pollExpiresIn?: number | null;
+ pollMultiple?: boolean;
+};
diff --git a/packages/pieces/community/mastodon/src/lib/output-schemas.ts b/packages/pieces/community/mastodon/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..a74afbe7b1b
--- /dev/null
+++ b/packages/pieces/community/mastodon/src/lib/output-schemas.ts
@@ -0,0 +1,647 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+const accountSummaryFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Account ID' },
+ { key: 'username', label: 'Username' },
+ { key: 'acct', label: 'Handle' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'url', label: 'Profile URL', format: 'url' },
+ { key: 'avatar', label: 'Avatar', format: 'image' },
+ { key: 'bot', label: 'Bot', format: 'boolean' },
+];
+
+const accountFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Account ID' },
+ { key: 'username', label: 'Username' },
+ { key: 'acct', label: 'Handle' },
+ { key: 'display_name', label: 'Display Name' },
+ { key: 'note', label: 'Bio', format: 'html' },
+ { key: 'url', label: 'Profile URL', format: 'url' },
+ { key: 'uri', label: 'ActivityPub URI', format: 'url' },
+ { key: 'avatar', label: 'Avatar', format: 'image' },
+ { key: 'header', label: 'Header Image', format: 'image' },
+ { key: 'locked', label: 'Requires Follow Approval', format: 'boolean' },
+ { key: 'bot', label: 'Bot', format: 'boolean' },
+ { key: 'group', label: 'Group', format: 'boolean' },
+ { key: 'discoverable', label: 'Discoverable', format: 'boolean' },
+ { key: 'indexable', label: 'Indexable', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'last_status_at', label: 'Last Status Date', format: 'date' },
+ { key: 'followers_count', label: 'Followers', format: 'number' },
+ { key: 'following_count', label: 'Following', format: 'number' },
+ { key: 'statuses_count', label: 'Statuses', format: 'number' },
+ {
+ key: 'fields',
+ label: 'Profile Fields',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'value', label: 'Value', format: 'html' },
+ { key: 'verified_at', label: 'Verified At', format: 'datetime' },
+ ],
+ },
+];
+
+const myAccountFields: OutputSchema['fields'] = [
+ ...accountFields,
+ {
+ key: 'source',
+ label: 'Posting Defaults',
+ children: [
+ { key: 'privacy', label: 'Default Visibility' },
+ { key: 'sensitive', label: 'Mark Media Sensitive by Default', format: 'boolean' },
+ { key: 'language', label: 'Default Language' },
+ { key: 'note', label: 'Bio (Plain Text)' },
+ { key: 'follow_requests_count', label: 'Pending Follow Requests', format: 'number' },
+ ],
+ },
+];
+
+const mediaAttachmentFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Media ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'preview_url', label: 'Preview', format: 'image' },
+ { key: 'remote_url', label: 'Remote URL', format: 'url' },
+ { key: 'description', label: 'Alt Text' },
+ {
+ key: 'meta',
+ label: 'Metadata',
+ children: [
+ {
+ key: 'original',
+ label: 'Original',
+ children: [
+ { key: 'width', label: 'Width', format: 'number' },
+ { key: 'height', label: 'Height', format: 'number' },
+ ],
+ },
+ {
+ key: 'focus',
+ label: 'Focal Point',
+ children: [
+ { key: 'x', label: 'X', format: 'number' },
+ { key: 'y', label: 'Y', format: 'number' },
+ ],
+ },
+ ],
+ },
+];
+
+const mappedMediaFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Media ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'preview_url', label: 'Preview', format: 'image' },
+ { key: 'description', label: 'Alt Text' },
+ { key: 'processing', label: 'Still Processing', format: 'boolean' },
+];
+
+const pollFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Poll ID' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+ { key: 'expired', label: 'Expired', format: 'boolean' },
+ { key: 'multiple', label: 'Multiple Choice', format: 'boolean' },
+ { key: 'votes_count', label: 'Votes', format: 'number' },
+ { key: 'voters_count', label: 'Voters', format: 'number' },
+ { key: 'voted', label: 'Voted', format: 'boolean' },
+ { key: 'own_votes', label: 'Own Votes (Option Indexes)' },
+ {
+ key: 'options',
+ label: 'Options',
+ labelKey: 'title',
+ listItems: [
+ { key: 'title', label: 'Title' },
+ { key: 'votes_count', label: 'Votes', format: 'number' },
+ ],
+ },
+];
+
+const previewCardFields: OutputSchema['fields'] = [
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'type', label: 'Type' },
+ { key: 'language', label: 'Language' },
+ { key: 'provider_name', label: 'Provider' },
+ { key: 'author_name', label: 'Author' },
+ { key: 'image', label: 'Image', format: 'image' },
+ { key: 'published_at', label: 'Published At', format: 'datetime' },
+];
+
+const usageHistoryFields: OutputSchema['fields'] = [
+ {
+ key: 'history',
+ label: 'Daily Usage',
+ labelKey: 'day',
+ listItems: [
+ { key: 'day', label: 'Day (Unix Time)' },
+ { key: 'uses', label: 'Uses' },
+ { key: 'accounts', label: 'Accounts' },
+ ],
+ },
+];
+
+const statusCoreFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Status ID' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'uri', label: 'ActivityPub URI', format: 'url' },
+ { key: 'content', label: 'Content', format: 'html' },
+ { key: 'spoiler_text', label: 'Content Warning' },
+ { key: 'sensitive', label: 'Sensitive', format: 'boolean' },
+ { key: 'visibility', label: 'Visibility' },
+ { key: 'language', label: 'Language' },
+ { key: 'in_reply_to_id', label: 'In Reply To Status ID' },
+ { key: 'in_reply_to_account_id', label: 'In Reply To Account ID' },
+ { key: 'replies_count', label: 'Replies', format: 'number' },
+ { key: 'reblogs_count', label: 'Boosts', format: 'number' },
+ { key: 'favourites_count', label: 'Favourites', format: 'number' },
+ { key: 'edited_at', label: 'Edited At', format: 'datetime' },
+ { key: 'account', label: 'Author', children: accountSummaryFields },
+ {
+ key: 'media_attachments',
+ label: 'Media Attachments',
+ labelKey: 'type',
+ listItems: mediaAttachmentFields,
+ },
+ {
+ key: 'mentions',
+ label: 'Mentions',
+ labelKey: 'acct',
+ listItems: [
+ { key: 'id', label: 'Account ID' },
+ { key: 'username', label: 'Username' },
+ { key: 'acct', label: 'Handle' },
+ { key: 'url', label: 'Profile URL', format: 'url' },
+ ],
+ },
+ {
+ key: 'tags',
+ label: 'Hashtags',
+ labelKey: 'name',
+ listItems: [
+ { key: 'name', label: 'Name' },
+ { key: 'url', label: 'URL', format: 'url' },
+ ],
+ },
+ { key: 'poll', label: 'Poll', children: pollFields },
+ { key: 'card', label: 'Link Preview', children: previewCardFields },
+];
+
+const statusFields: OutputSchema['fields'] = [
+ ...statusCoreFields,
+ { key: 'favourited', label: 'Favourited by Me', format: 'boolean' },
+ { key: 'reblogged', label: 'Boosted by Me', format: 'boolean' },
+ { key: 'bookmarked', label: 'Bookmarked by Me', format: 'boolean' },
+ { key: 'muted', label: 'Conversation Muted', format: 'boolean' },
+ { key: 'pinned', label: 'Pinned to Profile', format: 'boolean' },
+ { key: 'reblog', label: 'Boosted Status', children: statusCoreFields },
+ {
+ key: 'application',
+ label: 'Posted With',
+ children: [
+ { key: 'name', label: 'App Name' },
+ { key: 'website', label: 'App Website', format: 'url' },
+ ],
+ },
+];
+
+const deletedStatusFields: OutputSchema['fields'] = [
+ ...statusFields.filter((field) => field.key !== 'content'),
+ { key: 'text', label: 'Source Text (for Redraft)' },
+];
+
+const tagFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Tag ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'following', label: 'Followed by Me', format: 'boolean' },
+ { key: 'featuring', label: 'Featured on Profile', format: 'boolean' },
+ ...usageHistoryFields,
+];
+
+const trendingLinkFields: OutputSchema['fields'] = [...previewCardFields, ...usageHistoryFields];
+
+const listFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'List ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'replies_policy', label: 'Replies Policy' },
+ { key: 'exclusive', label: 'Exclusive', format: 'boolean' },
+];
+
+const filterFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Filter ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'context', label: 'Contexts' },
+ { key: 'filter_action', label: 'Action' },
+ { key: 'expires_at', label: 'Expires At', format: 'datetime' },
+ {
+ key: 'keywords',
+ label: 'Keywords',
+ labelKey: 'keyword',
+ listItems: [
+ { key: 'id', label: 'Keyword ID' },
+ { key: 'keyword', label: 'Keyword' },
+ { key: 'whole_word', label: 'Whole Word', format: 'boolean' },
+ ],
+ },
+];
+
+const scheduledStatusFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Scheduled Status ID' },
+ { key: 'scheduled_at', label: 'Scheduled At', format: 'datetime' },
+ {
+ key: 'params',
+ label: 'Status Parameters',
+ children: [
+ { key: 'text', label: 'Text' },
+ { key: 'visibility', label: 'Visibility' },
+ { key: 'spoiler_text', label: 'Content Warning' },
+ { key: 'sensitive', label: 'Sensitive', format: 'boolean' },
+ { key: 'language', label: 'Language' },
+ { key: 'in_reply_to_id', label: 'In Reply To Status ID' },
+ { key: 'media_ids', label: 'Media IDs' },
+ ],
+ },
+ {
+ key: 'media_attachments',
+ label: 'Media Attachments',
+ labelKey: 'type',
+ listItems: mediaAttachmentFields,
+ },
+];
+
+const instanceFields: OutputSchema['fields'] = [
+ { key: 'domain', label: 'Domain' },
+ { key: 'title', label: 'Title' },
+ { key: 'version', label: 'Mastodon Version' },
+ { key: 'description', label: 'Description' },
+ { key: 'source_url', label: 'Source Code URL', format: 'url' },
+ { key: 'languages', label: 'Languages' },
+ {
+ key: 'usage',
+ label: 'Usage',
+ children: [
+ {
+ key: 'users',
+ label: 'Users',
+ children: [{ key: 'active_month', label: 'Monthly Active Users', format: 'number' }],
+ },
+ ],
+ },
+ {
+ key: 'thumbnail',
+ label: 'Thumbnail',
+ children: [{ key: 'url', label: 'URL', format: 'image' }],
+ },
+ {
+ key: 'configuration',
+ label: 'Configuration',
+ children: [
+ {
+ key: 'statuses',
+ label: 'Statuses',
+ children: [
+ { key: 'max_characters', label: 'Max Characters', format: 'number' },
+ { key: 'max_media_attachments', label: 'Max Media Attachments', format: 'number' },
+ { key: 'characters_reserved_per_url', label: 'Characters per URL', format: 'number' },
+ ],
+ },
+ {
+ key: 'media_attachments',
+ label: 'Media Attachments',
+ children: [
+ { key: 'image_size_limit', label: 'Image Size Limit', format: 'filesize' },
+ { key: 'video_size_limit', label: 'Video Size Limit', format: 'filesize' },
+ { key: 'description_limit', label: 'Alt Text Limit', format: 'number' },
+ { key: 'supported_mime_types', label: 'Supported MIME Types' },
+ ],
+ },
+ {
+ key: 'polls',
+ label: 'Polls',
+ children: [
+ { key: 'max_options', label: 'Max Options', format: 'number' },
+ { key: 'max_characters_per_option', label: 'Max Characters per Option', format: 'number' },
+ { key: 'min_expiration', label: 'Min Duration (Seconds)', format: 'number' },
+ { key: 'max_expiration', label: 'Max Duration (Seconds)', format: 'number' },
+ ],
+ },
+ {
+ key: 'translation',
+ label: 'Translation',
+ children: [{ key: 'enabled', label: 'Enabled', format: 'boolean' }],
+ },
+ ],
+ },
+ {
+ key: 'registrations',
+ label: 'Registrations',
+ children: [
+ { key: 'enabled', label: 'Open', format: 'boolean' },
+ { key: 'approval_required', label: 'Approval Required', format: 'boolean' },
+ { key: 'min_age', label: 'Minimum Age', format: 'number' },
+ ],
+ },
+ {
+ key: 'contact',
+ label: 'Contact',
+ children: [
+ { key: 'email', label: 'Email', format: 'email' },
+ { key: 'account', label: 'Account', children: accountSummaryFields },
+ ],
+ },
+ {
+ key: 'rules',
+ label: 'Rules',
+ labelKey: 'text',
+ listItems: [
+ { key: 'id', label: 'Rule ID' },
+ { key: 'text', label: 'Text' },
+ { key: 'hint', label: 'Hint' },
+ ],
+ },
+];
+
+const relationshipFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Account ID' },
+ { key: 'following', label: 'Following', format: 'boolean' },
+ { key: 'followed_by', label: 'Follows You', format: 'boolean' },
+ { key: 'requested', label: 'Follow Request Pending', format: 'boolean' },
+ { key: 'requested_by', label: 'Has Requested to Follow You', format: 'boolean' },
+ { key: 'showing_reblogs', label: 'Showing Their Boosts', format: 'boolean' },
+ { key: 'notifying', label: 'Notified of Their Posts', format: 'boolean' },
+ { key: 'languages', label: 'Language Filter' },
+ { key: 'blocking', label: 'Blocking', format: 'boolean' },
+ { key: 'blocked_by', label: 'Blocked by Them', format: 'boolean' },
+ { key: 'muting', label: 'Muting', format: 'boolean' },
+ { key: 'muting_notifications', label: 'Muting Their Notifications', format: 'boolean' },
+ { key: 'muting_expires_at', label: 'Mute Expires At', format: 'datetime' },
+ { key: 'domain_blocking', label: 'Blocking Their Domain', format: 'boolean' },
+ { key: 'endorsed', label: 'Featured on Profile', format: 'boolean' },
+ { key: 'note', label: 'Private Note' },
+];
+
+const mutedAccountFields: OutputSchema['fields'] = [
+ ...accountFields,
+ { key: 'mute_expires_at', label: 'Mute Expires At', format: 'datetime' },
+];
+
+const notificationFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Notification ID' },
+ { key: 'type', label: 'Type' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'group_key', label: 'Group Key' },
+ { key: 'account', label: 'From Account', children: accountSummaryFields },
+ { key: 'status', label: 'Related Status', children: statusFields },
+];
+
+const conversationFields: OutputSchema['fields'] = [
+ { key: 'id', label: 'Conversation ID' },
+ { key: 'unread', label: 'Unread', format: 'boolean' },
+ {
+ key: 'accounts',
+ label: 'Participants',
+ labelKey: 'acct',
+ listItems: accountSummaryFields,
+ },
+ { key: 'last_status', label: 'Last Status', children: statusFields },
+];
+
+const acknowledgementFields: OutputSchema['fields'] = [
+ { key: 'success', label: 'Success', format: 'boolean' },
+];
+
+function pageSchema({
+ itemsKey,
+ label,
+ items,
+ labelKey,
+}: {
+ itemsKey: string;
+ label: string;
+ items: OutputSchema['fields'];
+ labelKey: string;
+}): OutputSchema {
+ return {
+ fields: [
+ { key: itemsKey, label, labelKey, listItems: items },
+ { key: 'count', label: 'Count', format: 'number' },
+ { key: 'next_max_id', label: 'Next Page Cursor (max_id)' },
+ { key: 'prev_min_id', label: 'Previous Page Cursor (min_id)' },
+ { key: 'prev_since_id', label: 'Previous Page Cursor (since_id)' },
+ ],
+ };
+}
+
+function countedListSchema({
+ itemsKey,
+ label,
+ items,
+ labelKey,
+}: {
+ itemsKey: string;
+ label: string;
+ items: OutputSchema['fields'];
+ labelKey: string;
+}): OutputSchema {
+ return {
+ fields: [
+ { key: itemsKey, label, labelKey, listItems: items },
+ { key: 'count', label: 'Count', format: 'number' },
+ ],
+ };
+}
+
+function acknowledgementSchema({ idKey, idLabel }: { idKey: string; idLabel: string }): OutputSchema {
+ return {
+ fields: [...acknowledgementFields, { key: idKey, label: idLabel }],
+ };
+}
+
+export const statusOutputSchema: OutputSchema = { fields: statusFields };
+
+export const deletedStatusOutputSchema: OutputSchema = { fields: deletedStatusFields };
+
+export const statusContextOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'ancestors', label: 'Ancestors', labelKey: 'url', listItems: statusFields },
+ { key: 'descendants', label: 'Replies', labelKey: 'url', listItems: statusFields },
+ ],
+};
+
+export const statusPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'statuses',
+ label: 'Statuses',
+ items: statusFields,
+ labelKey: 'url',
+});
+
+export const trendingStatusesOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'statuses',
+ label: 'Trending Statuses',
+ items: statusFields,
+ labelKey: 'url',
+});
+
+export const accountOutputSchema: OutputSchema = { fields: accountFields };
+
+export const myAccountOutputSchema: OutputSchema = { fields: myAccountFields };
+
+export const accountPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'accounts',
+ label: 'Accounts',
+ items: accountFields,
+ labelKey: 'acct',
+});
+
+export const searchAccountsOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'accounts',
+ label: 'Accounts',
+ items: accountFields,
+ labelKey: 'acct',
+});
+
+export const searchOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'accounts', label: 'Accounts', labelKey: 'acct', listItems: accountFields },
+ { key: 'statuses', label: 'Statuses', labelKey: 'url', listItems: statusFields },
+ { key: 'hashtags', label: 'Hashtags', labelKey: 'name', listItems: tagFields },
+ ],
+};
+
+export const scheduledStatusOutputSchema: OutputSchema = { fields: scheduledStatusFields };
+
+export const scheduledStatusPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'scheduled_statuses',
+ label: 'Scheduled Statuses',
+ items: scheduledStatusFields,
+ labelKey: 'scheduled_at',
+});
+
+export const mappedMediaOutputSchema: OutputSchema = { fields: mappedMediaFields };
+
+export const mediaAttachmentOutputSchema: OutputSchema = { fields: mediaAttachmentFields };
+
+export const pollOutputSchema: OutputSchema = { fields: pollFields };
+
+export const tagOutputSchema: OutputSchema = { fields: tagFields };
+
+export const tagPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'tags',
+ label: 'Hashtags',
+ items: tagFields,
+ labelKey: 'name',
+});
+
+export const trendingTagsOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'tags',
+ label: 'Trending Hashtags',
+ items: tagFields,
+ labelKey: 'name',
+});
+
+export const trendingLinksOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'links',
+ label: 'Trending Links',
+ items: trendingLinkFields,
+ labelKey: 'title',
+});
+
+export const listOutputSchema: OutputSchema = { fields: listFields };
+
+export const listsOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'lists',
+ label: 'Lists',
+ items: listFields,
+ labelKey: 'title',
+});
+
+export const filterOutputSchema: OutputSchema = { fields: filterFields };
+
+export const filtersOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'filters',
+ label: 'Filters',
+ items: filterFields,
+ labelKey: 'title',
+});
+
+export const unreadNotificationCountOutputSchema: OutputSchema = {
+ fields: [{ key: 'count', label: 'Unread Notifications', format: 'number' }],
+};
+
+export const instanceOutputSchema: OutputSchema = { fields: instanceFields };
+
+export const cancelledScheduledStatusOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'scheduled_status_id',
+ idLabel: 'Cancelled Scheduled Status ID',
+});
+
+export const deletedMediaOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'media_id',
+ idLabel: 'Deleted Media ID',
+});
+
+export const deletedFilterOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'filter_id',
+ idLabel: 'Deleted Filter ID',
+});
+
+export const listAcknowledgementOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'list_id',
+ idLabel: 'List ID',
+});
+
+export const dismissedNotificationOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'notification_id',
+ idLabel: 'Dismissed Notification ID',
+});
+
+export const removedConversationOutputSchema: OutputSchema = acknowledgementSchema({
+ idKey: 'conversation_id',
+ idLabel: 'Removed Conversation ID',
+});
+
+export const clearedNotificationsOutputSchema: OutputSchema = { fields: acknowledgementFields };
+
+export const relationshipOutputSchema: OutputSchema = { fields: relationshipFields };
+
+export const relationshipsOutputSchema: OutputSchema = countedListSchema({
+ itemsKey: 'relationships',
+ label: 'Relationships',
+ items: relationshipFields,
+ labelKey: 'id',
+});
+
+export const mutedAccountPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'accounts',
+ label: 'Muted Accounts',
+ items: mutedAccountFields,
+ labelKey: 'acct',
+});
+
+export const notificationOutputSchema: OutputSchema = { fields: notificationFields };
+
+export const notificationPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'notifications',
+ label: 'Notifications',
+ items: notificationFields,
+ labelKey: 'type',
+});
+
+export const conversationOutputSchema: OutputSchema = { fields: conversationFields };
+
+export const conversationPageOutputSchema: OutputSchema = pageSchema({
+ itemsKey: 'conversations',
+ label: 'Conversations',
+ items: conversationFields,
+ labelKey: 'id',
+});
+
+export const postStatusOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'HTTP Status', format: 'number' },
+ { key: 'body', label: 'Status', children: statusFields },
+ ],
+};
diff --git a/packages/pieces/core/crypto/package.json b/packages/pieces/core/crypto/package.json
index de733737f09..49e63ac2a7d 100644
--- a/packages/pieces/core/crypto/package.json
+++ b/packages/pieces/core/crypto/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-crypto",
- "version": "0.0.28",
+ "version": "0.0.29",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"dependencies": {
diff --git a/packages/pieces/core/crypto/src/lib/actions/base64-decode.ts b/packages/pieces/core/crypto/src/lib/actions/base64-decode.ts
index 82af6df797a..bd05399a2fc 100644
--- a/packages/pieces/core/crypto/src/lib/actions/base64-decode.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/base64-decode.ts
@@ -1,4 +1,5 @@
import { Property, createAction } from '@activepieces/pieces-framework';
+import { base64DecodeActionOutputSchema } from '../output-schemas';
export const base64Decode = createAction({
audience: 'both',
@@ -7,6 +8,7 @@ export const base64Decode = createAction({
displayName: 'Base64 Decode',
description:'Converts base64 text back to plain text.',
aiMetadata: { description: 'Decodes a base64-encoded string back to plain text. Pick this to read a base64 field from an API response or header; use Base64 Encode for the opposite direction, and note that a digest from Text to Hash cannot be reversed this way. Requires a base64 text string rather than a binary file, and invalid base64 characters are silently dropped rather than raising an error; pure computation and idempotent.', idempotent: true },
+ outputSchema: base64DecodeActionOutputSchema,
props: {
text: Property.ShortText({
displayName: 'Text',
diff --git a/packages/pieces/core/crypto/src/lib/actions/base64-encode.ts b/packages/pieces/core/crypto/src/lib/actions/base64-encode.ts
index 1eade88c1ff..2f397bc093f 100644
--- a/packages/pieces/core/crypto/src/lib/actions/base64-encode.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/base64-encode.ts
@@ -1,4 +1,5 @@
import { Property, createAction } from '@activepieces/pieces-framework';
+import { base64EncodeActionOutputSchema } from '../output-schemas';
export const base64Encode = createAction({
audience: 'both',
@@ -7,6 +8,7 @@ export const base64Encode = createAction({
displayName: 'Base64 Encode',
description: 'Converts plain text into base64 format.',
aiMetadata: { description: 'Encodes a plain-text string into base64. Pick this when a downstream API, header or payload field requires base64 (e.g. a Basic-auth credential); use Base64 Decode to reverse it, or Text to Hash if you need a one-way digest rather than reversible encoding. Accepts a text string only, not a binary file; pure computation and idempotent.', idempotent: true },
+ outputSchema: base64EncodeActionOutputSchema,
props: {
text: Property.ShortText({
displayName: 'Text',
diff --git a/packages/pieces/core/crypto/src/lib/actions/generate-password.ts b/packages/pieces/core/crypto/src/lib/actions/generate-password.ts
index c477a9b390e..b74a8a5b70b 100644
--- a/packages/pieces/core/crypto/src/lib/actions/generate-password.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/generate-password.ts
@@ -2,6 +2,7 @@ import {
Property,
createAction,
} from '@activepieces/pieces-framework';
+import { generatePasswordActionOutputSchema } from '../output-schemas';
import * as z from 'zod/mini'
import { propsValidation } from '@activepieces/pieces-common';
@@ -12,6 +13,7 @@ export const generatePassword = createAction({
description: 'Generates a random password with the specified length',
aiMetadata: { description: 'Generates a random password of a given length, from either an alphanumeric character set or alphanumeric plus symbols. Pick this when a flow needs a fresh secret or random token to hand to a later step; it is a value generator, not a digest, so use Text to Hash or Generate HMAC Signature to hash existing text. Length must be 256 or less; not idempotent: every call returns a different password, so capture the output once and reuse it rather than re-running.', idempotent: false },
displayName: 'Generate Password',
+ outputSchema: generatePasswordActionOutputSchema,
props: {
length: Property.Number({
displayName: 'Password Length',
diff --git a/packages/pieces/core/crypto/src/lib/actions/hash-text.ts b/packages/pieces/core/crypto/src/lib/actions/hash-text.ts
index 847ba38f02d..0eebace85d2 100644
--- a/packages/pieces/core/crypto/src/lib/actions/hash-text.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/hash-text.ts
@@ -1,4 +1,5 @@
import { Property, createAction } from '@activepieces/pieces-framework';
+import { hashTextActionOutputSchema } from '../output-schemas';
import Crypto from 'crypto';
export const hashText = createAction({
@@ -8,6 +9,7 @@ export const hashText = createAction({
description: 'Converts text to a hash value using various hashing algorithms',
aiMetadata: { description: 'Computes a one-way cryptographic digest of a text string as a hex value, with the algorithm chosen from MD5, SHA256, SHA512 or SHA3-512. Pick this for checksums, fingerprints or de-duplication keys; use Generate HMAC Signature when the digest must be keyed with a shared secret, and Base64 Encode when you need reversible encoding instead of a hash. Requires the text plus an algorithm; pure computation and idempotent, since identical input always yields the same digest.', idempotent: true },
displayName: 'Text to Hash',
+ outputSchema: hashTextActionOutputSchema,
props: {
method: Property.StaticDropdown({
displayName: 'Method',
diff --git a/packages/pieces/core/crypto/src/lib/actions/hmac-signature.ts b/packages/pieces/core/crypto/src/lib/actions/hmac-signature.ts
index 202b598870c..8298e42eae6 100644
--- a/packages/pieces/core/crypto/src/lib/actions/hmac-signature.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/hmac-signature.ts
@@ -1,4 +1,5 @@
import { createAction, Property } from '@activepieces/pieces-framework';
+import { hmacSignatureActionOutputSchema } from '../output-schemas';
import Crypto from 'crypto';
import { Buffer } from 'buffer';
@@ -10,6 +11,7 @@ export const hmacSignature = createAction({
'Converts text to a HMAC signed hash value using various hashing algorithms',
aiMetadata: { description: 'Computes a keyed HMAC digest of a text string with a secret key, selecting the hash algorithm and how the secret key itself is interpreted (UTF-8, hex or base64). Pick this to sign or verify webhook payloads and API requests that use a shared secret; use Text to Hash for an unkeyed digest and Generate RSA Signature for asymmetric private-key signing. The secret-key encoding must match how the key was issued or the signature will not match; pure computation and idempotent.', idempotent: true },
displayName: 'Generate HMAC Signature',
+ outputSchema: hmacSignatureActionOutputSchema,
props: {
secretKey: Property.ShortText({
displayName: 'Secret key',
diff --git a/packages/pieces/core/crypto/src/lib/actions/rsa-signature.ts b/packages/pieces/core/crypto/src/lib/actions/rsa-signature.ts
index 15babe9cdeb..4a8fd0ab159 100644
--- a/packages/pieces/core/crypto/src/lib/actions/rsa-signature.ts
+++ b/packages/pieces/core/crypto/src/lib/actions/rsa-signature.ts
@@ -1,4 +1,5 @@
import { createAction, Property } from '@activepieces/pieces-framework';
+import { rsaSignatureActionOutputSchema } from '../output-schemas';
import Crypto from 'crypto';
export const rsaSignature = createAction({
@@ -9,6 +10,7 @@ export const rsaSignature = createAction({
description:
'Signs text with an RSA private key using SHA-256, SHA-384, or SHA-512 (RSA-SHA256 by default)',
aiMetadata: { description: 'Signs a text payload with an RSA private key in PEM format (PKCS#1 or PKCS#8), hashing with SHA-256, SHA-384 or SHA-512. Pick this for asymmetric request signing where the verifier holds only the public key; use Generate HMAC Signature when both sides share one symmetric secret, and Text to Hash for a plain unkeyed digest. Requires the private key plus its passphrase if the key is encrypted; signing uses deterministic PKCS#1 v1.5 padding, so it is idempotent.', idempotent: true },
+ outputSchema: rsaSignatureActionOutputSchema,
props: {
privateKey: Property.LongText({
displayName: 'Private Key',
diff --git a/packages/pieces/core/crypto/src/lib/output-schemas.ts b/packages/pieces/core/crypto/src/lib/output-schemas.ts
index 0af43f1c2a0..c82402c0456 100644
--- a/packages/pieces/core/crypto/src/lib/output-schemas.ts
+++ b/packages/pieces/core/crypto/src/lib/output-schemas.ts
@@ -8,3 +8,54 @@ export const openpgpEncryptActionOutputSchema: OutputSchema = {
{ key: 'error', label: 'Error' },
],
};
+
+export const base64EncodeActionOutputSchema = wholeStringOutput({
+ key: 'encodedText',
+ label: 'Base64 Text',
+ description: 'The input text encoded as a base64 string.',
+});
+
+export const base64DecodeActionOutputSchema = wholeStringOutput({
+ key: 'decodedText',
+ label: 'Decoded Text',
+ description: 'The plain text decoded from the base64 input.',
+});
+
+export const generatePasswordActionOutputSchema = wholeStringOutput({
+ key: 'password',
+ label: 'Password',
+ description:
+ 'The randomly generated password, at the requested length and character set.',
+});
+
+export const hashTextActionOutputSchema = wholeStringOutput({
+ key: 'hash',
+ label: 'Hash',
+ description: 'The hex-encoded digest of the input text.',
+});
+
+export const hmacSignatureActionOutputSchema = wholeStringOutput({
+ key: 'signature',
+ label: 'HMAC Signature',
+ description:
+ 'The HMAC digest of the input text, encoded as hex or base64 per the Output Encoding setting.',
+});
+
+export const rsaSignatureActionOutputSchema = wholeStringOutput({
+ key: 'signature',
+ label: 'RSA Signature',
+ description:
+ 'The RSA signature of the input text, encoded as base64 or hex per the Output Encoding setting.',
+});
+
+function wholeStringOutput({
+ key,
+ label,
+ description,
+}: {
+ key: string;
+ label: string;
+ description: string;
+}): OutputSchema {
+ return { fields: [{ key, label, value: '', description }] };
+}