Mastodon Publisher
Publish content to Mastodon. Use when you need to share updates, posts, or media.
Usage
Post one or more statuses to Mastodon
Post a new status to Mastodon with Bun:
bun {baseDir}/scripts/tootbot.js '{"status": "Hello, Mastodon!"}' '{"status": "Goodby, Mastodon!"}'
JSON fields
| Name |
Description |
Type |
Example |
Required |
Default |
status |
The text content of the status |
string |
"Hello, World" |
yes^1 |
N/A |
visibility |
Sets the visibility of the posted status |
public or private or unlisted or direct |
"private" |
no |
"public" |
language |
ISO 639-1 language code for this status |
ISO-639-1 Language Code |
"en" |
no |
|
scheduledAt |
Datetime at which to schedule a status |
RFC3339 date time |
"2029-02-03T15:30:45.000Z" |
no |
|
quoteApprovalPolicy |
Sets who is allowed to quote the status |
public or followrs or nobody |
"nobody" |
no |
"public |
media |
Media to be attached to the status |
array of {file, description} objects |
{"file": "/path/to/foo.png", "description" : "Foo"} |
no^2 |
|
- ^1
status can be ommitted when one or --media-path parameters are present
- ^2 one or
media objects must be present if status is ommitted
- ^2
media.description is optional
Environment Variables
| Name |
Description |
Example |
MASTODON_URL |
Your Mastodon instance URL |
https://mastodon.social |
MASTODON_ACCESS_TOKEN |
Your Mastodon access token |
xAyBzC |
Examples
Post a new status
bun {baseDir}/scripts/tootbot.js '{"status": "Hello, Mastodon"}'
Read the output and summarize it for the user.
Post a scheduled status
bun {baseDir}/scripts/tootbot.js '{"status": "Hello, future!", "scheduledAt" : "2030-02-05T13:21:34.000Z"}'
Read the output and summarize it for the user.
Post a scheduled status with visibility, language, quote approval policy, and a single media attachment
bun {baseDir}/scripts/tootbot.js <<EOF
{
"status" : "Dorood",
"visibility" : "public",
"language" : "fa",
"scheduledAt" : "2029-02-03T15:30:45.123456789+03:30",
"quoteApprovalPolicy" : "followers",
"media" : [
{
"file" : "/path/to/media.png",
"description" : "Nowrooz Pirooz"
}
]
}
EOF
Read the output and summarize it for the user.
Post a new status with media multiple attachments
bun {baseDir}/scripts/tootbot.js <<EOF
{
"status" : "Edsger W Dijkstra",
"visibility" : "public",
"language" : "fa",
"scheduledAt" : "2029-02-03T15:30:45.123456789+03:30",
"quoteApprovalPolicy" : "followers",
"media" : [
{
"file" : "/path/to/dijkstra.png",
"description" : "Portrait"
},
{
"file" : "/path/to/signature.png",
"description" : "Signature"
}
]
}
EOF
Post a new status with media attachments and no status text
bun {baseDir}/scripts/tootbot.js <<EOF
{
"media" : [
{
"file" : "/path/to/flower-1.png",
"description" : "White Rose"
},
{
"file" : "/path/to/flower-2.png",
"description" : "Red Rose"
}
]
}
EOF
Notes
- Requires
bun to be installed and available in the PATH.
1---
2name: mastodon-publisher
3description: Publish content to Mastodon. Use when you need to post a Mastodon status.
4author: Behrang Saeedzadeh
5version: 0.5.0
6triggers:
7 - "post to mastodon"
8 - "publish status to mastodon"
9metadata:
10 source: https://skillmd.com/skills/modbender/mastodon-publisher
11 clawdbot:
12 emoji: 🐘
13 requires:
14 bins:
15 - bun
16---
17
18# Mastodon Publisher
19
20Publish content to Mastodon. Use when you need to share updates, posts, or media.
21
22## Usage
23
24### Post one or more statuses to Mastodon
25
26Post a new status to Mastodon with Bun:
27
28```bash
29bun {baseDir}/scripts/tootbot.js '{"status": "Hello, Mastodon!"}' '{"status": "Goodby, Mastodon!"}'
30```
31
32JSON fields
33
34| Name | Description | Type | Example | Required | Default |
35| --------------------- | ---------------------------------------- | ----------------------------------------------- | ----------------------------------------------------- | -------- | -------- |
36| `status` | The text content of the status | string | "Hello, World" | yes^1 | N/A |
37| `visibility` | Sets the visibility of the posted status | `public` or `private` or `unlisted` or `direct` | "private" | no | "public" |
38| `language` | ISO 639-1 language code for this status | ISO-639-1 Language Code | "en" | no | |
39| `scheduledAt` | Datetime at which to schedule a status | RFC3339 date time | "2029-02-03T15:30:45.000Z" | no | |
40| `quoteApprovalPolicy` | Sets who is allowed to quote the status | `public` or `followrs` or `nobody` | "nobody" | no | "public |
41| `media` | Media to be attached to the status | array of `{file, description}` objects | `{"file": "/path/to/foo.png", "description" : "Foo"}` | no^2 | |
42
43- ^1 `status` can be ommitted when one or `--media-path` parameters are present
44- ^2 one or `media` objects must be present if `status` is ommitted
45- ^2 `media.description` is optional
46
47Environment Variables
48
49| Name | Description | Example |
50| ----------------------- | -------------------------- | ------------------------- |
51| `MASTODON_URL` | Your Mastodon instance URL | `https://mastodon.social` |
52| `MASTODON_ACCESS_TOKEN` | Your Mastodon access token | `xAyBzC` |
53
54## Examples
55
56- **Post a new status**
57
58 ```bash
59 bun {baseDir}/scripts/tootbot.js '{"status": "Hello, Mastodon"}'
60 ```
61
62 Read the output and summarize it for the user.
63
64- **Post a scheduled status**
65
66 ```bash
67 bun {baseDir}/scripts/tootbot.js '{"status": "Hello, future!", "scheduledAt" : "2030-02-05T13:21:34.000Z"}'
68 ```
69
70 Read the output and summarize it for the user.
71
72- **Post a scheduled status with visibility, language, quote approval policy, and a single media attachment**
73
74 ```bash
75 bun {baseDir}/scripts/tootbot.js <<EOF
76 {
77 "status" : "Dorood",
78 "visibility" : "public",
79 "language" : "fa",
80 "scheduledAt" : "2029-02-03T15:30:45.123456789+03:30",
81 "quoteApprovalPolicy" : "followers",
82 "media" : [
83 {
84 "file" : "/path/to/media.png",
85 "description" : "Nowrooz Pirooz"
86 }
87 ]
88 }
89 EOF
90 ```
91
92 Read the output and summarize it for the user.
93
94- **Post a new status with media multiple attachments**
95
96 ```bash
97 bun {baseDir}/scripts/tootbot.js <<EOF
98 {
99 "status" : "Edsger W Dijkstra",
100 "visibility" : "public",
101 "language" : "fa",
102 "scheduledAt" : "2029-02-03T15:30:45.123456789+03:30",
103 "quoteApprovalPolicy" : "followers",
104 "media" : [
105 {
106 "file" : "/path/to/dijkstra.png",
107 "description" : "Portrait"
108 },
109 {
110 "file" : "/path/to/signature.png",
111 "description" : "Signature"
112 }
113 ]
114 }
115 EOF
116 ```
117
118- **Post a new status with media attachments and no status text**
119
120 ```bash
121 bun {baseDir}/scripts/tootbot.js <<EOF
122 {
123 "media" : [
124 {
125 "file" : "/path/to/flower-1.png",
126 "description" : "White Rose"
127 },
128 {
129 "file" : "/path/to/flower-2.png",
130 "description" : "Red Rose"
131 }
132 ]
133 }
134 EOF
135 ```
136
137## Notes
138
139- Requires `bun` to be installed and available in the PATH.