Skip to content

xmtplabs/xmtp-agent-examples / skills/creating-inline-actions

creating-inline-actions

Verified

Interactive button-based UI for XMTP agents following XIP-67. Use when creating menus, confirmation dialogs, selection options, or any button-based interaction. Triggers on inline actions, buttons, menus, or ActionBuilder.

FileKindSize
SKILL.mdskill md4.0 KB
rules/builder-create.mdmarkdown1.2 KB
rules/config-menus.mdmarkdown1.5 KB
rules/helpers-confirmation.mdmarkdown947 B
rules/helpers-selection.mdmarkdown1.1 KB

rules/config-menus.md

View on GitHub
---
title: Configure multi-menu applications
impact: MEDIUM
tags: inline-actions, config, menus, navigation
---

## Configure multi-menu applications

Use `AppConfig` for complex bots with multiple menus.

**Define app configuration:**

```typescript
import { AppConfig, initializeAppFromConfig, showMenu } from "../../utils/inline-actions";

const config: AppConfig = {
  name: "My Bot",
  menus: {
    "main-menu": {
      id: "main-menu",
      title: "Main Menu",
      actions: [
        { id: "products-menu", label: "🛍️ Browse Products" },
        { id: "cart-menu", label: "🛒 View Cart" },
        { id: "help", label: "❓ Help", handler: helpHandler },
      ],
    },
    "products-menu": {
      id: "products-menu",
      title: "Products",
      actions: [
        { id: "buy-item-1", label: "Item 1 - $10", handler: buyItem1 },
        { id: "buy-item-2", label: "Item 2 - $20", handler: buyItem2 },
        { id: "main-menu", label: "⬅️ Back" },
      ],
    },
  },
  options: {
    autoShowMenuAfterAction: true,
    defaultNavigationMessage: "What would you like to do next?",
  },
};

// Initialize the app
initializeAppFromConfig(config);
```

**Show a menu:**

```typescript
agent.on("text", async (ctx) => {
  const text = ctx.message.content.toLowerCase();
  if (text === "menu" || text === "hi") {
    await showMenu(ctx, config, "main-menu");
  }
});
```

**Auto-navigation:**

Actions without handlers that match menu IDs automatically navigate to that menu.
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall