~gjabell/mfn

d0ec1c943251d1ac3606a391bbf8829707d6d570 — Galen Abell 2 months ago e3e621a 0.1.0
Update README
1 files changed, 29 insertions(+), 9 deletions(-)

M README.md
M README.md => README.md +29 -9
@@ 1,6 1,6 @@
# mfw
# mfn

A small command-line utility to send webhook notifications when [Miniflux](https://miniflux.app) finds new RSS entries.
Send notifications to various sources when [Miniflux](https://miniflux.app) finds new RSS entries.

## Example Usage



@@ 10,8 10,26 @@ A small command-line utility to send webhook notifications when [Miniflux](https
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/mfw/last_entry.txt" # path where the last entry is stored
webhook_template = """
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/>


@@ 19,15 37,17 @@ webhook_template = """
{{ end }}
<br/>
<a href="{{ .URL }}">{{ .URL }}</a>""" # golang html/template-compatible template string, which will be sent as the body of the webhook
webhook_url = "https://webhooks.example.com" # the url of the webhook endpoint
endpoint = "https://webhooks.example.com" # the url of the webhook endpoint
```

2. Ensure `mwf` can successfully send a webhook: `mwf -t -c [path to config]`
Note that only one notifier is required.

2. 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`)

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

4. Periodically run `mwf` (for example, as a cron job) to send notifications when new entries are picked up by Miniflux: `mwf -c [path to config]`
4. 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

`mwf` uses the official Miniflux Golang client to query Miniflux for new entries. On the first run, `mwf` will determine the id of the most recent entry and store it in a plaintext file. On subsequent runs, `mwf` 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 a webhook notification to the given webhook endpoint, with the body text parsed from the specified template.
`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.