View Source WhatsappElixir.Buttons (whatsapp_elixir v0.1.1)

Module to handle sending interactive buttons to WhatsApp users.

Link to this section Summary

Functions

Sends an interactive buttons message to a WhatsApp user.

Sends an interactive reply buttons (menu) message to a WhatsApp user.

Link to this section Functions

Link to this function

send_button(button, recipient_id, custom_config \\ [])

View Source

Sends an interactive buttons message to a WhatsApp user.

Examples

iex> button = %{"header" => "Header Text", "body" => "Body Text","action" => %{"button" => "Button Text", "sections" => [%{ "title" =>"iBank", "rows" => [%{"id" => "row 1", "title" => "Send Money", "description" => ""},%{"id" => "row 2", "title" => "Withdraw money", "description" => ""}] }] }, "footer" => "Footer Text"}
iex> recipient_id = "5511999999999"
iex> WhatsappElixir.Buttons.send_button(button, recipient_id)
Link to this function

send_reply_button(button, recipient_id, custom_config \\ [])

View Source

Sends an interactive reply buttons (menu) message to a WhatsApp user.

Note:

  The maximum number of buttons is 3, more than 3 buttons will rise an error.

Examples

iex> button = %{ "type" => "button", "body" => %{"text" => "button"},  "action" => %{"buttons" => [%{"type" => "reply", "reply" => %{"id" => "1", "title" => "Button 1"}}, %{"type" => "reply", "reply" => %{"id" => "2", "title" => "Button 2"}}, %{"type" => "reply", "reply" => %{"id" => "3", "title" => "Button 3"}}]}}
iex> recipient_id = "5511999999999"
iex> WhatsappElixir.Buttons.send_reply_button(button, recipient_id)