Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions docs/using-seerr/notifications/webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ Customize the JSON payload to suit your needs. Seerr provides several [template

These variables are for the target recipient of the notification.

| Variable | Value |
| ---------------------------------------- | ------------------------------------------------------------- |
| `{{notifyuser_username}}` | The target notification recipient's username |
| `{{notifyuser_email}}` | The target notification recipient's email address |
| `{{notifyuser_avatar}}` | The target notification recipient's avatar URL |
| `{{notifyuser_settings_discordId}}` | The target notification recipient's Discord ID (if set) |
| `{{notifyuser_settings_telegramChatId}}` | The target notification recipient's Telegram Chat ID (if set) |
| Variable | Value |
| ---------------------------------------- | -------------------------------------------------------------------------------------------- |
| `{{notifyuser_username}}` | The target notification recipient's username |
| `{{notifyuser_email}}` | The target notification recipient's email address |
| `{{notifyuser_avatar}}` | The target notification recipient's avatar URL |
| `{{notifyuser_settings_discordIds}}` | The target notification recipient's Discord ID(s) as a JSON array (if set) |
| `{{notifyuser_settings_telegramChatId}}` | The target notification recipient's Telegram Chat ID (if set) |

:::info
The `notifyuser` variables are not defined for the following request notification types, as they are intended for application administrators rather than end users:
Expand Down Expand Up @@ -111,42 +111,42 @@ The `{{request}}` will be `null` if there is no relevant media object for the no

The following special variables are only included in request-related notifications.

| Variable | Value |
| ----------------------------------------- | ----------------------------------------------- |
| `{{request_id}}` | The request ID |
| `{{requestedBy_username}}` | The requesting user's username |
| `{{requestedBy_email}}` | The requesting user's email address |
| `{{requestedBy_avatar}}` | The requesting user's avatar URL |
| `{{requestedBy_jellyfinUserId}}` | The requesting user's Jellyfin User ID |
| `{{requestedBy_settings_discordId}}` | The requesting user's Discord ID (if set) |
| `{{requestedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
| Variable | Value |
| ----------------------------------------- | ------------------------------------------------------------------------------ |
| `{{request_id}}` | The request ID |
| `{{requestedBy_username}}` | The requesting user's username |
| `{{requestedBy_email}}` | The requesting user's email address |
| `{{requestedBy_avatar}}` | The requesting user's avatar URL |
| `{{requestedBy_jellyfinUserId}}` | The requesting user's Jellyfin User ID |
| `{{requestedBy_settings_discordIds}}` | The requesting user's Discord ID(s) as a JSON array (if set) |
| `{{requestedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |

#### Issue

The `{{issue}}` will be `null` if there is no relevant media object for the notification.

The following special variables are only included in issue-related notifications.

| Variable | Value |
| ---------------------------------------- | ----------------------------------------------- |
| `{{issue_id}}` | The issue ID |
| `{{reportedBy_username}}` | The requesting user's username |
| `{{reportedBy_email}}` | The requesting user's email address |
| `{{reportedBy_avatar}}` | The requesting user's avatar URL |
| `{{reportedBy_settings_discordId}}` | The requesting user's Discord ID (if set) |
| `{{reportedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |
| Variable | Value |
| ---------------------------------------- | ------------------------------------------------------------------------------ |
| `{{issue_id}}` | The issue ID |
| `{{reportedBy_username}}` | The requesting user's username |
| `{{reportedBy_email}}` | The requesting user's email address |
| `{{reportedBy_avatar}}` | The requesting user's avatar URL |
| `{{reportedBy_settings_discordIds}}` | The reporting user's Discord ID(s) as a JSON array (if set) |
| `{{reportedBy_settings_telegramChatId}}` | The requesting user's Telegram Chat ID (if set) |

#### Comment

The `{{comment}}` will be `null` if there is no relevant media object for the notification.

The following special variables are only included in issue comment-related notifications.

| Variable | Value |
| ----------------------------------------- | ----------------------------------------------- |
| `{{comment_message}}` | The comment message |
| `{{commentedBy_username}}` | The commenting user's username |
| `{{commentedBy_email}}` | The commenting user's email address |
| `{{commentedBy_avatar}}` | The commenting user's avatar URL |
| `{{commentedBy_settings_discordId}}` | The commenting user's Discord ID (if set) |
| `{{commentedBy_settings_telegramChatId}}` | The commenting user's Telegram Chat ID (if set) |
| Variable | Value |
| ----------------------------------------- | ------------------------------------------------------------------------------ |
| `{{comment_message}}` | The comment message |
| `{{commentedBy_username}}` | The commenting user's username |
| `{{commentedBy_email}}` | The commenting user's email address |
| `{{commentedBy_avatar}}` | The commenting user's avatar URL |
| `{{commentedBy_settings_discordIds}}` | The commenting user's Discord ID(s) as a JSON array (if set) |
| `{{commentedBy_settings_telegramChatId}}` | The commenting user's Telegram Chat ID (if set) |
18 changes: 4 additions & 14 deletions seerr-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ components:
email:
type: string
example: 'user@example.com'
discordId:
type: string
nullable: true
example: '123456789'
locale:
type: string
nullable: true
Expand Down Expand Up @@ -706,18 +702,10 @@ components:
example: A Label
PublicSettings:
type: object
required:
- initialized
- plexClientIdentifier
Comment thread
defaultdino marked this conversation as resolved.
properties:
initialized:
type: boolean
example: false
plexClientIdentifier:
type: string
format: uuid
description: Instance Plex OAuth client identifier
example: 6919275e-142a-48d8-be6b-93594cbd4626
Comment thread
defaultdino marked this conversation as resolved.
MovieResult:
type: object
required:
Expand Down Expand Up @@ -1952,8 +1940,10 @@ components:
discordEnabledTypes:
type: number
nullable: true
discordId:
type: string
discordIds:
type: array
items:
type: string
nullable: true
pushbulletAccessToken:
type: string
Expand Down
27 changes: 27 additions & 0 deletions server/constants/discord.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const DISCORD_SNOWFLAKE_REGEX = /^\d{17,20}$/;

export enum EmbedColors {
DEFAULT = 0,
AQUA = 1752220,
GREEN = 3066993,
BLUE = 3447003,
PURPLE = 10181046,
GOLD = 15844367,
ORANGE = 15105570,
RED = 15158332,
GREY = 9807270,
DARKER_GREY = 8359053,
NAVY = 3426654,
DARK_AQUA = 1146986,
DARK_GREEN = 2067276,
DARK_BLUE = 2123412,
DARK_PURPLE = 7419530,
DARK_GOLD = 12745742,
DARK_ORANGE = 11027200,
DARK_RED = 10038562,
DARK_GREY = 9936031,
LIGHT_GREY = 12370112,
DARK_NAVY = 2899536,
LUMINOUS_VIVID_PINK = 16580705,
DARK_VIVID_PINK = 12320855,
}
Comment thread
gauthier-th marked this conversation as resolved.
16 changes: 16 additions & 0 deletions server/entity/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ export const ALL_NOTIFICATIONS = Object.values(Notification)
.filter((v) => !isNaN(Number(v)))
.reduce((a, v) => a + Number(v), 0);

// convert between DB representation (JSON string) into typescript array
const jsonArrayTransformer = {
from: (v: string | null): string[] => {
try {
return v ? JSON.parse(v) : [];
} catch {
return [];
}
},
to: (v: string[] | null): string | null =>
v?.length ? JSON.stringify(v) : null,
};

@Entity()
export class UserSettings {
constructor(init?: Partial<UserSettings>) {
Expand Down Expand Up @@ -45,6 +58,9 @@ export class UserSettings {
@Column({ nullable: true })
public discordId?: string;

@Column({ type: 'text', nullable: true, transformer: jsonArrayTransformer })
public discordIds: string[];

@Column({ nullable: true })
public pushbulletAccessToken?: string;

Expand Down
3 changes: 1 addition & 2 deletions server/interfaces/api/userSettingsInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { NotificationAgentKey } from '@server/lib/settings';
export interface UserSettingsGeneralResponse {
username?: string;
email?: string;
discordId?: string;
locale?: string;
discoverRegion?: string;
streamingRegion?: string;
Expand All @@ -26,7 +25,7 @@ export interface UserSettingsNotificationsResponse {
pgpKey?: string;
discordEnabled?: boolean;
discordEnabledTypes?: number;
discordId?: string;
discordIds?: string[];
pushbulletAccessToken?: string;
pushoverApplicationToken?: string;
pushoverUserKey?: string;
Expand Down
Loading
Loading