pull/3515/merge
Kevin Nguyen 2 weeks ago committed by GitHub
commit 4a465c61d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1238,6 +1238,8 @@ components:
type: string
chatId:
type: string
messageThreadId:
type: string
sendSilently:
type: boolean
PushbulletSettings:
@ -1721,6 +1723,9 @@ components:
telegramChatId:
type: string
nullable: true
telegramMessageThreadId:
type: string
nullable: true
telegramSendSilently:
type: boolean
nullable: true

@ -18,6 +18,7 @@ interface TelegramMessagePayload {
text: string;
parse_mode: string;
chat_id: string;
message_thread_id: string;
disable_notification: boolean;
}
@ -26,6 +27,7 @@ interface TelegramPhotoPayload {
caption: string;
parse_mode: string;
chat_id: string;
message_thread_id: string;
disable_notification: boolean;
}
@ -178,6 +180,7 @@ class TelegramAgent
await axios.post(endpoint, {
...notificationPayload,
chat_id: settings.options.chatId,
message_thread_id: settings.options.messageThreadId,
disable_notification: !!settings.options.sendSilently,
} as TelegramMessagePayload | TelegramPhotoPayload);
} catch (e) {

@ -177,6 +177,7 @@ export interface NotificationAgentTelegram extends NotificationAgentConfig {
botUsername?: string;
botAPI: string;
chatId: string;
messageThreadId: string;
sendSilently: boolean;
};
}
@ -357,6 +358,7 @@ class Settings {
options: {
botAPI: '',
chatId: '',
messageThreadId: '',
sendSilently: false,
},
},

@ -23,6 +23,9 @@ const messages = defineMessages({
chatId: 'Chat ID',
chatIdTip:
'Start a chat with your bot, add <GetIdBotLink>@get_id_bot</GetIdBotLink>, and issue the <code>/my_id</code> command',
messageThreadId: 'Thread/Topic ID',
messageThreadIdTip:
"If your group-chat has topics enabled, you can specify a thread/topic's ID here",
validationBotAPIRequired: 'You must provide a bot authorization token',
validationChatIdRequired: 'You must provide a valid chat ID',
telegramsettingssaved: 'Telegram notification settings saved successfully!',
@ -64,6 +67,7 @@ const NotificationsTelegram = () => {
/^-?\d+$/,
intl.formatMessage(messages.validationChatIdRequired)
),
messageThreadId: Yup.string().nullable(),
});
if (!data && !error) {
@ -78,6 +82,7 @@ const NotificationsTelegram = () => {
botUsername: data?.options.botUsername,
botAPI: data?.options.botAPI,
chatId: data?.options.chatId,
messageThreadId: data?.options.messageThreadId,
sendSilently: data?.options.sendSilently,
}}
validationSchema={NotificationsTelegramSchema}
@ -89,6 +94,7 @@ const NotificationsTelegram = () => {
options: {
botAPI: values.botAPI,
chatId: values.chatId,
messageThreadId: values.messageThreadId,
sendSilently: values.sendSilently,
botUsername: values.botUsername,
},
@ -137,6 +143,7 @@ const NotificationsTelegram = () => {
options: {
botAPI: values.botAPI,
chatId: values.chatId,
messageThreadId: values.messageThreadId,
sendSilently: values.sendSilently,
botUsername: values.botUsername,
},
@ -269,6 +276,28 @@ const NotificationsTelegram = () => {
)}
</div>
</div>
<div className="form-row">
<label htmlFor="messageThreadId" className="text-label">
{intl.formatMessage(messages.messageThreadId)}
<span className="label-tip">
{intl.formatMessage(messages.messageThreadIdTip)}
</span>
</label>
<div className="form-input-area">
<div className="form-input-field">
<Field
id="messageThreadId"
name="messageThreadId"
type="text"
/>
</div>
{errors.messageThreadId &&
touched.messageThreadId &&
typeof errors.messageThreadId === 'string' && (
<div className="error">{errors.messageThreadId}</div>
)}
</div>
</div>
<div className="form-row">
<label htmlFor="sendSilently" className="checkbox-label">
<span>{intl.formatMessage(messages.sendSilently)}</span>

@ -625,6 +625,8 @@
"components.Settings.Notifications.encryptionNone": "None",
"components.Settings.Notifications.encryptionOpportunisticTls": "Always use STARTTLS",
"components.Settings.Notifications.encryptionTip": "In most cases, Implicit TLS uses port 465 and STARTTLS uses port 587",
"components.Settings.Notifications.messageThreadId": "Thread/Topic ID",
"components.Settings.Notifications.messageThreadIdTip": "If your group-chat has topics enabled, you can specify a thread/topic's ID here",
"components.Settings.Notifications.pgpPassword": "PGP Password",
"components.Settings.Notifications.pgpPasswordTip": "Sign encrypted email messages using <OpenPgpLink>OpenPGP</OpenPgpLink>",
"components.Settings.Notifications.pgpPrivateKey": "PGP Private Key",

Loading…
Cancel
Save