Amarula.Content.Response (amarula v0.4.2)

View Source

A reply a user made to an interactive message — a button tap, list selection, template-button reply, or interactive response. Unified into one shape since they all share one shape: the user picked an option identified by id, shown as text.

  • :kind:button | :list | :template | :interactive.

  • :id — the selected option's id (what your app keys off).
  • :text — the option's display text.

For anything beyond the selection itself, read msg.raw.

Summary

Functions

Normalize one of the interactive-response protos into a %Amarula.Content.Response{}. kind says which proto it is; the id/text fields differ per proto and are mapped to the unified id/text.

Types

kind()

@type kind() :: :button | :list | :template | :interactive

t()

@type t() :: %Amarula.Content.Response{
  id: String.t() | nil,
  kind: kind(),
  text: String.t() | nil
}

Functions

from_proto(atom, m)

@spec from_proto(
  kind(),
  struct()
) :: t()

Normalize one of the interactive-response protos into a %Amarula.Content.Response{}. kind says which proto it is; the id/text fields differ per proto and are mapped to the unified id/text.