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