Skip to content

📑 🎛️ API to automate optimizations for self-hosted blogging platforms.

Notifications You must be signed in to change notification settings

toddbirchard/ghost-webhook-api

Repository files navigation

Ghost Webhook API

Python FastAPI Databases PyDantic Google Cloud SQLAlchemy Ghost GitHub Last Commit GitHub Issues GitHub Stars GitHub Forks

Blog Webhook API

Standalone API to compliment Ghost blogs. Accepts Ghost webhook events tiggers & executes task to optimize content and serve new features. Handles optimizations including image compression, content sanitation, alerting, and feature enablement via data aggregate (suggested searches, trending posts, etc)

Installation

Get up and running with make deploy:

git clone https://github.com/toddbirchard/ghost-webhook-api.git
cd ghost-webhook-api
make deploy

Endpoints

Posts

Endpoints to guarantee published posts have proper metadata & embedded URLs.

  • GET /posts/: Bulk update metadata for all posts where applicable. Supports meta titles, og titles & descriptions, and feature images.
  • POST /posts/: Populate metadata for a single post upon publish. Supports meta title, og title & description, and feature image.
  • GET /posts/backup: Fetch JSON backup of all blog data

Analytics

Aggregate data from Google Cloud & Algolia to power “trending” widgets.

  • GET /analytics/: Export site analytics from a data warehouse to a SQL database. Useful for trend-related features ie: "trending this week" widget.
  • GET /analytics/searches/: Fetch top Algolia search queries for the current week. Export results to a “trending searches” SQL table, as well as historical searches.

Image Optimization

Ensure all posts have retina, mobile, and webp variants.

  • POST /images/: Upon post creation, generate optimized retina and mobile variants of post ‘feature_image’ if they do not exist.
  • GET /images/: Generates both retina and mobile varieties of all images in a remote CDN directory. Defaults to directory containing images uploaded within current month, or accepts a ?directory= parameter which accepts a path to recursively optimize images on the given CDN.
  • GET /images/sort: Transverses CDN in a given directory (?directory=) to organize images into subdirectories based on image type (retina or mobile).

Accounts

Handle user account creation & interactions.

  • POST /account/: Create Ghost member from Netlify Auth service (supports auth providers Github, Google, etc.)
  • POST /account/comment/: Accept user-submitted comments for posts. Each submission notifies the post’s author via a Mailgun email.
  • POST /account/comment/upvote/: Increment (or de increment) a comment’s upvote count by 1, with maximum 1 vote per user.

Donate

  • POST /donation/: Adds BuyMeACoffee donation to a historical ledger.
  • DELETE /donation/: Delete a BuyMeACoffee donation from historical ledger.
  • GET /donation/: Get all BuyMeACoffee donations.

Newsletter

Logistics of adding or removing newsletter subscriptions.

  • POST /subscription/: Send welcome email to newsletter subscribers via Mailgun.
  • DELETE /subscription/: Track newsletter unsubscribe events.

Authors

Insight to scenarios where Authors likely need assistance.

  • GET /authors/updated/: Update all authors to have correct CDN urls & sanitized metadata.
  • POST /authors/post/created/: Notify site editor when posts are ready for review
  • POST /authors/post/updated/: Notify original post author when a peer edits a post.

Github

Notifications when user activity is made on project repos.

  • POST /github/pr/: Trigger SMS notification when contributors open a Github PR in a specified Github org.
  • POST /github/issue/: Trigger SMS notification when contributors open a Github issue in a specified Github org.

About

📑 🎛️ API to automate optimizations for self-hosted blogging platforms.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •