$npx -y skills add jezweb/claude-skills --skill google-chat-messagesSend Google Chat messages via incoming webhooks — text, rich cards (cardsV2), threaded replies. TypeScript types, card builder utility, widget reference inline. Use whenever the user wants to post to Google Chat from a script, build a chatbot reply, send a notification card, buil
| 1 | # Google Chat Messages |
| 2 | |
| 3 | Send messages to Google Chat spaces via incoming webhooks. Produces text messages, rich cards (cardsV2), and threaded replies. |
| 4 | |
| 5 | ## What You Produce |
| 6 | |
| 7 | - Text messages with Google Chat formatting |
| 8 | - Rich card messages (cardsV2) with headers, sections, widgets |
| 9 | - Threaded conversations |
| 10 | - Reusable webhook sender utility |
| 11 | |
| 12 | ## Workflow |
| 13 | |
| 14 | ### Step 1: Get Webhook URL |
| 15 | |
| 16 | In Google Chat: |
| 17 | 1. Open a Space > click space name > **Manage webhooks** |
| 18 | 2. Create webhook (name it, optionally add avatar URL) |
| 19 | 3. Copy the webhook URL |
| 20 | |
| 21 | Store the URL as an environment variable or in your secrets manager — never hardcode. |
| 22 | |
| 23 | ### Step 2: Choose Message Type |
| 24 | |
| 25 | | Need | Type | Complexity | |
| 26 | |------|------|------------| |
| 27 | | Simple notification | Text message | Low | |
| 28 | | Structured info (status, digest) | Card message (cardsV2) | Medium | |
| 29 | | Ongoing updates | Threaded replies | Medium | |
| 30 | | Action buttons (open URL) | Card with buttonList | Medium | |
| 31 | |
| 32 | ### Step 3: Send the Message |
| 33 | |
| 34 | Use `assets/webhook-sender.ts` for the sender utility. Use `assets/card-builder.ts` for structured card construction. |
| 35 | |
| 36 | ## Text Formatting |
| 37 | |
| 38 | Google Chat does NOT use standard Markdown. |
| 39 | |
| 40 | | Format | Syntax | Example | |
| 41 | |--------|--------|---------| |
| 42 | | Bold | `*text*` | `*important*` | |
| 43 | | Italic | `_text_` | `_emphasis_` | |
| 44 | | Strikethrough | `~text~` | `~removed~` | |
| 45 | | Monospace | `` `text` `` | `` `code` `` | |
| 46 | | Code block | ` ```text``` ` | Multi-line code | |
| 47 | | Link | `<url\|text>` | `<https://example.com\|Click here>` | |
| 48 | | Mention user | `<users/USER_ID>` | `<users/123456>` | |
| 49 | | Mention all | `<users/all>` | `<users/all>` | |
| 50 | |
| 51 | **Not supported**: `**double asterisks**`, headings (`###`), blockquotes, tables, images inline. |
| 52 | |
| 53 | ### Text Message Example |
| 54 | |
| 55 | ```typescript |
| 56 | await sendText(webhookUrl, '*Build Complete*\n\nBranch: `main`\nStatus: Passed\n<https://ci.example.com/123|View Build>'); |
| 57 | ``` |
| 58 | |
| 59 | ## cardsV2 Structure |
| 60 | |
| 61 | Cards use the cardsV2 format (recommended over legacy cards). |
| 62 | |
| 63 | ```typescript |
| 64 | const message = { |
| 65 | cardsV2: [{ |
| 66 | cardId: 'unique-id', |
| 67 | card: { |
| 68 | header: { |
| 69 | title: 'Card Title', |
| 70 | subtitle: 'Optional subtitle', |
| 71 | imageUrl: 'https://example.com/icon.png', |
| 72 | imageType: 'CIRCLE' // or 'SQUARE' |
| 73 | }, |
| 74 | sections: [{ |
| 75 | header: 'Section Title', // optional |
| 76 | widgets: [ |
| 77 | // widgets go here |
| 78 | ] |
| 79 | }] |
| 80 | } |
| 81 | }] |
| 82 | }; |
| 83 | ``` |
| 84 | |
| 85 | ## Widget Reference |
| 86 | |
| 87 | All widget types available in cardsV2 sections. |
| 88 | |
| 89 | ### textParagraph |
| 90 | |
| 91 | Formatted text block. Supports Google Chat formatting (`*bold*`, `_italic_`, `<url|text>`). |
| 92 | |
| 93 | ```typescript |
| 94 | { |
| 95 | textParagraph: { |
| 96 | text: '*Status*: All systems operational\n_Last checked_: 5 minutes ago' |
| 97 | } |
| 98 | } |
| 99 | ``` |
| 100 | |
| 101 | ### decoratedText |
| 102 | |
| 103 | Labelled value with optional icons. Most versatile widget for key-value data. |
| 104 | |
| 105 | **Basic:** |
| 106 | ```typescript |
| 107 | { |
| 108 | decoratedText: { |
| 109 | topLabel: 'Environment', |
| 110 | text: 'Production', |
| 111 | bottomLabel: 'Last deployed 2h ago' |
| 112 | } |
| 113 | } |
| 114 | ``` |
| 115 | |
| 116 | **With start icon:** |
| 117 | ```typescript |
| 118 | { |
| 119 | decoratedText: { |
| 120 | topLabel: 'Status', |
| 121 | text: 'Healthy', |
| 122 | startIcon: { knownIcon: 'STAR' } |
| 123 | } |
| 124 | } |
| 125 | ``` |
| 126 | |
| 127 | **With custom icon URL:** |
| 128 | ```typescript |
| 129 | { |
| 130 | decoratedText: { |
| 131 | topLabel: 'GitHub', |
| 132 | text: 'PR #142 merged', |
| 133 | startIcon: { |
| 134 | iconUrl: 'https://github.githubassets.com/favicons/favicon.svg', |
| 135 | altText: 'GitHub' |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | ``` |
| 140 | |
| 141 | **With button:** |
| 142 | ```typescript |
| 143 | { |
| 144 | decoratedText: { |
| 145 | topLabel: 'Alert', |
| 146 | text: 'CPU at 95%', |
| 147 | button: { |
| 148 | text: 'View', |
| 149 | onClick: { openLink: { url: 'https://monitoring.example.com' } } |
| 150 | } |
| 151 | } |
| 152 | } |
| 153 | ``` |
| 154 | |
| 155 | **Clickable (whole widget):** |
| 156 | ```typescript |
| 157 | { |
| 158 | decoratedText: { |
| 159 | text: 'View full report', |
| 160 | wrapText: true, |
| 161 | onClick: { openLink: { url: 'https://reports.example.com' } } |
| 162 | } |
| 163 | } |
| 164 | ``` |
| 165 | |
| 166 | **With wrap text:** |
| 167 | ```typescript |
| 168 | { |
| 169 | decoratedText: { |
| 170 | topLabel: 'Description', |
| 171 | text: 'This is a longer description that should wrap to multiple lines instead of being truncated', |
| 172 | wrapText: true |
| 173 | } |
| 174 | } |
| 175 | ``` |
| 176 | |
| 177 | ### buttonList |
| 178 | |
| 179 | One or more action buttons. Buttons open URLs or trigger actions. |
| 180 | |
| 181 | **Single button:** |
| 182 | ```typescript |
| 183 | { |
| 184 | buttonList: { |
| 185 | buttons: [{ |
| 186 | text: 'Open Dashboard', |
| 187 | onClick: { openLink: { url: 'https://dashboard.example.com' } } |
| 188 | }] |
| 189 | } |
| 190 | } |
| 191 | ``` |
| 192 | |
| 193 | **Multiple buttons:** |
| 194 | ```typescript |
| 195 | { |
| 196 | buttonList: { |
| 197 | buttons: [ |
| 198 | { |
| 199 | text: 'Approve', |
| 200 | onClick: { openLink: { url: 'https://app.example.com/approve/123' } }, |
| 201 | color: { red: 0, green: 0.5, blue: 0, alpha: 1 } |
| 202 | }, |
| 203 | { |
| 204 | text: 'Reject', |
| 205 | onClick: { openLink: { url: 'https://app.example.com/reject/123' |