Wax.Messages.Template (wax v1.1.4)

Whatsapp Template Message structure and management

Summary

Functions

Adds a body object to the template

Adds a button object to the template

Adds a header object to the template

Creates a new Template struct

Types

t()

@type t() :: %Wax.Messages.Template{
  components: [Wax.Messages.Templates.Component.t()],
  language: Wax.Messages.Templates.Language.t(),
  name: String.t()
}

Functions

add_body(template, params)

@spec add_body(t(), Keyword.t()) :: t()

Adds a body object to the template

Parameters

These are received as a Keyword list where the key is the parameter type. The accepted parameter types are:

  • currency
  • date_time
  • document
  • image
  • text -video

add_button(template, sub_type, index, params)

@spec add_button(t(), atom(), index :: 0..9, Keyword.t()) :: t()

Adds a button object to the template

Parameters

These are received as a Keyword list where the key is the parameter type. The accepted parameter types are:

  • payload
  • text

add_header(template, params)

@spec add_header(t(), Keyword.t()) :: t()

Adds a header object to the template

Parameters

These are received as a Keyword list where the key is the parameter type. The accepted parameter types are:

  • currency
  • date_time
  • document
  • image
  • text -video

new(name, language_code)

@spec new(String.t(), String.t()) :: t()

Creates a new Template struct

Accepts both language and language_locale formats (e.g., en and en_US).