is this possible withou invoking backup service nor manually pasting by the user?
- User
is this possible withou invoking backup service nor manually pasting by the user?
- Assistant
Short answer: no, not with a “pure” card.
Google Chat’s card-UI is static; it can’t do string substitution inside anopenLink.url.
Anything that changes the URL at click-time (or even at type-time viaonChangeAction) must go through a Chat-app (a back-end) that receives the form event and returns a new card or anactionResponsewith the finished URL.Why it can’t be done client-side
openLink.urlmust be a literal string in the JSON.
Place-holders like{{comment}}are only expanded when they are sent back to the app in theformInputobject—not inside the card itself.- The only interactive hooks (
onChangeAction,action,submitForm) deliver the user’s input to the Chat-app; they do not allow you to mutate the same card without a server round-trip. - A card that is sent by a human (pasted JSON or Card Designer) has no associated “app” to receive those hooks, so the events go nowhere.
What your options really are A. Build a lightweight Chat-app (Apps Script, Cloud Run, any HTTPS endpoint) that: • receives
FORM_CHANGED/CARD_CLICKED,
• readscommentfromformInput,
• replies withactionResponse.openLink.url = baseUrl + encodeURIComponent(comment).
This is the standard pattern in the docs.B. If you can’t run any back-end, the only alternatives are: • Ask the user to copy/paste the comment into a second link (manual).
• Or pre-populate the card with a generic “open Splunk” link that doesn’t include the comment.So, without involving a back-end Chat-app, a button whose URL changes according to the text-input value isn’t possible in Google Chat today.
- User
add me a second button then | eval payload = "{ "cards": [ { "header": { "title": "Alert from Splunk" }, "sections": [ { "widgets": [ { "textParagraph": { "text": "An alert has been triggered. Click below to investigate." } }, { "buttons": [ { "textButton": { "text": "View in Splunk", "onClick": { "openLink": { "url": "https://your-splunk-instance/app/search/search?q=your-search-query" } } } } ] } ] } ] } ] }"
- Assistant
Here’s the same card with two buttons in the same row.
Just copy/paste (or adapt) the one-liner into your SPL alert search.| eval payload="{\"cards\":[{\"header\":{\"title\":\"Alert from Splunk\"},\"sections\":[{\"widgets\":[{\"textParagraph\":{\"text\":\"An alert has been triggered. Click below to investigate.\"}},{\"buttons\":[{\"textButton\":{\"text\":\"View in Splunk\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}},{\"textButton\":{\"text\":\"Runbook\",\"onClick\":{\"openLink\":{\"url\":\"https://your-runbook-url\"}}}}]}]}]}]}"What changed? • Inside the same
buttonsarray we added a secondtextButtonobject (named “Runbook” here—change text/URL as you like).
• Because both buttons live in the same widget, Google Chat renders them side-by-side.Remember to keep the HTTP header:
{"Content-Type": "application/json"}Now your alert card will show two clickable buttons next to each other. 👍
- User
refactor me this to the spl splunk alert { "sections": [ { "widgets": [ { "textParagraph": { "text": "An alert has been triggered. Click below to investigate." } }, { "buttonList": { "buttons": [ { "text": "Odbieram", "type": "OUTLINED", "onClick": { "openLink": { "url": "https://your-splunk-instance/app/search/search?q=your-search-query" } } }, { "text": "Chcę skomentować", "type": "OUTLINED", "color": { "red": 0.1, "green": 0.1, "blue": 0.1, "alpha": 0.1 }, "onClick": { "openLink": { "url": "https://your-splunk-instance/app/search/search?q=your-search-query" } } } ] } } ] } ] }
- Assistant
Below is the same card converted to the one-line, JSON-escaped string that Splunk expects in an
evalstatement.
Just drop this search (or append it at the end of your alert search) and use thepayloadfield as the POST body.| makeresults | eval payload="{\"cards\":[{\"sections\":[{\"widgets\":[{\"textParagraph\":{\"text\":\"An alert has been triggered. Click below to investigate.\"}},{\"buttonList\":{\"buttons\":[{\"text\":\"Odbieram\",\"type\":\"OUTLINED\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}},{\"text\":\"Chcę skomentować\",\"type\":\"OUTLINED\",\"color\":{\"red\":0.1,\"green\":0.1,\"blue\":0.1,\"alpha\":0.1},\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}]}}]}]}]}"That’s it—Splunk will POST a Google-Chat card containing:
• A text paragraph: “An alert has been triggered…”
• Two OUTLINED buttons shown side-by-side:
– “Odbieram” → opens the Splunk URL
– “Chcę skomentować” (with a custom grey tint) → opens the same Splunk URLKeep your HTTP header set to
{"Content-Type": "application/json"}Feel free to change the button texts, colors, or URLs; just edit the highlighted parts in the string.
- User
Przerób mi to co jest po lewej tak aby pasowało do tego layoutu: | eval payload = "{ "cards": [ { "header": { "title": "Alert from Splunk" }, "sections": [ { "widgets": [ { "textParagraph": { "text": "An alert has been triggered. Click below to investigate." } }, { "buttons": [ { "textButton": { "text": "View in Splunk", "onClick": { "openLink": { "url": "https://your-splunk-instance/app/search/search?q=your-search-query" } } } } ] } ] } ] } ] }"
zachowaj strukturę tego co wkleiłem, dodaj drugi przycisk i zmień nazwy
- Assistant
Poniżej masz dokładnie tę samą strukturę (header → sections → widgets → textParagraph + buttons), tylko że w tablicy
buttonsznajdują się teraz dwa przyciski z nowymi nazwami.Skopiuj całą linię do SPL-a (np. na końcu alertu) i użyj pola
payloadjako body dla HTTP POST.| makeresults | eval payload="{\"cards\":[{\"header\":{\"title\":\"Alert from Splunk\"},\"sections\":[{\"widgets\":[{\"textParagraph\":{\"text\":\"An alert has been triggered. Click below to investigate.\"}},{\"buttons\":[{\"textButton\":{\"text\":\"Odbieram\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}},{\"textButton\":{\"text\":\"Chcę skomentować\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}}]}]}]}]}"Co zostało zmienione / dodane
- W tablicy
buttonssą teraz dwa obiektytextButton. • pierwszy:"text": "Odbieram"
• drugi :"text": "Chcę skomentować" - Oba przyciski otwierają ten sam przykład-URL; podmień je na docelowe linki, jeśli potrzeba.
Nagłówek HTTP niezmienny:
{"Content-Type": "application/json"}Gotowe – karta zachowuje Twój pierwotny layout, ale ma dwa przyciski z nowymi etykietami.
- W tablicy
- User
Przerób mi to co jest po lewej tak aby pasowało do tego layoutu: | eval payload = "{ "cards": [ { "header": { "title": "Alert from Splunk" }, "sections": [ { "widgets": [ { "textParagraph": { "text": "An alert has been triggered. Click below to investigate." } }, { "buttons": [ { "textButton": { "text": "View in Splunk", "onClick": { "openLink": { "url": "https://your-splunk-instance/app/search/search?q=your-search-query" } } } } ] } ] } ] } ] }"
zachowaj strukturę tego co wkleiłem, dodaj drugi przycisk i zmień nazwy
- Assistant
Poniżej masz ten sam układ (header → sections → widgets → textParagraph + buttons), tylko – podmieniłem napisy – dodałem drugi przycisk.
Skopiuj jedną linię do SPL-a, a pole
payloadwykorzystaj jako body POST-a.| eval payload="{\"cards\":[{\"header\":{\"title\":\"Alert from Splunk\"},\"sections\":[{\"widgets\":[{\"textParagraph\":{\"text\":\"An alert has been triggered. Click below to investigate.\"}},{\"buttons\":[{\"textButton\":{\"text\":\"Odbieram\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}},{\"textButton\":{\"text\":\"Chcę skomentować\",\"onClick\":{\"openLink\":{\"url\":\"https://your-splunk-instance/app/search/search?q=your-search-query\"}}}}]}]}]}]}"•
Odbieram– pierwszy przycisk
•Chcę skomentować– drugi przyciskPodmień oczywiście URL-e lub teksty według potrzeb.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.