One-Click Publishing from Hexo Markdown to Medium with Alfred

Shows how to build an Alfred workflow that publishes Hexo Markdown posts to Medium via its API.

Nov 25, 2020 · 2 min read · 280 Words · -Views -Comments · Software & Tools
Productivity 🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

I host my own blog, but I’d love to cross-post to Medium: the community is active, engagement boosts my posts, and it’s a great excuse to practice English. Publishing manually on Medium was tedious—no native Markdown support—so I rarely did it. Once I found Medium’s API and considered my love for Alfred, building a one-click workflow became the obvious solution.

Workflow download: https://github.com/alanhe421/alfred-workflows/blob/master/medium-publisher

Implementation Notes

  • Medium’s API lets you create stories. Authentication requires a token and author ID; the author ID is fetched once via the token and never changes. The workflow does that automatically on first run.
  • Alfred’s File Actions can operate on a selected Markdown file. With environment variables in Alfred workflows, we can store the author ID and skip future lookups.

Design

https://static.1991421.cn/2020/2020-11-25-235130.jpeg

Install the workflow to inspect the full code.

Demo

https://static.1991421.cn/2020/2020-11-26-001257.gif

Usage

Search for any Hexo Markdown file → press → (File Action) → run deploy.

Limitations

  • Medium’s API surface is small. There’s no endpoint to update existing posts, so edits still require manual work.
  • Support is slow; emails to yourfriends@medium.com often go unanswered.
  • Medium is blocked in mainland China, so make sure your machine is behind a proxy before running the workflow.
  • The workflow uses Node + Yarn. Users must install both and run yarn install inside the workflow directory; setup could be friendlier for non-Node developers.

Final Thoughts

  • Building this took a few hours—partly to learn Medium’s API, partly to fill gaps in my Alfred knowledge. Worth it: similar automations will be much faster next time.
  • The workflow eliminates most of the grunt work of cross-posting, even if edits still require manual steps. It’s the best trade-off available right now.

Keep iterating!

References

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover