samples
turbot/flowpipe-samples/send-top-show-hn-email

Send Top "Show HN" Stories From Hacker News

Using Steampipe and the Hacker News plugin, list the top "Show HN" stories from Hacker News ordered by score and send them in an email using SendGrid.

If run with flowpipe server, this mod will send an email every day at 12 PM UTC.

Requirements

Install Steampipe and the Hacker News plugin.

Then start Steampipe with steampipe service start.

Docker daemon must be installed and running. Please see Install Docker Engine for more information.

Installation

Download and install Flowpipe (https://flowpipe.io/downloads). Or use Brew:

brew tap turbot/tap
brew install flowpipe

Clone:

git clone https://github.com/turbot/flowpipe-samples.git
cd productivity/send_top_show_hn_email

Install mod dependencies:

flowpipe mod install

Credentials

By default, the following environment variables will be used for authentication:

  • SENDGRID_API_KEY

You can also create credential resources in configuration files:

vi ~/.flowpipe/config/sendgrid.fpc
credential "sendgrid" "default" {
api_key = "SG.R6pHsRv..."
}

For more information on credentials in Flowpipe, please see Managing Credentials.

Usage

Run the pipeline to send an email immediately:

flowpipe pipeline run send_top_show_hn_email

To send an email at the scheduled time, start the Flowpipe server:

flowpipe server

Once started, Flowpipe will run the pipeline automatically at the scheduled time.

Configuration

To avoid entering variable values when running the pipeline or starting the server, you can set variable values:

cp flowpipe.fpvars.example flowpipe.fpvars
vi flowpipe.fpvars
# Required
to = "user@example.com"
from = "other.user@example.com"
# Optional
hn_story_count = 10