Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setWebhookInfo does not correctly set the allowed_updates field. CURL works #1222

Open
Jessica0813 opened this issue Aug 21, 2024 · 2 comments

Comments

@Jessica0813
Copy link

I have read:

I am using the latest version of the library.

Expected Behavior

allowed_updates should be set when calling the setWebhookInfo function

Actual Behavior

allowed_updates is not set when calling the setWebhookInfo function

Steps to reproduce the Behavior

  1. delete the webhook
  2. execute setWebhookInfo with custom allowed_updates fields
  3. execute getWebhookInfo and see that allowed_updates is not set
  4. execute curl command with setWebhookInfo with allowed_updates field in the body
  5. execute getWebhookInfo and see that allowed_updates is correctly set.
@Makc0809
Copy link

I have the same problem, but I do through:

const allowed = ["chat_member", "message", "my_chat_member"];

export const bot = new TelegramApi(
    process.env.TG_KEY,
    {
      polling: {
        allowed_updates: allowed,
      }
    });

also try:

export const bot = new TelegramApi(
    process.env.TG_KEY,
    {
      polling: {
        params: {
               allowed_updates: allowed,
          }
      }
    });

At the same time, if I call just through the browser:
https://api.telegram.org/botMY_TOKEN/getUpdates?allowed_updates=["chat_member", "message", "my_chat_member"]

and check by accessing /getWebhookInfo, I can see that the parameters were successfully set....

@Makc0809
Copy link

Update!

export const bot = new TelegramApi(
    process.env.TG_KEY,
    {
      polling: {
        params: {
               allowed_updates: JSON.stringify(allowed),
          }
      }
    });

JSON.stringify - fix this problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants