The key components you need are 1) a URL to an image and 2) a status message to go along with it (though this could probably be "" (null/a blank string) for a media-only post).
Screenshot → https://share.cleanshot.com/ktY34JSnbpGMwyTJQMjs
Assuming you follow along in my screenshot…
-
Set a webhook as the beginning of the flow
- Copy that generated URL ("A" in the screenshot)
- Send an initial request to that webhhok so it knows what to expect* (!important, don't skip)
-
(Optional) Add a "Match pattern" Text parser step and ensure the following ("B" in the screenshot)…
- Regex pattern:
([^\/]+\.[\w]{3,4})(\?.+)?$
(this looks for a 3-4 letter file extension in the URL) - Global match, Case sensitive, Multiline, and Singleline should be "No"
- Continue should be "No" so that the flow stops if there's no match
- Text should be the captured URL from the Webhook
- Regex pattern:
-
Add a "Get a file" HTTP step ("C" in the screenshot)
- Text should be the captured URL from the Webhook
-
Add a "Make a request" HTTP step
- Set URL to
https://[something.social]/api/v1/media
(replace [something.social] with your Mastodon server domain name) - Set Method to "POST"
- Set 2 Headers
- Set Name to "Authorization" and Value to "Bearer [eyJ0eXAiOiJKV1QiLCJhbGciOiJSU…]"
(replace '[eyJ0eXAiOiJKV1QiLCJhbGciOiJSU…]' with your access token (how to get one (or just Google it)) - Set Name to "Content-Type" and Value to "multipart/form-data"
- Set Name to "Authorization" and Value to "Bearer [eyJ0eXAiOiJKV1QiLCJhbGciOiJSU…]"
- Set Body type to "Multipart/form-data"
- Set 1 Field
- Set Field type to "File", set Key to "file", set File to "HTTP - Get a file" from Step 3
- Set Parse response to "Yes" (!important for step 5.v.b)
- Set URL to
-
Add another "Make a request" HTTP step
- Set URL to
https://[something.social]/api/v1/statuses
- Set Method to "POST"
- Set 2 Headers
- Set Name to "Authorization" and Value to "Bearer [eyJ0eXAiOiJKV1QiLCJhbGciOiJSU…]" (same as Step 4)
- Set Name to "Content-Type" and Value to "multipart/form-data"
- Set Body type to "Multipart/form-data"
- Set 2 Fields
- Set Field type to "Text", set Key to "status", set Value to "title" from the initial Webhook
- Set Field type to "Text", set Key to "media_ids[]", set Value to the "data.id" from Step 4 above
- Set URL to
* I send the Webhook data from IFTTT with a POST to my Make.com webhook URL. The Content Type is "application/json" and the Body is { "title": "{{Title}}","url": "{{ImageURL}}" }
Hope this helps!