So to perform any action with your bot you need to have created one: https://techimposter.co/posts/telegram-create-a-telegram-bot
When you complete the process, botfather will give you a token. Keep this one safe.
Now in order to get the channelId for a channel that your bot is in, let's add the bot to a channel/group. Your bot should now be one of the members of the group.
If you are lucky, that should be it. But in some cases you might see this:
{ "ok": true, "result": [] }
If you do, then:
Look for the object labelled chat:
"chat": { "id": -911111111, "title": "Group name", "type": "group", "all_members_are_administrators": false }
The ID part is what we are looking for.
Sorted!