> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create message

> Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies.

Required permissions:
 - `chat:message:create`



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/whopsdk/openapi.documented.yml post /messages
openapi: 3.1.0
info:
  title: Whop API
  description: >-
    The Whop REST API. Please see
    https://docs.whop.com/developer/api/getting-started for more details.
  termsOfService: https://whop.com/tos-developer-api/
  version: 1.0.0
servers:
  - url: https://api.whop.com/api/v1
    description: Production Whop API
security: []
tags:
  - name: Products
    description: Products
  - name: Plans
    description: Plans
  - name: Payments
    description: Payments
  - name: Refunds
    description: Refunds
  - name: Disputes
    description: Disputes
  - name: Dispute alerts
    description: Dispute alerts
  - name: Resolution center cases
    description: Resolution center cases
  - name: Checkout configurations
    description: Checkout configurations
  - name: Setup intents
    description: Setup intents
  - name: Payment methods
    description: Payment methods
  - name: Invoices
    description: Invoices
  - name: Promo codes
    description: Promo codes
  - name: Card transactions
    description: Card transactions
  - name: Ledger accounts
    description: Ledger accounts
  - name: Transfers
    description: Transfers
  - name: Withdrawals
    description: Withdrawals
  - name: Payout methods
    description: Payout methods
  - name: Verifications
    description: Verifications
  - name: Payout accounts
    description: Payout accounts
  - name: Topups
    description: Topups
  - name: Users
    description: Users
  - name: Companies
    description: Companies
  - name: Authorized users
    description: Authorized users
  - name: Fee markups
    description: Fee markups
  - name: Members
    description: Members
  - name: Memberships
    description: Memberships
  - name: Leads
    description: Leads
  - name: Entries
    description: Entries
  - name: Shipments
    description: Shipments
  - name: Reviews
    description: Reviews
  - name: Company token transactions
    description: Company token transactions
  - name: Affiliates
    description: Affiliates
  - name: Experiences
    description: Experiences
  - name: Forums
    description: Forums
  - name: Forum posts
    description: Forum posts
  - name: Chat channels
    description: Chat channels
  - name: Support channels
    description: Support channels
  - name: Messages
    description: Messages
  - name: Reactions
    description: Reactions
  - name: Dm members
    description: Dm members
  - name: Dm channels
    description: Dm channels
  - name: Notifications
    description: Notifications
  - name: Courses
    description: Courses
  - name: Course chapters
    description: Course chapters
  - name: Course lessons
    description: Course lessons
  - name: Course students
    description: Course students
  - name: Course lesson interactions
    description: Course lesson interactions
  - name: Apps
    description: Apps
  - name: Webhooks
    description: Webhooks
  - name: App builds
    description: App builds
  - name: Access tokens
    description: Access tokens
  - name: Account links
    description: Account links
  - name: Files
    description: Files
  - name: Ai chats
    description: Ai chats
  - name: Bounties
    description: Bounties
  - name: Stats
    description: Stats
  - name: Ad campaigns
    description: Ad campaigns
  - name: Ad groups
    description: Ad groups
  - name: Ads
    description: Ads
  - name: Conversions
    description: Conversions
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Create message
      description: >-
        Send a new message in an experience chat, DM, or group chat channel.
        Supports text content, attachments, polls, and replies.


        Required permissions:
         - `chat:message:create`
      operationId: createMessage
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                channel_id:
                  type: string
                  description: >-
                    The unique identifier of the channel or experience to send
                    the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'.
                content:
                  type: string
                  description: >-
                    The body of the message in Markdown format. For example,
                    'Hello **world**'.
                attachments:
                  type:
                    - array
                    - 'null'
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        description: The ID of an existing file object.
                    required:
                      - id
                    description: Input for an attachment
                    title: FileInputWithId
                  description: >-
                    A list of file attachments to include with the message, such
                    as images or videos.
                auto_detect_links:
                  type:
                    - boolean
                    - 'null'
                  description: >-
                    Automatically detect URLs in the message and generate link
                    previews.
                poll:
                  type:
                    - object
                    - 'null'
                  properties:
                    options:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                            description: >-
                              Sequential ID for the poll option (starting from
                              '1')
                          text:
                            type: string
                            description: The text of the poll option
                        required:
                          - id
                          - text
                        description: Input type for a single poll option
                      description: >-
                        The options for the poll. Must have sequential IDs
                        starting from 1
                  required:
                    - options
                  description: >-
                    A poll to attach to this message, allowing recipients to
                    vote on options.
                replying_to_message_id:
                  type:
                    - string
                    - 'null'
                  description: >-
                    The unique identifier of the message this is replying to,
                    creating a threaded reply.
              required:
                - channel_id
                - content
              description: Parameters for CreateMessage
      responses:
        '200':
          description: A successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: invalid_request_error
                  code: parameter_missing
                  message: 'Missing required parameter: amount.'
                  param: amount
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: unauthorized
                  message: Invalid or missing API key
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: forbidden
                  message: You do not have permission to access this resource
        '404':
          description: Not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: not_found
                  message: Resource not found
        '422':
          description: Verification required
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error: null
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      message:
                        type: string
                      code:
                        type:
                          - string
                          - 'null'
                        description: >-
                          A short string indicating the specific error code,
                          e.g. 'parameter_missing', 'parameter_invalid',
                          'invalid_json'
                      param:
                        type:
                          - string
                          - 'null'
                        description: The parameter that caused the error, if applicable
                    required:
                      - type
                      - message
                required:
                  - error
              example:
                error:
                  type: internal_server_error
                  message: An unexpected error occurred
      security:
        - bearerAuth:
            - chat:message:create
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Whop from '@whop/sdk';


            const client = new Whop({
              apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
            });


            const message = await client.messages.create({ channel_id:
            'channel_id', content: 'content' });


            console.log(message.id);
        - lang: Python
          source: |-
            import os
            from whop_sdk import Whop

            client = Whop(
                api_key=os.environ.get("WHOP_API_KEY"),  # This is the default and can be omitted
            )
            message = client.messages.create(
                channel_id="channel_id",
                content="content",
            )
            print(message.id)
        - lang: Ruby
          source: >-
            require "whop_sdk"


            whop = WhopSDK::Client.new(api_key: "My API Key")


            message = whop.messages.create(channel_id: "channel_id", content:
            "content")


            puts(message)
