Skip to main content
POST
/
messages
Create message
curl --request POST \
  --url https://api.whop.com/api/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "channel_id": "<string>",
  "content": "<string>",
  "attachments": [
    {
      "id": "<string>"
    }
  ],
  "auto_detect_links": true,
  "poll": {
    "options": [
      {
        "id": "<string>",
        "text": "<string>"
      }
    ]
  },
  "replying_to_message_id": "<string>"
}
'
import requests

url = "https://api.whop.com/api/v1/messages"

payload = {
"channel_id": "<string>",
"content": "<string>",
"attachments": [{ "id": "<string>" }],
"auto_detect_links": True,
"poll": { "options": [
{
"id": "<string>",
"text": "<string>"
}
] },
"replying_to_message_id": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
channel_id: '<string>',
content: '<string>',
attachments: [{id: '<string>'}],
auto_detect_links: true,
poll: {options: [{id: '<string>', text: '<string>'}]},
replying_to_message_id: '<string>'
})
};

fetch('https://api.whop.com/api/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whop.com/api/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'channel_id' => '<string>',
'content' => '<string>',
'attachments' => [
[
'id' => '<string>'
]
],
'auto_detect_links' => true,
'poll' => [
'options' => [
[
'id' => '<string>',
'text' => '<string>'
]
]
],
'replying_to_message_id' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.whop.com/api/v1/messages"

payload := strings.NewReader("{\n \"channel_id\": \"<string>\",\n \"content\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"auto_detect_links\": true,\n \"poll\": {\n \"options\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n },\n \"replying_to_message_id\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.whop.com/api/v1/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"channel_id\": \"<string>\",\n \"content\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"auto_detect_links\": true,\n \"poll\": {\n \"options\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n },\n \"replying_to_message_id\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.whop.com/api/v1/messages")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"channel_id\": \"<string>\",\n \"content\": \"<string>\",\n \"attachments\": [\n {\n \"id\": \"<string>\"\n }\n ],\n \"auto_detect_links\": true,\n \"poll\": {\n \"options\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\"\n }\n ]\n },\n \"replying_to_message_id\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "content": "Hey, are you available for a **quick call**?",
  "created_at": "2023-12-01T05:00:00.401Z",
  "id": "<string>",
  "is_edited": true,
  "is_pinned": true,
  "mentions": [
    "<string>"
  ],
  "mentions_everyone": true,
  "poll": {
    "options": [
      {
        "id": "<string>",
        "text": "<string>"
      }
    ]
  },
  "poll_votes": [
    {
      "count": 42,
      "option_id": "<string>"
    }
  ],
  "reaction_counts": [
    {
      "count": 42,
      "emoji": "<string>"
    }
  ],
  "replying_to_message_id": "<string>",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "user": {
    "id": "user_xxxxxxxxxxxxx",
    "name": "John Doe",
    "username": "johndoe42"
  },
  "view_count": 42
}
{
"error": {
"code": "parameter_missing",
"message": "Missing required parameter: amount.",
"param": "amount",
"type": "invalid_request_error"
}
}
{
"error": {
"message": "Invalid or missing API key",
"type": "unauthorized"
}
}
{
"error": {
"message": "You do not have permission to access this resource",
"type": "forbidden"
}
}
{
"error": {
"message": "Resource not found",
"type": "not_found"
}
}
{
"error": null
}
{
"error": null
}
{
"error": {
"message": "An unexpected error occurred",
"type": "internal_server_error"
}
}

Authorizations

Authorization
string
header
required

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 ***************************

Body

application/json

Parameters for CreateMessage

channel_id
string
required

The unique identifier of the channel or experience to send the message in. For example, 'exp_xxxxx' or 'feed_xxxxx'.

content
string
required

The body of the message in Markdown format. For example, 'Hello world'.

attachments
FileInputWithId · object[] | null

A list of file attachments to include with the message, such as images or videos.

Automatically detect URLs in the message and generate link previews.

poll
object | null

A poll to attach to this message, allowing recipients to vote on options.

replying_to_message_id
string | null

The unique identifier of the message this is replying to, creating a threaded reply.

Response

A successful response

A message sent within an experience chat, direct message, or group chat.

content
string | null
required

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
string<date-time>
required

The timestamp when this message was originally created.

Example:

"2023-12-01T05:00:00.401Z"

id
string
required

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.

is_edited
boolean
required

Whether the message content has been edited after it was originally sent.

is_pinned
boolean
required

Whether this message is pinned to the top of the channel for easy access.

mentions
string[]
required

A list of user IDs that are explicitly mentioned in this message.

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.

mentions_everyone
boolean
required

Whether the message includes an @everyone mention that notifies all channel members.

message_type
enum<string>
required

The classification of this message: regular, system, or automated.

Available options:
regular,
system,
automated
poll
object | null
required

A poll attached to this message. Null if the message does not contain a poll.

poll_votes
object[]
required

Aggregated reaction counts on this message, filtered to a specific reaction type.

reaction_counts
object[]
required

Aggregated reaction counts on this message, filtered to a specific reaction type.

replying_to_message_id
string | null
required

The unique identifier of the message this post is replying to. Null if this is not a reply.

updated_at
string<date-time>
required

The timestamp when this message was last modified.

Example:

"2023-12-01T05:00:00.401Z"

user
object
required

The user who authored this message.

view_count
integer | null
required

The number of unique views this message has received. Null if view tracking is not enabled for this channel.

Example:

42