Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use link preview builder in Apps Script #187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions apps-script/3p-resources/3p-resources.gs
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ function caseLinkPreview(event) {
.setTitle(`Case ${caseDetails["name"][0]}`);
const caseDescription = CardService.newTextParagraph()
.setText(caseDetails["description"][0]);

// Returns the card.
// Uses the text from the card's header for the title of the smart chip.
return CardService.newCardBuilder()
const card = CardService.newCardBuilder()
.setHeader(caseHeader)
.addSection(CardService.newCardSection().addWidget(caseDescription))
.build();

// Returns the link preview smart chip with its dedicated title.
return CardService.newLinkPreview()
.setTitle(`Case ${caseDetails["name"][0]} - caseDetails["description"][0]`)
.setPreviewCard(card);
Mansari marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -268,4 +270,4 @@ function createLinkRenderAction(title, url) {
}

// [END add_ons_3p_resources_link_render_action]
// [END add_ons_3p_resources]
// [END add_ons_3p_resources]
Loading