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

Telegram private channels cannot be used with @-prefix syntax #249

Closed
JosephKav opened this issue May 24, 2022 · 5 comments · Fixed by #250
Closed

Telegram private channels cannot be used with @-prefix syntax #249

JosephKav opened this issue May 24, 2022 · 5 comments · Fixed by #250

Comments

@JosephKav
Copy link
Contributor

The docs say that 'Props can be either supplied using the params argument, or through the URL', but when chats/channel isn't declared in the url, you get an error initializing router services: no channels defined in config URL
https://containrrr.dev/shoutrrr/v0.5/services/telegram/#queryparam_props

I wasn't sure how exactly to go about doing this. I'd be able to give other places where this may happen a go if I encounter it again (and a PR for this is done)

Also, I'd recommend adding this comment to the docs as it makes getting the channel ID a lot easier! That 't.me/' method didn't work for me.

JosephKav added a commit to release-argus/Argus that referenced this issue May 24, 2022
- raised an issue for telegram not parsing `chats` param as their docs say that it can be a param
containrrr/shoutrrr#249
- removed mentions of slack/gotify in the context of the old notify code
@piksel
Copy link
Member

piksel commented May 25, 2022

The params can be used to override certain settings per message, but if the setting is required, it has to be be configured "globally", or else the initialization logic will complain about it not being specified.

Did you check the link to the dev docs for the updated Chat ID / Channel Name retrieval?
https://containrrr.dev/shoutrrr/dev/services/telegram/#identifying_the_target_chatschannels

t.me/channel is for channel names, not ids, and those need to be prefixed by @.

@JosephKav
Copy link
Contributor Author

JosephKav commented May 25, 2022

The params can be used to override certain settings per message, but if the setting is required, it has to be be configured "globally", or else the initialization logic will complain about it not being specified.

Ah, okay, thanks for letting me know. Would be nice to have this in the docs, but if you don't want to, you can just close this issue

Did you check the link to the dev docs for the updated Chat ID / Channel Name retrieval? https://containrrr.dev/shoutrrr/dev/services/telegram/#identifying_the_target_chatschannels

t.me/channel is for channel names, not ids, and those need to be prefixed by @.

Yeah I tried @+..., @..., %40+...., %40.... a few times each but none of them worked. (Wasn't sure on that + being part of the ID or not, that's why I tried with and without it). Ended up just forwarding the JSON dumper and getting the ID. That worked first time

JosephKav added a commit to release-argus/Argus that referenced this issue May 25, 2022
- raised an issue for telegram not parsing `chats` param as their docs say that it can be a param
containrrr/shoutrrr#249
- removed mentions of slack/gotify in the context of the old notify code
JosephKav added a commit to release-argus/Argus that referenced this issue May 25, 2022
- raised an issue for telegram not parsing `chats` param as their docs say that it can be a param
containrrr/shoutrrr#249
- removed mentions of slack/gotify in the context of the old notify code
@piksel
Copy link
Member

piksel commented May 25, 2022

Oh, I think I know what is going on... When you create a private channel, you cannot set the username of the channel:
image

Instead you get an invite link, but that cannot be used to send messages to. This should definitely be added to the docs. I couldn't get the JsonDumpBot to join a channel, so I don't know how useful it would be. Did you get it to work?
The most straight forward way to set it up is to use the telegram generator:

$ docker run --rm -it containrrr/shoutrrr generate telegram

@JosephKav
Copy link
Contributor Author

JosephKav commented May 25, 2022

Instead you get an invite link, but that cannot be used to send messages to. This should definitely be added to the docs.

Explains my issue ^^ 😄

I couldn't get the JsonDumpBot to join a channel, so I don't know how useful it would be. Did you get it to work? The most straight forward way to set it up is to use the telegram generator:

You don't need them to join the channel, you just forward a message to them and look under message.forward_from_chat.id in the response it gives. The message doesn't need to contain anything, it just needs to be in the channel you want the ID of

{
  "update_id": 144147097,
  "message": {
    "message_id": 596798,
    "from": {
      "id": SECRET?,
      "is_bot": false,
      "first_name": "NAME",
      "last_name": "SURNAME",
      "username": "MY_USERNAME",
      "language_code": "en"
    },
    "chat": {
      "id": SECRET?,
      "first_name": "NAME",
      "last_name": "SURNAME",
      "username": "MY_USERNAME",
      "type": "private"
    },
    "date": 1653422219,
    "forward_from_chat": {
      "id": -1001729411479,
      "title": "Argus",
      "type": "channel"
    },
    "forward_from_message_id": 3,
    "forward_date": 1653421689,
    "text": "@MY_BOT",
    "entities": [
      {
        "offset": 0,
        "length": 13,
        "type": "mention"
      }
    ]
  }
}

Using -1001729411479 in Shoutrrr worked

@piksel piksel changed the title Telegram - chats can't be provided through params Telegram private channels cannot be used with @-prefix syntax May 25, 2022
@piksel
Copy link
Member

piksel commented May 25, 2022

(hijacking the issue for the problem discussed above)

JosephKav added a commit to release-argus/Argus that referenced this issue May 25, 2022
- raised an issue for telegram not parsing `chats` param as their docs say that it can be a param
containrrr/shoutrrr#249
- removed mentions of slack/gotify in the context of the old notify code
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

Successfully merging a pull request may close this issue.

2 participants