Create a Template object for the API
Name of the template
The code of the language or locale to use. Accepts both language and language_locale formats (e.g., en and en_US).
Components objects containing the parameters of the message. For text-based templates, the only supported component is BodyComponent.
import {
Template,
HeaderComponent,
HeaderParameter,
BodyComponent,
BodyParameter,
Currency,
DateTime
} from "whatsapp-api-js/messages";
const template_variables_message = new Template(
"template_name",
"en",
new HeaderComponent(
new HeaderParameter("Hello"),
new HeaderParameter(new Currency(1.5 * 1000, "USD", "U$1.5")),
new HeaderParameter(new DateTime("01/01/2023"))
),
new BodyComponent(
new BodyParameter("Hello"),
new BodyParameter(new Currency(1.5 * 1000, "USD", "U$1.5")),
new BodyParameter(new DateTime("01/01/2023"))
)
);
If the template isn't text-based (only one BodyComponent is given) and one of the parameters is a string and it's over 1024 characters.
Optional
Readonly
componentsThe components of the template
Readonly
languageThe language of the template
Readonly
nameThe name of the template
Template API object