Skip to main content

Endpoint

POST /api/discord/interactions Handles Discord application command interactions. This endpoint processes slash commands from the Claude Code Templates Discord bot.

Authentication

Requests are authenticated using Ed25519 signature verification:
string
required
Ed25519 signature of the request
string
required
Unix timestamp of the request
The endpoint uses the discord-interactions library to verify signatures against DISCORD_PUBLIC_KEY.

Invalid Signature

Returns 401 Unauthorized.

Available Commands

/search

Search for components by name or category.
string
required
Search query (matches component name or category)
string
Filter by component type:
  • skills
  • agents
  • commands
  • mcps
  • settings
  • hooks
  • templates
  • plugins

Response

Returns Discord embed with search results (up to 10 matches):
Results are ranked by relevance:
  • Exact match: score 100
  • Starts with query: score 50
  • Contains query: score 20

/info

Get detailed information about a specific component.
string
required
Component name
string
Component type (if omitted, searches all types)

Response

Returns Discord embed with component details:

Component Not Found

The flags: 64 makes the message ephemeral (only visible to the user).

/install

Get installation command for a component.
string
required
Component name
string
Component type (if omitted, searches all types)

Response

Returns Discord embed with installation instructions:
Note: Templates use --template flag instead of --templates.

/popular

Show the most downloaded component of a specific type.
string
required
Component type to filter by

Response

Returns the component with the highest download count:

/random

Show a random component of a specific type.
string
required
Component type to filter by

Response

Returns a randomly selected component (same format as /popular).

Component Cache

The endpoint caches component data from https://aitmpl.com/components.json:
  • Cache duration: 5 minutes
  • Cache key: cachedComponents (in-memory)
  • Refresh: Automatic on cache expiration
  • Timeout: 10 seconds for HTTP request

Component Types & Icons

Each component type has an associated icon and color:

Error Handling

405 Method Not Allowed

500 Server Configuration Error

Returned when DISCORD_PUBLIC_KEY is not configured.

Generic Command Error

If a command fails (e.g., network error fetching components):
The error is logged to console but shown generically to the user.

Interaction Types

The endpoint handles two Discord interaction types:

PING (type: 1)

Discord verification ping. Returns:

APPLICATION_COMMAND (type: 2)

Slash command execution. See command responses above.

Example Request

Example curl request (signature headers must be valid):

Notes

  • All embed timestamps use ISO 8601 format
  • Component URLs follow pattern: /component/{singular_type}/{category}/{name}
  • Type names are pluralized in the code but singularized in URLs
  • Ephemeral messages (flags: 64) are only visible to the command user
  • The endpoint returns Discord interaction responses, not standard REST responses