Configuring Discord Webhooks Plus¶
All settings are on the extension's settings page in the admin area, in the Extension Settings section. There is no separate admin page.
General settings¶
| Setting | Type | Default | What it does |
|---|---|---|---|
| Webhook request timeout (seconds) | Text | 10 |
How long Paymenter waits for Discord to answer one webhook request. An empty field or 0 means 10 seconds. The value is read as a whole number and is never lower than 3 seconds: 1, 2 or a non-numeric value means 3 seconds. |
| Default webhook URL (optional fallback) | Text | empty | Used for every action whose own Webhook URL is empty. |
| Bot username (optional) | Text | Paymenter Bot |
Sent to Discord as the sender name of every message. Placeholders are allowed. If the saved value is empty, no username is sent and Discord shows the name set on the webhook. |
| Bot avatar URL (optional) | Text | empty | Sent to Discord as the avatar of every message. Placeholders are allowed. If empty, no avatar is sent and Discord shows the avatar set on the webhook. |
| Template variables | Information only | none | A short reminder of some placeholders. It stores nothing. |
The username and avatar apply to all actions. They cannot be set per action.
Settings per action¶
Each of the ten actions has a heading line (Webhook Action: Invoice Created and so on) followed by three fields. The label in square brackets is the action's name.
| Setting | Type | Default | What it does |
|---|---|---|---|
| [Action] Enabled | Select: No, Yes | Yes | No stops this action from sending. Yes lets it send if a webhook URL applies. If no value is saved, the action counts as enabled exactly when a webhook URL applies to it. |
| [Action] Webhook URL | Text | empty | The Discord webhook this action posts to. If empty, the Default webhook URL (optional fallback) is used. If both are empty, nothing is sent. |
| [Action] Message Template | Textarea | The action's built-in template | The text of the Discord message. Placeholders are replaced with values from the event. If empty, the built-in template is used. |
An action sends a message only if all of these hold: it is enabled, a webhook URL applies (its own or the default one), and the filled-in template is not empty.
Supported actions¶
| Action name in the settings | Key | Setting prefix | Paymenter event |
|---|---|---|---|
| Invoice Created | invoice.created |
invoice_created |
An invoice is created |
| Invoice Paid | invoice.paid |
invoice_paid |
An invoice's status changes to paid |
| Order Created | order.created |
order_created |
An order is created |
| Service Created | service.created |
service_created |
A service is created |
| Service Updated | service.updated |
service_updated |
A service is changed and saved |
| Service Cancellation Requested | service_cancellation.created |
service_cancellation_created |
A cancellation is created for a service |
| Ticket Created | ticket.created |
ticket_created |
A ticket is created |
| Ticket Message Created | ticket_message.created |
ticket_message_created |
A message is added to a ticket |
| User Login | auth.login |
auth_login |
A user logs in |
| User Created | user.created |
user_created |
A user account is created |
The key is the value of {{event.key}}. The settings are stored under the prefix followed by _enabled, _webhook_url and _template, for example invoice_paid_webhook_url.
Template placeholders¶
Write a placeholder as {{group.field}}. Spaces inside the braces are allowed: {{ user.email }} works too. Names are case-sensitive.
Available for every action¶
| Placeholder | Value |
|---|---|
{{app.name}} |
The application name of your Paymenter installation |
{{app.url}} |
The application URL of your Paymenter installation |
{{event.key}} |
The action key, for example invoice.paid |
{{event.label}} |
The action name, for example Invoice Paid |
{{event.timestamp}} |
The time the message is built, in ISO 8601 format |
User¶
Available for every action. Which user it is depends on the action, see the table below.
| Placeholder | Value |
|---|---|
{{user.id}} |
User ID |
{{user.email}} |
E-mail address |
{{user.first_name}} |
First name |
{{user.last_name}} |
Last name |
{{user.name}} |
Full name as Paymenter builds it |
| Action | The user is |
|---|---|
| Invoice Created, Invoice Paid | The invoice's customer |
| Order Created | The order's customer |
| Service Created, Service Updated | The service's customer |
| Service Cancellation Requested | The customer of the cancelled service |
| Ticket Created | The ticket's customer |
| Ticket Message Created | The author of the message |
| User Login | The user who logged in |
| User Created | The new user |
Invoice Created and Invoice Paid¶
| Placeholder | Value |
|---|---|
{{invoice.id}} |
Invoice ID |
{{invoice.number}} |
Invoice number |
{{invoice.status}} |
Invoice status |
{{invoice.currency_code}} |
Currency code |
{{invoice.total}} |
Invoice total |
{{invoice.due_at}} |
Due date as YYYY-MM-DD, empty if the invoice has none |
Order Created¶
| Placeholder | Value |
|---|---|
{{order.id}} |
Order ID |
{{order.currency_code}} |
Currency code |
{{order.total}} |
Order total |
{{order.services_count}} |
Number of services in the order |
Service Created and Service Updated¶
| Placeholder | Value |
|---|---|
{{service.id}} |
Service ID |
{{service.status}} |
Service status |
{{service.price}} |
Service price |
{{service.quantity}} |
Quantity |
{{service.currency_code}} |
Currency code |
{{service.expires_at}} |
Expiry date as YYYY-MM-DD, empty if the service has none |
{{service.product_id}} |
Product ID |
{{service.product_name}} |
Product name |
Service Cancellation Requested¶
| Placeholder | Value |
|---|---|
{{cancellation.id}} |
Cancellation ID |
{{cancellation.reason}} |
The reason entered for the cancellation |
{{cancellation.type}} |
The cancellation type as Paymenter stores it |
{{service.id}} |
ID of the service |
{{service.status}} |
Status of the service |
{{service.product_name}} |
Product name of the service |
The other service.* placeholders are not available for this action.
Ticket Created¶
| Placeholder | Value |
|---|---|
{{ticket.id}} |
Ticket ID |
{{ticket.subject}} |
Subject |
{{ticket.status}} |
Status |
{{ticket.priority}} |
Priority |
{{ticket.department}} |
Department |
{{ticket.service_id}} |
ID of the service linked to the ticket, empty if none |
Ticket Message Created¶
| Placeholder | Value |
|---|---|
{{ticket_message.id}} |
Message ID |
{{ticket_message.message}} |
The full message text |
{{ticket.id}} |
Ticket ID |
{{ticket.subject}} |
Ticket subject |
{{ticket.status}} |
Ticket status |
{{ticket.priority}}, {{ticket.department}} and {{ticket.service_id}} are not available for this action.
User Login and User Created¶
Only the general placeholders and the user.* placeholders.
How placeholders are filled¶
- A placeholder that does not exist for the action, or whose value is empty, is replaced with nothing. No error is shown.
- A placeholder that names a whole group, for example
{{user}}, is replaced with that group as JSON. - Everything else in the template is sent to Discord unchanged. Discord's own formatting (
**bold**,`code`) and mention syntax (<@USER_ID>,<@&ROLE_ID>,@everyone,@here) are passed through as you write them. - Values are inserted as they are stored. They are not escaped.
Warning
Customer-written text such as {{ticket_message.message}}, {{ticket.subject}}, {{cancellation.reason}} and {{user.name}} goes into the Discord message unchanged. If the text contains @everyone or another mention and your webhook's channel allows it, Discord treats it as a mention. Post such actions to a staff-only channel, or restrict mention permissions in Discord.
Built-in templates¶
While an action's Message Template is empty, its built-in template is used. Each one starts with an emoji and a bold title, followed by a short list. These are the placeholders the built-in templates use:
| Action | Placeholders in the built-in template |
|---|---|
| Invoice Created | invoice.number, user.email, invoice.total, invoice.currency_code, invoice.due_at, invoice.status, app.url |
| Invoice Paid | invoice.number, user.email, invoice.total, invoice.currency_code, invoice.status, event.timestamp |
| Order Created | order.id, user.email, order.total, order.currency_code, order.services_count, app.url |
| Service Created | service.id, service.product_name, user.email, service.status, service.expires_at |
| Service Updated | service.id, service.product_name, user.email, service.status, service.expires_at |
| Service Cancellation Requested | service.id, service.product_name, user.email, cancellation.reason, cancellation.type |
| Ticket Created | ticket.id, ticket.subject, ticket.priority, ticket.department, user.email |
| Ticket Message Created | ticket.id, ticket.subject, user.email, ticket_message.message |
| User Login | user.email, user.name, event.timestamp |
| User Created | user.id, user.email, user.name, event.timestamp |
The built-in templates for Invoice Created and Order Created end with a link to {{app.url}}/admin.
Template examples¶
Invoice paid:
**{{event.label}}**
Invoice: #{{invoice.number}}
User: {{user.email}}
Total: {{invoice.total}} {{invoice.currency_code}}
Ticket created, with a role ping:
<@&123456789012345678> New ticket #{{ticket.id}}: {{ticket.subject}}
Customer: {{user.email}}
Replace 123456789012345678 with the ID of your Discord role.