Shared configuration: the Graph API host and version. Calls go to https://graph.facebook.com/{version}, where the version is api-version in a call's opts, else the whatsapp.api.version context variable, otherwise DEFAULT_API_VERSION.

Values

DEFAULT_API_VERSION

DEFAULT_API_VERSION: Str "v26.0"

GRAPH_HOST

GRAPH_HOST: Str "https://graph.facebook.com"

Functions

api-version

fn (): Str
fn (opts: Map): Str

The Graph API version for a call: api-version in opts, then the whatsapp.api.version context variable (e.g. "v25.0"), otherwise DEFAULT_API_VERSION.

Example

::core ::whatsapp::core

::core/api-version({api-version: "25.0"})  // "v25.0"
Context Vars: whatsapp.api.version

base-url

fn (): Str
fn (opts: Map): Str

The versioned Graph API base URL, e.g. https://graph.facebook.com/v26.0.

Example

::core ::whatsapp::core

::core/base-url({api-version: "v25.0"})  // "https://graph.facebook.com/v25.0"

normalize-version

fn (version: Str): Str

Normalize a Graph API version string to the vNN.N path form ("26.0" and "v26.0" both give "v26.0"). Exposed for testing.

Example

::core ::whatsapp::core

::core/normalize-version("26.0")  // "v26.0"
::core/normalize-version(" v25.0 ")  // "v25.0"