Learn R Programming

evolution (version 0.1.0)

evo_client: Create an Evolution API client

Description

Creates a preconfigured httr2 client to call Evolution API v2. It sets the apikey header, a custom User-Agent and basic automatic retries.

The returned object is used by every send_*() function and stores the base request (req) and the instance name so you don't have to repeat them.

Usage

evo_client(base_url, api_key, instance)

Value

An object of class evo_client with fields req (httr2 request) and instance.

Arguments

base_url

Character. Server base URL (no trailing slash), e.g. "https://your-host".

api_key

Character. API key (sent as apikey header). Prefer Sys.getenv("EVO_APIKEY") to avoid hardcoding secrets.

instance

Character. Instance name/ID used in endpoint paths.

See Also

send_text(), send_media(), send_location()

Examples

Run this code
if (FALSE) {
client <- evo_client(
  base_url = "https://your-evolution-host.com",
  api_key  = Sys.getenv("EVO_APIKEY"),
  instance = "myInstance"
)
}

Run the code above in your browser using DataLab