Skip to main content
Glama

send_poll

Create and send interactive polls to Telegram chats to gather feedback, conduct surveys, or engage users with quiz questions.

Instructions

Send a poll to a Telegram chat.

Args: chat_id: Target chat ID. question: Poll question (1-300 characters). options: List of answer options (2-10 strings). is_anonymous: Whether the poll is anonymous. type: "regular" or "quiz". allows_multiple_answers: Allow multiple answers (regular polls only). disable_notification: Send silently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
chat_idYes
questionYes
optionsYes
is_anonymousNo
typeNoregular
allows_multiple_answersNo
disable_notificationNo

Implementation Reference

  • The implementation of the send_poll MCP tool, which sends a poll to a Telegram chat.
    async def send_poll(
        chat_id: int,
        question: str,
        options: list[str],
        is_anonymous: bool = True,
        type: str = "regular",
        allows_multiple_answers: bool = False,
        disable_notification: bool = False,
    ) -> SendPollResult:
        """Send a poll to a Telegram chat.
    
        Args:
            chat_id: Target chat ID.
            question: Poll question (1-300 characters).
            options: List of answer options (2-10 strings).
            is_anonymous: Whether the poll is anonymous.
            type: "regular" or "quiz".
            allows_multiple_answers: Allow multiple answers (regular polls only).
            disable_notification: Send silently.
        """
        if not ctx.is_chat_allowed(chat_id):
            result = SendPollResult(ok=False, error=f"Chat {chat_id} is not allowed.")
            if ctx.audit_logger:
                ctx.audit_logger.log(
                    "send_poll",
                    {"chat_id": chat_id, "question": question},
                    result.ok,
                    result.error,
                )
            return result
    
        try:
            if ctx.rate_limiter:
                await ctx.rate_limiter.acquire()
            poll_options: list[InputPollOption | str] = [InputPollOption(text=opt) for opt in options]
            msg = await ctx.bot.send_poll(
                chat_id=chat_id,
                question=question,
                options=poll_options,
                is_anonymous=is_anonymous,
                type=type,
                allows_multiple_answers=allows_multiple_answers,
                disable_notification=disable_notification,
            )
            result = SendPollResult(
                ok=True,
                message_id=msg.message_id,
                chat_id=msg.chat.id,
                poll_id=msg.poll.id if msg.poll else None,
            )
        except (TelegramBadRequest, TelegramForbiddenError) as exc:
            result = SendPollResult(ok=False, error=str(exc))
    
        if ctx.audit_logger:
            ctx.audit_logger.log(
                "send_poll",
                {"chat_id": chat_id, "question": question},
                result.ok,
                result.error,
            )
  • The response schema for the send_poll tool.
    class SendPollResult(ToolResponse):
        message_id: int | None = None
        chat_id: int | None = None
        poll_id: str | None = None

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Py2755/aiogram-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server