Documentation menu

Operating the server

Notifications

Memex can tell people about things that concern them (an invitation, a password-reset link, a new access, an AI application connected to their account) through channels the administrator configures: e-mail, Telegram, SMS, WhatsApp or a webhook. Notifications are optional, but an e-mail channel is what makes invitations and password resets arrive by themselves.

Without any channel

Nothing is sent. An administrator generates the link (invitation, password reset) in the app and passes it on by hand. Every flow that sends a link therefore also works without notifications, with one exception: open sign-ups need an e-mail channel, because each new address must be confirmed.

Configuring a channel

In the app, under the administration pages; in the memex menu, under Notifications → Add a channel (choose a provider, fill in its settings, then send a test message); or on the command line:

# What can be configured, and with which fields
sudo memex notify providers

# Create a channel; the secret comes from the environment
sudo MEMEX_NOTIFY_API_KEY=re_xxxxxxxx memex notify set mail \
    --kind resend --field 'from=<sender address>'

# Check it, with the provider’s answer
sudo memex notify test mail --to <your address>
CommandEffect
memex notify listThe channels, their state and their fields. Secrets appear as ********.
memex notify providersThe providers and the fields each one takes.
memex notify set <channel>Creates the channel (--kind is then required) or changes it. --field KEY=VALUE is repeatable and an empty value clears the field; --name renames; --enable and --disable switch it.
memex notify test <channel>Sends a test message. --to is the recipient; by default, the first administrator’s address for that kind of channel.
memex notify remove <channel>Deletes the channel, after confirmation (--yes to skip it).
  • A secret given with --field ends up in the shell history. Pass it in the environment instead: MEMEX_NOTIFY_<FIELD> with the field name in capitals (MEMEX_NOTIFY_API_KEY, MEMEX_NOTIFY_PASSWORD, MEMEX_NOTIFY_BOT_TOKEN, MEMEX_NOTIFY_AUTH_TOKEN).
  • No restart is needed: the running server uses a channel created, changed, disabled or removed from the next message on.
  • Channel credentials are stored in the database and never sent back to the browser.

smtp: e-mail through any SMTP server

FieldRequiredNotes
hostyesfor example smtp.example.org
portnodefaults to 587
usernamenoleave empty for a relay without authentication
passwordno, secret
fromyesan address, or a name followed by the address in angle brackets
encryptionnostarttls (default, port 587), tls (implicit TLS, port 465) or none

resend: e-mail through Resend

FieldRequiredNotes
api_keyyes, secretstarts with re_
fromyesan address on a domain verified in Resend
api_basenodefaults to https://api.resend.com

The sender domain must be verified in your Resend account before messages are accepted.

telegram: Telegram bot

FieldRequiredNotes
bot_tokenyes, secretgiven by BotFather when the bot is created
api_basenodefaults to https://api.telegram.org
  1. In Telegram, talk to BotFather, send /newbot and follow the questions. It answers with the bot token.
  2. Each recipient must start a conversation with the bot: a bot cannot write first.
  3. Each recipient enters their chat ID in their Memex preferences.

twilio_sms and twilio_whatsapp: SMS and WhatsApp through Twilio

FieldRequiredNotes
account_sidyesstarts with AC
auth_tokenyes, secret
fromyesyour Twilio number, or an alphanumeric sender ID for SMS; your WhatsApp-enabled number for WhatsApp
api_basenodefaults to https://api.twilio.com

WhatsApp has constraints of its own. Until a WhatsApp sender is approved for your account, only the Twilio sandbox can be used, and every recipient must first opt in. Outside the sandbox, a business can only send free-form text to someone who wrote to it during the last 24 hours; anything else must be an approved template, which Memex does not use. WhatsApp is therefore a poor choice as the only channel for invitations.

webhook: Discord, Slack, or your own endpoint

FieldRequiredNotes
urlyeswhere the message is POSTed
formatnojson (default), discord or slack
secretno, secretsigns the body
  • A webhook has a fixed destination: it suits a shared team channel or your own automation.
  • Messages containing a secret link (invitation, password reset) are only sent to a personal address, never to a shared destination such as a webhook.
  • When secret is set, every request carries X-Memex-Signature: sha256=<hex>, the HMAC-SHA256 of the raw request body keyed with the secret.
  • Webhook URLs are credentials: anyone who knows one can post to the channel.

What is sent

EventSent when
invitationsomeone is invited to create an account
password_reseta password-reset link is issued
email_verificationan address must be confirmed, on an instance with open sign-ups
account_existssomeone signs up with an address that already has an account
share_invitationa folder is shared with an address that has no account yet
access_granteda user gets access to a brain, a folder or a note
ai_connectedan AI application is connected to the account
update_availablea new version of Memex is published (administrators)
testan administrator sends a test message

Reference: notifications.md.