build_webex_adaptive_card
Build Webex Adaptive Cards using simple inputs like title, text, facts, and actions, without writing JSON schema. Returns structured card data ready to send.
Instructions
Build an Adaptive Card from high-level inputs without hand-crafting the schema.
Returns card_body and card_actions ready to pass directly to send_webex_adaptive_card. Makes no API calls — pure construction only.
Args: title: Card title displayed as bold text (required) body_text: Optional body paragraph displayed below the title/subtitle subtitle: Optional subtitle displayed below the title in muted text image_url: Optional image URL displayed in the card facts: Optional list of {"title": "...", "value": "..."} key-value pairs displayed as a FactSet table actions: Optional list of action dicts. Each must have "type" ("url" or "submit") and "title". URL actions also need "url"; submit actions accept optional "data". Example: [{"type": "url", "title": "Open", "url": "https://example.com"}] style: Container accent color — "default", "emphasis", "good", "warning", or "attention"
Returns: Dict with "card_body" and "card_actions" keys ready for send_webex_adaptive_card, or a standardized error response dict if validation fails.
Examples: card = build_webex_adaptive_card( title="Deployment Complete", subtitle="Production • v2.3.1", body_text="All health checks passed.", facts=[{"title": "Region", "value": "us-east-1"}, {"title": "Duration", "value": "4m 12s"}], actions=[{"type": "url", "title": "View Dashboard", "url": "https://dash.example.com"}], style="good", ) result = send_webex_adaptive_card(room_id="...", fallback_text="Deployment Complete", **card)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| facts | No | ||
| style | No | default | |
| title | Yes | ||
| actions | No | ||
| subtitle | No | ||
| body_text | No | ||
| image_url | No |