components:
  schemas:
    Message:
      type: object
      properties:
        id:
          type: string
          description: >-
            Represents a unique identifier that is Base64 obfuscated. It is
            often used to refetch an object or as key for a cache. The ID type
            appears in a JSON response as a String; however, it is not intended
            to be human-readable. When expected as an input type, any string
            (such as `"VXNlci0xMA=="`) or integer (such as `4`) input value will
            be accepted as an ID.
        content:
          type:
            - string
            - 'null'
          description: >-
            The message content formatted as Markdown. Null if the message has
            no text content.
          example: Hey, are you available for a **quick call**?
        created_at:
          type: string
          format: date-time
          description: The timestamp when this message was originally created.
          example: '2023-12-01T05:00:00.401Z'
        updated_at:
          type: string
          format: date-time
          description: The timestamp when this message was last modified.
          example: '2023-12-01T05:00:00.401Z'
        poll:
          type:
            - object
            - 'null'
          properties:
            options:
              type:
                - array
                - 'null'
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: The unique identifier for the poll option.
                  text:
                    type: string
                    description: The text of the poll option
                required:
                  - id
                  - text
                description: Represents a single poll option
              description: The options for the poll
          required:
            - options
          description: >-
            A poll attached to this message. Null if the message does not
            contain a poll.
        replying_to_message_id:
          type:
            - string
            - 'null'
          description: >-
            The unique identifier of the message this post is replying to. Null
            if this is not a reply.
        is_edited:
          type: boolean
          description: >-
            Whether the message content has been edited after it was originally
            sent.
        is_pinned:
          type: boolean
          description: >-
            Whether this message is pinned to the top of the channel for easy
            access.
        message_type:
          $ref: '#/components/schemas/DmsPostTypes'
          description: 'The classification of this message: regular, system, or automated.'
        mentions:
          type: array
          items:
            type: string
            description: >-
              Represents a unique identifier that is Base64 obfuscated. It is
              often used to refetch an object or as key for a cache. The ID type
              appears in a JSON response as a String; however, it is not
              intended to be human-readable. When expected as an input type, any
              string (such as `"VXNlci0xMA=="`) or integer (such as `4`) input
              value will be accepted as an ID.
          description: A list of user IDs that are explicitly mentioned in this message.
        mentions_everyone:
          type: boolean
          description: >-
            Whether the message includes an @everyone mention that notifies all
            channel members.
        user:
          type: object
          properties:
            id:
              type: string
              description: The unique identifier for the user.
              example: user_xxxxxxxxxxxxx
            username:
              type: string
              description: The user's unique username shown on their public profile.
              example: johndoe42
            name:
              type:
                - string
                - 'null'
              description: The user's display name shown on their public profile.
              example: John Doe
          required:
            - id
            - username
            - name
          description: The user who authored this message.
        view_count:
          type:
            - integer
            - 'null'
          description: >-
            The number of unique views this message has received. Null if view
            tracking is not enabled for this channel.
          example: 42
        reaction_counts:
          type: array
          items:
            type: object
            properties:
              emoji:
                type:
                  - string
                  - 'null'
                description: The emoji that was used in shortcode format (:heart:)
              count:
                type: integer
                description: The number of users who reacted
                example: 42
            required:
              - emoji
              - count
            description: Represents a reaction count for a feed post
          description: >-
            Aggregated reaction counts on this message, filtered to a specific
            reaction type.
        poll_votes:
          type: array
          items:
            type: object
            properties:
              option_id:
                type:
                  - string
                  - 'null'
                description: The reaction that was used
              count:
                type: integer
                description: The number of users who reacted
                example: 42
            required:
              - option_id
              - count
            description: Represents a reaction count for a feed post
          description: >-
            Aggregated reaction counts on this message, filtered to a specific
            reaction type.
      required:
        - id
        - content
        - created_at
        - updated_at
        - poll
        - replying_to_message_id
        - is_edited
        - is_pinned
        - message_type
        - mentions
        - mentions_everyone
        - user
        - view_count
        - reaction_counts
        - poll_votes
      description: A message sent within an experience chat, direct message, or group chat.
    DmsPostTypes:
      type: string
      enum:
        - regular
        - system
        - automated
      description: The types of post
  securitySchemes:
    bearerAuth:
      type: http
      description: >-
        A company API key, company scoped JWT, app API key, or user OAuth token.
        You must prepend your key/token with the word 'Bearer', which will look
        like `Bearer ***************************`
      scheme: bearer
      bearerFormat: auth-scheme

````