~gjabell/mfn

ref: 0.1.0 mfn/README.md -rw-r--r-- 2.5 KiB View raw
d0ec1c94Galen Abell Update README 2 months ago

mfn

Send notifications to various sources when Miniflux finds new RSS entries.

Example Usage

  1. Create a TOML configuration file with the following format:
server = "https://rss.example.com" # the url of the Miniflux instance
username = "myuser" # the username used to login to the Miniflux instance
password = "mypass" # the password used to login to the Miniflux instance
db_path = "/var/lib/mfn/last_entry.txt" # path where the last entry is stored

[email]
subject_template = """
New Entry: {{ .Title }}{{ if ne .Author "" }} • {{ .Author }}{{ end }}
""" # golang html/template-compatible template string, which will be sent as the subject of the email
body_template = """
{{ if ne .Content "" }}
{{ .Content }}
{{ end }}
URL: {{ .URL }}
""" # golang html/template-compatible template string, which will be sent as the body of the email
to = "My User <myuser@example.com>" # email recipient
from = "My Server <myserver@example.com>" # email sender
username = "myuser" # email server username
password = "mypass" # email server password
server = "smtp.example.com:587" # email server url with port

[webhook]
template = """
<h3>{{ .Title }}{{ if ne .Author "" }} • <i>{{ .Author }}</i>{{ end }}</h3>
{{ if ne .Content "" }}
<br/>
<blockquote>{{ printf "%.250s" .Content }}{{ if gt (len .Content) 250 }}...{{ end }}</blockquote>
{{ end }}
<br/>
<a href="{{ .URL }}">{{ .URL }}</a>""" # golang html/template-compatible template string, which will be sent as the body of the webhook
endpoint = "https://webhooks.example.com" # the url of the webhook endpoint

Note that only one notifier is required.

  1. Ensure mfn can successfully send a notification: mfn -t [notifier] -c [path to config] (to view available notifiers, run mfn -c [path to config] -l)

  2. Run mfn once to sync the last entry (no notifications will be sent during the initial population): mfn -c [path to config]

  3. Periodically run mfn (for example, as a cron job) to send notifications when new entries are picked up by Miniflux: mfn -c [path to config]

Implementation

mfn uses the official Miniflux Golang client to query Miniflux for new entries. On the first run, mfn will determine the id of the most recent entry and store it in a plaintext file. On subsequent runs, mfn will only request entries posted after the latest entry, updating the latest entry id on each run. Each entry requested after the initial sync will trigger notifications based on the notifications in the config file.