---
title: "Fetches recent messages from a specified Discord channel."
method: POST
path: "/fetchMessages"
---

# Fetches recent messages from a specified Discord channel.

`POST /fetchMessages`

This function retrieves a specified number of messages from a channel's history in Discord. It allows fetching up to a certain limit of messages, defaulting to 10 if not specified. The function returns a Promise that resolves to an array of message objects.

## Request body

- object
  - `body` object — Body of the fetchMessages sls call
    - `arguments` unknown[], required
      - unknown
    - `auth` object — Authentication object
      - `strategy` 'apikey' — Authentication strategy
      - `variables` unknown[] — Variables for the authentication strategy
        - unknown
    - `packageName` string — @microfox/discord

## Response `200`

Successful response

- object[]
  - `id` string — Unique identifier of the message
  - `content` string — Content of the message
  - `author` object — Author of the message
    - `id` string — User ID of the author
    - `username` string — Username of the author
  - `timestamp` string, date-time — Timestamp of when the message was sent

## Other responses

- `400` — Bad Request - Invalid parameters
- `403` — Forbidden - Not authorized to access the channel
- `404` — Not Found - Channel does not exist
- `500` — Internal Server Error

---

[API](https://skmtc.net/microfox-ai/apis/microfox-discord-sdk-api.md) · [All operations](https://skmtc.net/microfox-ai/apis/microfox-discord-sdk-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/microfox-ai/microfox-discord-sdk-api/versions/7cb5b64ae924/schema)
