Skip to main content
Glama
mikemc
by mikemc

twist_threads_add

Create a new discussion thread in a Twist channel with title, content, attachments, and customizable notifications for users and groups.

Instructions

Adds a new thread to a channel.

Args: channel_id: The id of the channel title: The title of the new thread content: The content of the new thread actions: List of action buttons to the new thread attachments: List of attachments to the new thread direct_group_mentions: The groups that are directly mentioned direct_mentions: The users that are directly mentioned groups: The groups that will be notified recipients: An array of users that will be attached to the thread or "EVERYONE" send_as_integration: Displays the integration as the thread creator temp_id: The temporary id of the thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channel_idYes
titleYes
contentYes
actionsNo
attachmentsNo
direct_group_mentionsNo
direct_mentionsNo
groupsNo
recipientsNo
send_as_integrationNo
temp_idNo

Implementation Reference

  • Handler function that implements the twist_threads_add tool by calling the Twist API endpoint 'threads/add' with the provided parameters.
    def twist_threads_add(
        ctx: Context,
        channel_id: int,
        title: str,
        content: str,
        actions: Optional[List[Dict[str, Any]]] = None,
        attachments: Optional[List[Dict[str, Any]]] = None,
        direct_group_mentions: Optional[List[int]] = None,
        direct_mentions: Optional[List[int]] = None,
        groups: Optional[List[int]] = None,
        recipients: Optional[Union[List[int], str]] = None,
        send_as_integration: Optional[bool] = None,
        temp_id: Optional[int] = None
    ) -> Union[str, Dict[str, Any]]:
        """Adds a new thread to a channel.
    
        Args:
            channel_id: The id of the channel
            title: The title of the new thread
            content: The content of the new thread
            actions: List of action buttons to the new thread
            attachments: List of attachments to the new thread
            direct_group_mentions: The groups that are directly mentioned
            direct_mentions: The users that are directly mentioned
            groups: The groups that will be notified
            recipients: An array of users that will be attached to the thread or "EVERYONE"
            send_as_integration: Displays the integration as the thread creator
            temp_id: The temporary id of the thread
        """
        all_params = locals()
        token = ctx.request_context.lifespan_context.twist_token
        params = {k: v for k, v in all_params.items() if k != 'ctx' and v is not None}
    
        try:
            logger.info(f"Adding thread to channel ID: {channel_id}")
            thread_data = twist_request("threads/add", params=params, token=token, method="POST")
            logger.info(f"Added thread with ID: {thread_data.get('id')}")
            return thread_data
        except Exception as error:
            logger.error(f"Error adding thread: {error}")
            return f"Error adding thread: {str(error)}"

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/mikemc/twist-mcp-server'

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