View Source WhatsappElixir.Others (whatsapp_elixir v0.1.1)

Module to handle sending custom JSON and contact messages to WhatsApp users.

Link to this section Summary

Functions

Sends a list of contacts to a WhatsApp user.

Sends a custom JSON to a WhatsApp user. This can be used to send custom objects to the message endpoint.

Link to this section Functions

Link to this function

send_contacts(contacts, recipient_id, custom_config \\ [])

View Source

Sends a list of contacts to a WhatsApp user.

REFERENCE: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#contacts-object

Examples

iex> contacts = [%{
...>  "name" => %{ "formatted_name" => "Maxwell Muhanda", "first_name" => "Maxwell" },
...>   "addresses" => [%{
...>     "street" => "STREET",
...>     "city" => "CITY",
...>     "state" => "STATE",
...>     "zip" => "ZIP",
...>     "country" => "COUNTRY",
...>     "country_code" => "COUNTRY_CODE",
...>     "type" => "HOME"
...>   }]
...> }]
iex> recipient_id = "5511999999999"
iex> WhatsappElixir.Others.send_contacts(contacts, recipient_id)
Link to this function

send_custom_json(data, recipient_id \\ "", custom_config \\ [])

View Source

Sends a custom JSON to a WhatsApp user. This can be used to send custom objects to the message endpoint.

Examples

iex> data = %{
...>   "messaging_product" => "whatsapp",
...>   "type" => "audio",
...>   "audio" => %{"id" => "audio_id"}
...> }
iex> recipient_id = "5511999999999"
iex> WhatsappElixir.Others.send_custom_json(data, recipient_id)