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>| Command | Effect |
|---|---|
memex notify list | The channels, their state and their fields. Secrets appear as ********. |
memex notify providers | The 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
--fieldends 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
| Field | Required | Notes |
|---|---|---|
host | yes | for example smtp.example.org |
port | no | defaults to 587 |
username | no | leave empty for a relay without authentication |
password | no, secret | |
from | yes | an address, or a name followed by the address in angle brackets |
encryption | no | starttls (default, port 587), tls (implicit TLS, port 465) or none |
resend: e-mail through Resend
| Field | Required | Notes |
|---|---|---|
api_key | yes, secret | starts with re_ |
from | yes | an address on a domain verified in Resend |
api_base | no | defaults to https://api.resend.com |
The sender domain must be verified in your Resend account before messages are accepted.
telegram: Telegram bot
| Field | Required | Notes |
|---|---|---|
bot_token | yes, secret | given by BotFather when the bot is created |
api_base | no | defaults to https://api.telegram.org |
- In Telegram, talk to BotFather, send
/newbotand follow the questions. It answers with the bot token. - Each recipient must start a conversation with the bot: a bot cannot write first.
- Each recipient enters their chat ID in their Memex preferences.
twilio_sms and twilio_whatsapp: SMS and WhatsApp through Twilio
| Field | Required | Notes |
|---|---|---|
account_sid | yes | starts with AC |
auth_token | yes, secret | |
from | yes | your Twilio number, or an alphanumeric sender ID for SMS; your WhatsApp-enabled number for WhatsApp |
api_base | no | defaults 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
| Field | Required | Notes |
|---|---|---|
url | yes | where the message is POSTed |
format | no | json (default), discord or slack |
secret | no, secret | signs 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
secretis set, every request carriesX-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
| Event | Sent when |
|---|---|
invitation | someone is invited to create an account |
password_reset | a password-reset link is issued |
email_verification | an address must be confirmed, on an instance with open sign-ups |
account_exists | someone signs up with an address that already has an account |
share_invitation | a folder is shared with an address that has no account yet |
access_granted | a user gets access to a brain, a folder or a note |
ai_connected | an AI application is connected to the account |
update_available | a new version of Memex is published (administrators) |
test | an administrator sends a test message |
Reference: notifications.md.