Notification
There are two types of notifications, "Admin" and "User" notifications. Admin notifications will forward every new comment on the site to your desired location, like email or Telegram channel. User notifications will allow users to subscribe to replies to their comments. Enabling user notifications doesn't enable them by default; for example, users need to click a button in the interface to subscribe to email notifications even if they are logged in by email.
Email and Telegram notifications are described on separate pages.
Slack admin notifications
To integrate notifications from remark42 with Slack, you should create a bot and obtain a token.
Create a Slack Bot
- Create a Slack app if you don't already have one, or select an existing app you've created.
- Click the OAuth & Permissions tab in the left sidebar.
- Below Bot Token Scopes, select the
chat:write
,chat:write.public
, andchannels:read
scopes. Then click Add an OAuth Scope. - Scroll to the top of the page, and click on Install to workspace.
- You should see the "View basic information about public channels in your workspace", "Send Message as ..." and "Send messages to channels ... isn't a member of" as the permission, then click allow.
- You can then see the token, in the form of
xoxb-...-...-...
Remark42 configuration
The Slack token which you obtained before should be used as NOTIFY_SLACK_TOKEN
.
You also need to set NOTIFY_ADMINS=slack
for the Slack notification to be active.
By default, the notifications are sent to the general
channel on Slack. If you need another channel, you can specify it with NOTIFY_SLACK_CHAN=channel_name
.
- NOTIFY_ADMINS=slack
- NOTIFY_SLACK_CHAN=general
- NOTIFY_SLACK_TOKEN=xoxb-....
Verify the notifications on Slack
If all goes fine, you should be able to see the following message on your Slack notification channel:
New comment from author -> original author
Demo | Remark42
This is the comment written by the author
WebHook admin notifications
You need to set NOTIFY_ADMINS=webhook
to enable WebHook notifications on all new comments and set at least NOTIFY_WEBHOOK_URL
for them to start working.
Additionally, you might want to set NOTIFY_WEBHOOK_TEMPLATE
(which is Go Template, {"text": {{.Text | escapeJSONString}}}
by default) and NOTIFY_WEBHOOK_HEADERS
, which is HTTP header(s) in format Header1:Value1,Header2:Value2,...
.
Here are some additional common variables that you can use with your template:
Variable | Type | Description |
---|---|---|
ID | string | |
Text | string | |
User.Name | string | Full struct defined here |
Locator.URL | string | Post URL |
Score | int | |
Timestamp | time.Time |
All possible variables are available in the Comment struct