The easiest way is to use a command /channels. It will return a list of your chats and channels with their IDs.
If there is no needed ID in this list, then try another approach:
1. Forward a message from the source channel to the bot @junction_helper0_bot.
2. It will reply you with the message information.
3. There you will see the channel number in field named “forward_from_chat.id”.
4. If a number starts with “-100” just remove “-100” to get a real ID.
This way can fail to work with some groups. Then use another way: click on a post in the source group and select “Copy Link”. You will have in a buffer something like https://t.me/c/123456789/123. Here the middle number is the ID of the group: 123456789.
There is also another way: open the group in Web Telegram and you will see this ID in the browser’s address bar.
If you need to forward messages to a group, use group’s identifier.
For example for a group with id = 123456: /channel 123456 join &1234567890#787878
Notice, that bot should be in a list of administrators of this group.