Home > widget-integration > RecommendationService > getWidgetTemplate
RecommendationService.getWidgetTemplate() method
Retrieves the widget template from TAE config or API.
First attempts to use a template from the TAE configuration if available. Falls back to fetching from the template API using the template metadata ID.
Signature:
getWidgetTemplate(): Promise<string>;
Returns:
Promise<string>
Promise resolving to the template string in HTML format, ready for rendering with widget data.
Example
Fetch template for rendering:
const template = await this.getWidgetTemplate();
const rendered = this.templateEngine.render(template, widgetData);