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:Ed25519 signature of the request
Unix timestamp of the request
discord-interactions library to verify signatures against DISCORD_PUBLIC_KEY.
Invalid Signature
401 Unauthorized.
Available Commands
/search
Search for components by name or category.Search query (matches component name or category)
Filter by component type:
skillsagentscommandsmcpssettingshookstemplatesplugins
Response
Returns Discord embed with search results (up to 10 matches):- Exact match: score 100
- Starts with query: score 50
- Contains query: score 20
/info
Get detailed information about a specific component.Component name
Component type (if omitted, searches all types)
Response
Returns Discord embed with component details:Component Not Found
flags: 64 makes the message ephemeral (only visible to the user).
/install
Get installation command for a component.Component name
Component type (if omitted, searches all types)
Response
Returns Discord embed with installation instructions:--template flag instead of --templates.
/popular
Show the most downloaded component of a specific type.Component type to filter by
Response
Returns the component with the highest download count:/random
Show a random component of a specific type.Component type to filter by
Response
Returns a randomly selected component (same format as/popular).
Component Cache
The endpoint caches component data fromhttps://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:| Type | Icon | Color (Hex) |
|---|---|---|
| skills | 🎨 | #9B59B6 |
| agents | 🤖 | #FF6B6B |
| commands | ⚡ | #4ECDC4 |
| mcps | 🔌 | #95E1D3 |
| settings | ⚙️ | #F9CA24 |
| hooks | 🪝 | #6C5CE7 |
| templates | 📋 | #A8E6CF |
| plugins | 🧩 | #FFD93D |
Error Handling
405 Method Not Allowed
500 Server Configuration Error
DISCORD_PUBLIC_KEY is not configured.
Generic Command Error
If a command fails (e.g., network error fetching components):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