# Custom channel for telegram: how to access chat\_id for telegram bot

**URL:** <https://forum.rasa.com/t/custom-channel-for-telegram-how-to-access-chat-id-for-telegram-bot/43856>\
**Category:** Rasa Open Source\
**Created:** [May 23, 2021, 10:31am UTC](https://forum.rasa.com/t/custom-channel-for-telegram-how-to-access-chat-id-for-telegram-bot/43856 "2021-05-23T10:31:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ccloud](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@ccloud](https://forum.rasa.com/u/ccloud)\
**Post date:** [May 23, 2021, 10:31am UTC](https://forum.rasa.com/t/custom-channel-for-telegram-how-to-access-chat-id-for-telegram-bot/43856/1 "2021-05-23T10:31:57Z")

</div>

hi. im trying to make a custom channel for my bot. I just copied the telegram channel file from rasa core, and tried to add a function for pagination. i tried following this tutorial here: [python-telegram-bot-pagination · PyPI](https://pypi.org/project/python-telegram-bot-pagination/)

CODE #1 (usage example from api):

```auto
from telegram_bot_pagination import InlineKeyboardPaginator

    paginator = InlineKeyboardPaginator(
        page_count,
        current_page=page,
        data_pattern='page#{page}'
    )

    bot.send_message(
        chat_id,
        text,
        reply_markup=paginator.markup,
    )

```

this is how i added it in my cusom\_channel.py: (although im also not sure if i did it correctly)

CODE #2 (custom\_channel.py)

```auto
async def send_paginate(
        self, recipient_id: Text, chat_id, list_pages: List, page=1, **kwargs: Any
    ) -> None:

        paginator = InlineKeyboardPaginator(
            len(list_pages),
            current_page=page,
            data_pattern='page#{page}'
        )

        self.send_message(
            chat_id,
            list_pages[page-1],
            reply_markup=paginator.markup
        )

```

how do i access the chat\_id? where can i get this info? so far, it does not give any errors when i run it, but i tried adding in the actions.py:

CODE #3 (actions.py)

```auto
dispatcher.utter_message(list_pages=list_pages)

```

but i checked and it doesnt call the “send\_paginate” function, and instead calls the “send\_text\_message” function (which is already found initially in the telegram.py channel of rasa core)

just to reiterate, my questions are:

1.) am i implementing telegram pagination api (CODE#1), to my custom channel (CODE#2) correctly? is there any error in my code, perhaps syntax wise?

2.) how do i access the needed variable chat\_id for the paginate function (CODE#2)?

3.) am i calling the function “send\_paginate” correctly in my actions.py (CODE#3)? should i be using a different function to call it? and should i also pass a value for chat\_id or is this passed in the custom\_channel.py?

im really sorry if im all over the place or if my questions dont make sense (ノAヽ). i really hope someone could help me. thank u so much!
