Skip to content

Commit

Permalink
Update authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
jotacemarin committed Sep 8, 2024
1 parent 195d568 commit 1ee95ce
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/functions/telegram_send_message/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-message
method: POST
cors: true
authorizer: telegramAuthorizer
1 change: 1 addition & 0 deletions src/functions/telegram_send_photo/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-photo
method: POST
cors: true
authorizer: telegramAuthorizer
1 change: 1 addition & 0 deletions src/functions/telegram_send_video/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/send-video
method: POST
cors: true
authorizer: telegramAuthorizer
1 change: 1 addition & 0 deletions src/functions/telegram_set_webhook/function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ events:
path: /${self:custom.secrets.service.name}-${self:custom.secrets.provider.stage}/telegram/set-webhook
method: POST
cors: true
authorizer: telegramAuthorizer
3 changes: 2 additions & 1 deletion src/lib/services/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios, { AxiosResponse, AxiosInstance } from "axios";
import { EntityTg, UserTg, FormattingOptionsTg } from "../models";
import { MessageTg } from "../models/telegram";

const { TELEGRAM_BOT_TOKEN } = process.env;
const { TELEGRAM_BOT_TOKEN, USERNAME, PASSWORD } = process.env;

interface SetWebhookResponse {
ok: boolean;
Expand Down Expand Up @@ -157,6 +157,7 @@ export class TelegramService {
if (!this.instance) {
this.instance = axios.create({
baseURL: `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}`,
auth: { username: `${USERNAME}`, password: `${PASSWORD}` },
});
}
}
Expand Down

0 comments on commit 1ee95ce

Please sign in to comment.