Share Message with Commerce Template
Commerce Template
This message format displays product information including the price. While it may not allow for adding as long text as a feed template or including social information, it has the advantage of informing users about the price information.
Use Case: It is suitable for informing users about products sold in online shopping malls or promoting items by including price information (regular price, discount price, discount rate).
Template Type Definition
/**
* Commerce template class provided as a basic template
*
* @property content Content of the message including text, image, and link information
* @property commerce Price information for the content
* @property buttons Button list. Used when you want to change the button title and the link, or when you want to use two buttons. (Up to 2 buttons)
* @property buttonTitle Set to change the default button title "Learn more". If used, the link to move when the button is clicked will be the value entered in the content.
*/
export interface KakaoCommerceTemplate {
content: KakaoTemplateContent;
commerce: KakaoTemplateCommerce;
buttons?: KakaoTemplateButton[];
buttonTitle?: string;
}
Usage
shareCommerceTemplate
to share a template message.
export function shareCommerceTemplate(params: {
template: KakaoCommerceTemplate;
useWebBrowserIfKakaoTalkNotAvailable?: boolean;
serverCallbackArgs?: Record<string, string>;
})
template
: The template object.useWebBrowserIfKakaoTalkNotAvailable
: Specifies whether to use a web browser for sharing when KakaoTalk is not available. The default value istrue
.serverCallbackArgs
: Server callback arguments. Each value must be passed as a string.
info
Refer to Component Types for detailed component types.
If you encounter any issues, refer to Troubleshooting.