Hephaestus

A plug template for Yetto. Use this to quickly spin up new plugs with a set of defaults.

Usage

gem install hephaestus

hephaestus plug-app

Where app represents the name of the platform you'd like to interact with jira, notion, slack, etc.

If you're working on updating/testing this gem locally, you may also want:

rm -rf plug-app && DEBUG=1 hephaestus/bin/hephaestus plug-app

This way you can wipe the dir and quickly iterate on new changes.

Building upon it

Launching the server

First, you'll note that you have a script/ngrok file, which launches an ngrok server at https://plug-app.ngrok.io, which maps locally to http://localhost:6661. This can be essential when testing the platform locally for the first time. (Keep in mind that you still need to run script/server to actually start the local server—this is just to help facilitate communication with the platform.)

Setting up routes

You should probably open up config/routes.rb to make modifications to any incoming (from the platform) or outgoing (for Yetto) HTTP flows.

Defining settings

Next, you'll want to open app/views/settings/new.json.jbuilder and modify the JSON structure of the Settings form page users will see when they first install the plug. Note that this adheres to a strict schema.

Accepting events

After a user submits a plug installation on the Yetto side, it'll send a POST payload to /api/:version/:event/:record_type--for example, /api/2023-03-06/after/plug_installation. Open up the yetto_controller.rb file and decide what happens next!

Creating services

Any code which communicates with the third party should be placed in the app/services directory. A generic HTTP service is included.

Acknowledgements

This project was heavily based on thoughtbot/suspenders.