zavudev

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: Apache-2.0 Imports: 18 Imported by: 2

README

Zavudev Go API Library

Go Reference

The Zavudev Go library provides convenient access to the Zavudev REST API from applications written in Go.

It is generated with Stainless.

MCP Server

Use the Zavudev MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.

Add to Cursor Install in VS Code

Note: You may need to set environment variables in your MCP client.

Installation

import (
	"github.com/zavudev/sdk-go" // imported as zavudev
)

Or to pin the version:

go get -u 'github.com/zavudev/sdk-go@v0.3.0'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/zavudev/sdk-go"
	"github.com/zavudev/sdk-go/option"
)

func main() {
	client := zavudev.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("ZAVUDEV_API_KEY")
	)
	messageResponse, err := client.Messages.Send(context.TODO(), zavudev.MessageSendParams{
		To:   "+14155551234",
		Text: zavudev.String("Hello from Zavu!"),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", messageResponse.Message)
}

Request fields

The zavudev library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, zavudev.String(string), zavudev.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := zavudev.ExampleParams{
	ID:   "id_xxx",              // required property
	Name: zavudev.String("..."), // optional property

	Point: zavudev.Point{
		X: 0,              // required field will serialize as 0
		Y: zavudev.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: zavudev.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[zavudev.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := zavudev.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Messages.Send(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Messages.ListAutoPaging(context.TODO(), zavudev.MessageListParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	message := iter.Current()
	fmt.Printf("%+v\n", message)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Messages.List(context.TODO(), zavudev.MessageListParams{})
for page != nil {
	for _, message := range page.Items {
		fmt.Printf("%+v\n", message)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *zavudev.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Messages.Send(context.TODO(), zavudev.MessageSendParams{
	To:   "+14155551234",
	Text: zavudev.String("Hello from Zavu!"),
})
if err != nil {
	var apierr *zavudev.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/messages": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Messages.Send(
	ctx,
	zavudev.MessageSendParams{
		To:   "+14155551234",
		Text: zavudev.String("Hello from Zavu!"),
	},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper zavudev.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := zavudev.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Messages.Send(
	context.TODO(),
	zavudev.MessageSendParams{
		To:   "+14155551234",
		Text: zavudev.String("Hello from Zavu!"),
	},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
messageResponse, err := client.Messages.Send(
	context.TODO(),
	zavudev.MessageSendParams{
		To:   "+14155551234",
		Text: zavudev.String("Hello from Zavu!"),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", messageResponse)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: zavudev.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := zavudev.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (ZAVUDEV_API_KEY, ZAVUDEV_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type Address

type Address struct {
	ID          string    `json:"id" api:"required"`
	CountryCode string    `json:"countryCode" api:"required"`
	CreatedAt   time.Time `json:"createdAt" api:"required" format:"date-time"`
	Locality    string    `json:"locality" api:"required"`
	PostalCode  string    `json:"postalCode" api:"required"`
	// Any of "pending", "verified", "rejected".
	Status             AddressStatus `json:"status" api:"required"`
	StreetAddress      string        `json:"streetAddress" api:"required"`
	AdministrativeArea string        `json:"administrativeArea" api:"nullable"`
	BusinessName       string        `json:"businessName" api:"nullable"`
	ExtendedAddress    string        `json:"extendedAddress" api:"nullable"`
	FirstName          string        `json:"firstName" api:"nullable"`
	LastName           string        `json:"lastName" api:"nullable"`
	UpdatedAt          time.Time     `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		CountryCode        respjson.Field
		CreatedAt          respjson.Field
		Locality           respjson.Field
		PostalCode         respjson.Field
		Status             respjson.Field
		StreetAddress      respjson.Field
		AdministrativeArea respjson.Field
		BusinessName       respjson.Field
		ExtendedAddress    respjson.Field
		FirstName          respjson.Field
		LastName           respjson.Field
		UpdatedAt          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A regulatory address for phone number requirements.

func (Address) RawJSON

func (r Address) RawJSON() string

Returns the unmodified JSON received from the API

func (*Address) UnmarshalJSON

func (r *Address) UnmarshalJSON(data []byte) error

type AddressGetResponse

type AddressGetResponse struct {
	// A regulatory address for phone number requirements.
	Address Address `json:"address" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AddressGetResponse) RawJSON

func (r AddressGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AddressGetResponse) UnmarshalJSON

func (r *AddressGetResponse) UnmarshalJSON(data []byte) error

type AddressListParams

type AddressListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (AddressListParams) URLQuery

func (r AddressListParams) URLQuery() (v url.Values, err error)

URLQuery serializes AddressListParams's query parameters as `url.Values`.

type AddressNewParams

type AddressNewParams struct {
	CountryCode        string            `json:"countryCode" api:"required"`
	Locality           string            `json:"locality" api:"required"`
	PostalCode         string            `json:"postalCode" api:"required"`
	StreetAddress      string            `json:"streetAddress" api:"required"`
	AdministrativeArea param.Opt[string] `json:"administrativeArea,omitzero"`
	BusinessName       param.Opt[string] `json:"businessName,omitzero"`
	ExtendedAddress    param.Opt[string] `json:"extendedAddress,omitzero"`
	FirstName          param.Opt[string] `json:"firstName,omitzero"`
	LastName           param.Opt[string] `json:"lastName,omitzero"`
	// contains filtered or unexported fields
}

func (AddressNewParams) MarshalJSON

func (r AddressNewParams) MarshalJSON() (data []byte, err error)

func (*AddressNewParams) UnmarshalJSON

func (r *AddressNewParams) UnmarshalJSON(data []byte) error

type AddressNewResponse

type AddressNewResponse struct {
	// A regulatory address for phone number requirements.
	Address Address `json:"address" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Address     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AddressNewResponse) RawJSON

func (r AddressNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AddressNewResponse) UnmarshalJSON

func (r *AddressNewResponse) UnmarshalJSON(data []byte) error

type AddressService

type AddressService struct {
	Options []option.RequestOption
}

AddressService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAddressService method instead.

func NewAddressService

func NewAddressService(opts ...option.RequestOption) (r AddressService)

NewAddressService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AddressService) Delete

func (r *AddressService) Delete(ctx context.Context, addressID string, opts ...option.RequestOption) (err error)

Delete a regulatory address. Cannot delete addresses that are in use.

func (*AddressService) Get

func (r *AddressService) Get(ctx context.Context, addressID string, opts ...option.RequestOption) (res *AddressGetResponse, err error)

Get a specific regulatory address.

func (*AddressService) List

List regulatory addresses for this project.

func (*AddressService) ListAutoPaging

List regulatory addresses for this project.

func (*AddressService) New

Create a regulatory address for phone number purchases. Some countries require a verified address before phone numbers can be activated.

type AddressStatus

type AddressStatus string
const (
	AddressStatusPending  AddressStatus = "pending"
	AddressStatusVerified AddressStatus = "verified"
	AddressStatusRejected AddressStatus = "rejected"
)

type Agent

type Agent struct {
	ID        string    `json:"id" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Whether the agent is active.
	Enabled bool `json:"enabled" api:"required"`
	// Model ID (e.g., gpt-4o-mini, claude-3-5-sonnet).
	Model string `json:"model" api:"required"`
	Name  string `json:"name" api:"required"`
	// LLM provider for the AI agent.
	//
	// Any of "openai", "anthropic", "google", "mistral", "zavu".
	Provider AgentProvider `json:"provider" api:"required"`
	SenderID string        `json:"senderId" api:"required"`
	// System prompt for the agent.
	SystemPrompt string    `json:"systemPrompt" api:"required"`
	UpdatedAt    time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// Number of previous messages to include as context.
	ContextWindowMessages int64 `json:"contextWindowMessages"`
	// Whether to include contact metadata in context.
	IncludeContactMetadata bool `json:"includeContactMetadata"`
	// Maximum tokens for LLM response.
	MaxTokens int64      `json:"maxTokens" api:"nullable"`
	Stats     AgentStats `json:"stats"`
	// LLM temperature (0-2).
	Temperature float64 `json:"temperature" api:"nullable"`
	// Channels that trigger the agent.
	TriggerOnChannels []string `json:"triggerOnChannels"`
	// Message types that trigger the agent.
	TriggerOnMessageTypes []string `json:"triggerOnMessageTypes"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                     respjson.Field
		CreatedAt              respjson.Field
		Enabled                respjson.Field
		Model                  respjson.Field
		Name                   respjson.Field
		Provider               respjson.Field
		SenderID               respjson.Field
		SystemPrompt           respjson.Field
		UpdatedAt              respjson.Field
		ContextWindowMessages  respjson.Field
		IncludeContactMetadata respjson.Field
		MaxTokens              respjson.Field
		Stats                  respjson.Field
		Temperature            respjson.Field
		TriggerOnChannels      respjson.Field
		TriggerOnMessageTypes  respjson.Field
		ExtraFields            map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AI Agent configuration for a sender.

func (Agent) RawJSON

func (r Agent) RawJSON() string

Returns the unmodified JSON received from the API

func (*Agent) UnmarshalJSON

func (r *Agent) UnmarshalJSON(data []byte) error

type AgentDocument

type AgentDocument struct {
	ID string `json:"id" api:"required"`
	// Number of chunks created from this document.
	ChunkCount int64 `json:"chunkCount" api:"required"`
	// Length of the document content in characters.
	ContentLength int64     `json:"contentLength" api:"required"`
	CreatedAt     time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Whether the document has been processed for RAG.
	IsProcessed     bool      `json:"isProcessed" api:"required"`
	KnowledgeBaseID string    `json:"knowledgeBaseId" api:"required"`
	Title           string    `json:"title" api:"required"`
	UpdatedAt       time.Time `json:"updatedAt" api:"required" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		ChunkCount      respjson.Field
		ContentLength   respjson.Field
		CreatedAt       respjson.Field
		IsProcessed     respjson.Field
		KnowledgeBaseID respjson.Field
		Title           respjson.Field
		UpdatedAt       respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentDocument) RawJSON

func (r AgentDocument) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentDocument) UnmarshalJSON

func (r *AgentDocument) UnmarshalJSON(data []byte) error

type AgentExecution

type AgentExecution struct {
	ID      string `json:"id" api:"required"`
	AgentID string `json:"agentId" api:"required"`
	// Cost in USD.
	Cost         float64   `json:"cost" api:"required"`
	CreatedAt    time.Time `json:"createdAt" api:"required" format:"date-time"`
	InputTokens  int64     `json:"inputTokens" api:"required"`
	LatencyMs    int64     `json:"latencyMs" api:"required"`
	OutputTokens int64     `json:"outputTokens" api:"required"`
	// Status of an agent execution.
	//
	// Any of "success", "error", "filtered", "rate_limited", "balance_insufficient".
	Status            AgentExecutionStatus `json:"status" api:"required"`
	ErrorMessage      string               `json:"errorMessage" api:"nullable"`
	InboundMessageID  string               `json:"inboundMessageId"`
	ResponseMessageID string               `json:"responseMessageId" api:"nullable"`
	ResponseText      string               `json:"responseText" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		AgentID           respjson.Field
		Cost              respjson.Field
		CreatedAt         respjson.Field
		InputTokens       respjson.Field
		LatencyMs         respjson.Field
		OutputTokens      respjson.Field
		Status            respjson.Field
		ErrorMessage      respjson.Field
		InboundMessageID  respjson.Field
		ResponseMessageID respjson.Field
		ResponseText      respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentExecution) RawJSON

func (r AgentExecution) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentExecution) UnmarshalJSON

func (r *AgentExecution) UnmarshalJSON(data []byte) error

type AgentExecutionStatus

type AgentExecutionStatus string

Status of an agent execution.

const (
	AgentExecutionStatusSuccess             AgentExecutionStatus = "success"
	AgentExecutionStatusError               AgentExecutionStatus = "error"
	AgentExecutionStatusFiltered            AgentExecutionStatus = "filtered"
	AgentExecutionStatusRateLimited         AgentExecutionStatus = "rate_limited"
	AgentExecutionStatusBalanceInsufficient AgentExecutionStatus = "balance_insufficient"
)

type AgentFlow

type AgentFlow struct {
	ID        string    `json:"id" api:"required"`
	AgentID   string    `json:"agentId" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	Enabled   bool      `json:"enabled" api:"required"`
	Name      string    `json:"name" api:"required"`
	// Priority when multiple flows match (higher = more priority).
	Priority    int64            `json:"priority" api:"required"`
	Steps       []AgentFlowStep  `json:"steps" api:"required"`
	Trigger     AgentFlowTrigger `json:"trigger" api:"required"`
	UpdatedAt   time.Time        `json:"updatedAt" api:"required" format:"date-time"`
	Description string           `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AgentID     respjson.Field
		CreatedAt   respjson.Field
		Enabled     respjson.Field
		Name        respjson.Field
		Priority    respjson.Field
		Steps       respjson.Field
		Trigger     respjson.Field
		UpdatedAt   respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentFlow) RawJSON

func (r AgentFlow) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentFlow) UnmarshalJSON

func (r *AgentFlow) UnmarshalJSON(data []byte) error

type AgentFlowStep

type AgentFlowStep struct {
	// Unique step identifier.
	ID string `json:"id" api:"required"`
	// Step configuration (varies by type).
	Config map[string]any `json:"config" api:"required"`
	// Type of flow step.
	//
	// Any of "message", "collect", "condition", "tool", "llm", "transfer".
	Type string `json:"type" api:"required"`
	// ID of the next step to execute.
	NextStepID string `json:"nextStepId" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Config      respjson.Field
		Type        respjson.Field
		NextStepID  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentFlowStep) RawJSON

func (r AgentFlowStep) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentFlowStep) UnmarshalJSON

func (r *AgentFlowStep) UnmarshalJSON(data []byte) error

type AgentFlowTrigger

type AgentFlowTrigger struct {
	// Type of trigger for a flow.
	//
	// Any of "keyword", "intent", "always", "manual".
	Type string `json:"type" api:"required"`
	// Intent that triggers the flow (for intent type).
	Intent string `json:"intent"`
	// Keywords that trigger the flow (for keyword type).
	Keywords []string `json:"keywords"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Type        respjson.Field
		Intent      respjson.Field
		Keywords    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentFlowTrigger) RawJSON

func (r AgentFlowTrigger) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentFlowTrigger) UnmarshalJSON

func (r *AgentFlowTrigger) UnmarshalJSON(data []byte) error

type AgentKnowledgeBase

type AgentKnowledgeBase struct {
	ID            string    `json:"id" api:"required"`
	AgentID       string    `json:"agentId" api:"required"`
	CreatedAt     time.Time `json:"createdAt" api:"required" format:"date-time"`
	DocumentCount int64     `json:"documentCount" api:"required"`
	Name          string    `json:"name" api:"required"`
	TotalChunks   int64     `json:"totalChunks" api:"required"`
	UpdatedAt     time.Time `json:"updatedAt" api:"required" format:"date-time"`
	Description   string    `json:"description" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		AgentID       respjson.Field
		CreatedAt     respjson.Field
		DocumentCount respjson.Field
		Name          respjson.Field
		TotalChunks   respjson.Field
		UpdatedAt     respjson.Field
		Description   respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentKnowledgeBase) RawJSON

func (r AgentKnowledgeBase) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentKnowledgeBase) UnmarshalJSON

func (r *AgentKnowledgeBase) UnmarshalJSON(data []byte) error

type AgentProvider

type AgentProvider string

LLM provider for the AI agent.

const (
	AgentProviderOpenAI    AgentProvider = "openai"
	AgentProviderAnthropic AgentProvider = "anthropic"
	AgentProviderGoogle    AgentProvider = "google"
	AgentProviderMistral   AgentProvider = "mistral"
	AgentProviderZavu      AgentProvider = "zavu"
)

type AgentResponse

type AgentResponse struct {
	// AI Agent configuration for a sender.
	Agent Agent `json:"agent" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Agent       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentResponse) RawJSON

func (r AgentResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentResponse) UnmarshalJSON

func (r *AgentResponse) UnmarshalJSON(data []byte) error

type AgentStats

type AgentStats struct {
	// Total cost in USD.
	TotalCost        float64 `json:"totalCost"`
	TotalInvocations int64   `json:"totalInvocations"`
	TotalTokensUsed  int64   `json:"totalTokensUsed"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		TotalCost        respjson.Field
		TotalInvocations respjson.Field
		TotalTokensUsed  respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentStats) RawJSON

func (r AgentStats) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentStats) UnmarshalJSON

func (r *AgentStats) UnmarshalJSON(data []byte) error

type AgentTool

type AgentTool struct {
	ID        string    `json:"id" api:"required"`
	AgentID   string    `json:"agentId" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Description for the LLM to understand when to use this tool.
	Description string              `json:"description" api:"required"`
	Enabled     bool                `json:"enabled" api:"required"`
	Name        string              `json:"name" api:"required"`
	Parameters  AgentToolParameters `json:"parameters" api:"required"`
	UpdatedAt   time.Time           `json:"updatedAt" api:"required" format:"date-time"`
	// HTTPS URL to call when the tool is executed.
	WebhookURL string `json:"webhookUrl" api:"required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		AgentID     respjson.Field
		CreatedAt   respjson.Field
		Description respjson.Field
		Enabled     respjson.Field
		Name        respjson.Field
		Parameters  respjson.Field
		UpdatedAt   respjson.Field
		WebhookURL  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentTool) RawJSON

func (r AgentTool) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentTool) UnmarshalJSON

func (r *AgentTool) UnmarshalJSON(data []byte) error

type AgentToolParameters

type AgentToolParameters struct {
	Properties map[string]AgentToolParametersProperty `json:"properties" api:"required"`
	Required   []string                               `json:"required" api:"required"`
	// Any of "object".
	Type string `json:"type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Properties  respjson.Field
		Required    respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentToolParameters) RawJSON

func (r AgentToolParameters) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentToolParameters) UnmarshalJSON

func (r *AgentToolParameters) UnmarshalJSON(data []byte) error

type AgentToolParametersProperty

type AgentToolParametersProperty struct {
	Description string `json:"description"`
	Type        string `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Description respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AgentToolParametersProperty) RawJSON

func (r AgentToolParametersProperty) RawJSON() string

Returns the unmodified JSON received from the API

func (*AgentToolParametersProperty) UnmarshalJSON

func (r *AgentToolParametersProperty) UnmarshalJSON(data []byte) error

type AvailablePhoneNumber

type AvailablePhoneNumber struct {
	Capabilities PhoneNumberCapabilities `json:"capabilities" api:"required"`
	PhoneNumber  string                  `json:"phoneNumber" api:"required"`
	Pricing      PhoneNumberPricing      `json:"pricing" api:"required"`
	FriendlyName string                  `json:"friendlyName"`
	Locality     string                  `json:"locality"`
	Region       string                  `json:"region"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Capabilities respjson.Field
		PhoneNumber  respjson.Field
		Pricing      respjson.Field
		FriendlyName respjson.Field
		Locality     respjson.Field
		Region       respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (AvailablePhoneNumber) RawJSON

func (r AvailablePhoneNumber) RawJSON() string

Returns the unmodified JSON received from the API

func (*AvailablePhoneNumber) UnmarshalJSON

func (r *AvailablePhoneNumber) UnmarshalJSON(data []byte) error

type Broadcast

type Broadcast struct {
	ID string `json:"id" api:"required"`
	// Broadcast delivery channel. Use 'smart' for per-contact intelligent routing.
	//
	// Any of "smart", "sms", "sms_oneway", "whatsapp", "telegram", "email",
	// "instagram", "voice".
	Channel   BroadcastChannel `json:"channel" api:"required"`
	CreatedAt time.Time        `json:"createdAt" api:"required" format:"date-time"`
	// Type of message for broadcast.
	//
	// Any of "text", "image", "video", "audio", "document", "template".
	MessageType BroadcastMessageType `json:"messageType" api:"required"`
	Name        string               `json:"name" api:"required"`
	// Current status of the broadcast.
	//
	// Any of "draft", "pending_review", "approved", "rejected", "escalated",
	// "rejected_final", "scheduled", "sending", "paused", "completed", "cancelled",
	// "failed".
	Status BroadcastStatus `json:"status" api:"required"`
	// Total number of contacts in the broadcast.
	TotalContacts int64 `json:"totalContacts" api:"required"`
	// Actual cost so far in USD.
	ActualCost  float64   `json:"actualCost" api:"nullable"`
	CompletedAt time.Time `json:"completedAt" format:"date-time"`
	// Content for non-text broadcast message types.
	Content        BroadcastContent `json:"content"`
	DeliveredCount int64            `json:"deliveredCount"`
	EmailSubject   string           `json:"emailSubject"`
	// Estimated total cost in USD.
	EstimatedCost float64           `json:"estimatedCost" api:"nullable"`
	FailedCount   int64             `json:"failedCount"`
	Metadata      map[string]string `json:"metadata"`
	PendingCount  int64             `json:"pendingCount"`
	// Amount reserved from balance in USD.
	ReservedAmount float64 `json:"reservedAmount" api:"nullable"`
	// Number of review attempts (max 3).
	ReviewAttempts int64 `json:"reviewAttempts" api:"nullable"`
	// AI content review result.
	ReviewResult BroadcastReviewResult `json:"reviewResult" api:"nullable"`
	ScheduledAt  time.Time             `json:"scheduledAt" format:"date-time"`
	SenderID     string                `json:"senderId"`
	SendingCount int64                 `json:"sendingCount"`
	StartedAt    time.Time             `json:"startedAt" format:"date-time"`
	Text         string                `json:"text"`
	UpdatedAt    time.Time             `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID             respjson.Field
		Channel        respjson.Field
		CreatedAt      respjson.Field
		MessageType    respjson.Field
		Name           respjson.Field
		Status         respjson.Field
		TotalContacts  respjson.Field
		ActualCost     respjson.Field
		CompletedAt    respjson.Field
		Content        respjson.Field
		DeliveredCount respjson.Field
		EmailSubject   respjson.Field
		EstimatedCost  respjson.Field
		FailedCount    respjson.Field
		Metadata       respjson.Field
		PendingCount   respjson.Field
		ReservedAmount respjson.Field
		ReviewAttempts respjson.Field
		ReviewResult   respjson.Field
		ScheduledAt    respjson.Field
		SenderID       respjson.Field
		SendingCount   respjson.Field
		StartedAt      respjson.Field
		Text           respjson.Field
		UpdatedAt      respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Broadcast) RawJSON

func (r Broadcast) RawJSON() string

Returns the unmodified JSON received from the API

func (*Broadcast) UnmarshalJSON

func (r *Broadcast) UnmarshalJSON(data []byte) error

type BroadcastCancelResponse

type BroadcastCancelResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastCancelResponse) RawJSON

func (r BroadcastCancelResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastCancelResponse) UnmarshalJSON

func (r *BroadcastCancelResponse) UnmarshalJSON(data []byte) error

type BroadcastChannel

type BroadcastChannel string

Broadcast delivery channel. Use 'smart' for per-contact intelligent routing.

const (
	BroadcastChannelSmart     BroadcastChannel = "smart"
	BroadcastChannelSMS       BroadcastChannel = "sms"
	BroadcastChannelSMSOneway BroadcastChannel = "sms_oneway"
	BroadcastChannelWhatsapp  BroadcastChannel = "whatsapp"
	BroadcastChannelTelegram  BroadcastChannel = "telegram"
	BroadcastChannelEmail     BroadcastChannel = "email"
	BroadcastChannelInstagram BroadcastChannel = "instagram"
	BroadcastChannelVoice     BroadcastChannel = "voice"
)

type BroadcastContact

type BroadcastContact struct {
	ID        string    `json:"id" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	Recipient string    `json:"recipient" api:"required"`
	// Any of "phone", "email".
	RecipientType BroadcastContactRecipientType `json:"recipientType" api:"required"`
	// Status of a contact within a broadcast.
	//
	// Any of "pending", "queued", "sending", "delivered", "failed", "skipped".
	Status       BroadcastContactStatus `json:"status" api:"required"`
	Cost         float64                `json:"cost" api:"nullable"`
	ErrorCode    string                 `json:"errorCode"`
	ErrorMessage string                 `json:"errorMessage"`
	// Associated message ID after processing.
	MessageID         string            `json:"messageId"`
	ProcessedAt       time.Time         `json:"processedAt" format:"date-time"`
	TemplateVariables map[string]string `json:"templateVariables"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		CreatedAt         respjson.Field
		Recipient         respjson.Field
		RecipientType     respjson.Field
		Status            respjson.Field
		Cost              respjson.Field
		ErrorCode         respjson.Field
		ErrorMessage      respjson.Field
		MessageID         respjson.Field
		ProcessedAt       respjson.Field
		TemplateVariables respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastContact) RawJSON

func (r BroadcastContact) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastContact) UnmarshalJSON

func (r *BroadcastContact) UnmarshalJSON(data []byte) error

type BroadcastContactAddParams

type BroadcastContactAddParams struct {
	// List of contacts to add (max 1000 per request).
	Contacts []BroadcastContactAddParamsContact `json:"contacts,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (BroadcastContactAddParams) MarshalJSON

func (r BroadcastContactAddParams) MarshalJSON() (data []byte, err error)

func (*BroadcastContactAddParams) UnmarshalJSON

func (r *BroadcastContactAddParams) UnmarshalJSON(data []byte) error

type BroadcastContactAddParamsContact

type BroadcastContactAddParamsContact struct {
	// Phone number (E.164) or email address.
	Recipient string `json:"recipient" api:"required"`
	// Per-contact template variables to personalize the message.
	TemplateVariables map[string]string `json:"templateVariables,omitzero"`
	// contains filtered or unexported fields
}

The property Recipient is required.

func (BroadcastContactAddParamsContact) MarshalJSON

func (r BroadcastContactAddParamsContact) MarshalJSON() (data []byte, err error)

func (*BroadcastContactAddParamsContact) UnmarshalJSON

func (r *BroadcastContactAddParamsContact) UnmarshalJSON(data []byte) error

type BroadcastContactAddResponse

type BroadcastContactAddResponse struct {
	// Number of contacts successfully added.
	Added int64 `json:"added" api:"required"`
	// Number of duplicate contacts skipped.
	Duplicates int64 `json:"duplicates" api:"required"`
	// Number of invalid contacts rejected.
	Invalid int64 `json:"invalid" api:"required"`
	// Details about invalid contacts.
	Errors []BroadcastContactAddResponseError `json:"errors"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Added       respjson.Field
		Duplicates  respjson.Field
		Invalid     respjson.Field
		Errors      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastContactAddResponse) RawJSON

func (r BroadcastContactAddResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastContactAddResponse) UnmarshalJSON

func (r *BroadcastContactAddResponse) UnmarshalJSON(data []byte) error

type BroadcastContactAddResponseError

type BroadcastContactAddResponseError struct {
	Reason    string `json:"reason"`
	Recipient string `json:"recipient"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Reason      respjson.Field
		Recipient   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastContactAddResponseError) RawJSON

Returns the unmodified JSON received from the API

func (*BroadcastContactAddResponseError) UnmarshalJSON

func (r *BroadcastContactAddResponseError) UnmarshalJSON(data []byte) error

type BroadcastContactListParams

type BroadcastContactListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Status of a contact within a broadcast.
	//
	// Any of "pending", "queued", "sending", "delivered", "failed", "skipped".
	Status BroadcastContactStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BroadcastContactListParams) URLQuery

func (r BroadcastContactListParams) URLQuery() (v url.Values, err error)

URLQuery serializes BroadcastContactListParams's query parameters as `url.Values`.

type BroadcastContactRecipientType

type BroadcastContactRecipientType string
const (
	BroadcastContactRecipientTypePhone BroadcastContactRecipientType = "phone"
	BroadcastContactRecipientTypeEmail BroadcastContactRecipientType = "email"
)

type BroadcastContactRemoveParams

type BroadcastContactRemoveParams struct {
	BroadcastID string `path:"broadcastId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type BroadcastContactService

type BroadcastContactService struct {
	Options []option.RequestOption
}

BroadcastContactService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBroadcastContactService method instead.

func NewBroadcastContactService

func NewBroadcastContactService(opts ...option.RequestOption) (r BroadcastContactService)

NewBroadcastContactService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BroadcastContactService) Add

Add contacts to a broadcast in batch. Maximum 1000 contacts per request.

func (*BroadcastContactService) List

List contacts in a broadcast with optional status filter.

func (*BroadcastContactService) ListAutoPaging

List contacts in a broadcast with optional status filter.

func (*BroadcastContactService) Remove

Remove a contact from a broadcast in draft status.

type BroadcastContactStatus

type BroadcastContactStatus string

Status of a contact within a broadcast.

const (
	BroadcastContactStatusPending   BroadcastContactStatus = "pending"
	BroadcastContactStatusQueued    BroadcastContactStatus = "queued"
	BroadcastContactStatusSending   BroadcastContactStatus = "sending"
	BroadcastContactStatusDelivered BroadcastContactStatus = "delivered"
	BroadcastContactStatusFailed    BroadcastContactStatus = "failed"
	BroadcastContactStatusSkipped   BroadcastContactStatus = "skipped"
)

type BroadcastContent

type BroadcastContent struct {
	// Filename for documents.
	Filename string `json:"filename"`
	// Media ID if already uploaded.
	MediaID string `json:"mediaId"`
	// URL of the media file.
	MediaURL string `json:"mediaUrl"`
	// MIME type of the media.
	MimeType string `json:"mimeType"`
	// Template ID for template messages.
	TemplateID string `json:"templateId"`
	// Default template variables (can be overridden per contact).
	TemplateVariables map[string]string `json:"templateVariables"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Filename          respjson.Field
		MediaID           respjson.Field
		MediaURL          respjson.Field
		MimeType          respjson.Field
		TemplateID        respjson.Field
		TemplateVariables respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Content for non-text broadcast message types.

func (BroadcastContent) RawJSON

func (r BroadcastContent) RawJSON() string

Returns the unmodified JSON received from the API

func (BroadcastContent) ToParam

ToParam converts this BroadcastContent to a BroadcastContentParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with BroadcastContentParam.Overrides()

func (*BroadcastContent) UnmarshalJSON

func (r *BroadcastContent) UnmarshalJSON(data []byte) error

type BroadcastContentParam

type BroadcastContentParam struct {
	// Filename for documents.
	Filename param.Opt[string] `json:"filename,omitzero"`
	// Media ID if already uploaded.
	MediaID param.Opt[string] `json:"mediaId,omitzero"`
	// URL of the media file.
	MediaURL param.Opt[string] `json:"mediaUrl,omitzero"`
	// MIME type of the media.
	MimeType param.Opt[string] `json:"mimeType,omitzero"`
	// Template ID for template messages.
	TemplateID param.Opt[string] `json:"templateId,omitzero"`
	// Default template variables (can be overridden per contact).
	TemplateVariables map[string]string `json:"templateVariables,omitzero"`
	// contains filtered or unexported fields
}

Content for non-text broadcast message types.

func (BroadcastContentParam) MarshalJSON

func (r BroadcastContentParam) MarshalJSON() (data []byte, err error)

func (*BroadcastContentParam) UnmarshalJSON

func (r *BroadcastContentParam) UnmarshalJSON(data []byte) error

type BroadcastGetResponse

type BroadcastGetResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastGetResponse) RawJSON

func (r BroadcastGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastGetResponse) UnmarshalJSON

func (r *BroadcastGetResponse) UnmarshalJSON(data []byte) error

type BroadcastListParams

type BroadcastListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Current status of the broadcast.
	//
	// Any of "draft", "pending_review", "approved", "rejected", "escalated",
	// "rejected_final", "scheduled", "sending", "paused", "completed", "cancelled",
	// "failed".
	Status BroadcastStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (BroadcastListParams) URLQuery

func (r BroadcastListParams) URLQuery() (v url.Values, err error)

URLQuery serializes BroadcastListParams's query parameters as `url.Values`.

type BroadcastMessageType

type BroadcastMessageType string

Type of message for broadcast.

const (
	BroadcastMessageTypeText     BroadcastMessageType = "text"
	BroadcastMessageTypeImage    BroadcastMessageType = "image"
	BroadcastMessageTypeVideo    BroadcastMessageType = "video"
	BroadcastMessageTypeAudio    BroadcastMessageType = "audio"
	BroadcastMessageTypeDocument BroadcastMessageType = "document"
	BroadcastMessageTypeTemplate BroadcastMessageType = "template"
)

type BroadcastNewParams

type BroadcastNewParams struct {
	// Broadcast delivery channel. Use 'smart' for per-contact intelligent routing.
	//
	// Any of "smart", "sms", "sms_oneway", "whatsapp", "telegram", "email",
	// "instagram", "voice".
	Channel BroadcastChannel `json:"channel,omitzero" api:"required"`
	// Name of the broadcast campaign.
	Name string `json:"name" api:"required"`
	// HTML body for email broadcasts.
	EmailHTMLBody param.Opt[string] `json:"emailHtmlBody,omitzero"`
	// Email subject line. Required for email broadcasts.
	EmailSubject param.Opt[string] `json:"emailSubject,omitzero"`
	// Idempotency key to prevent duplicate broadcasts.
	IdempotencyKey param.Opt[string] `json:"idempotencyKey,omitzero"`
	// Schedule the broadcast for future delivery.
	ScheduledAt param.Opt[time.Time] `json:"scheduledAt,omitzero" format:"date-time"`
	// Sender profile ID. Uses default sender if omitted.
	SenderID param.Opt[string] `json:"senderId,omitzero"`
	// Text content or caption. Supports template variables: {{name}}, {{1}}, etc.
	Text param.Opt[string] `json:"text,omitzero"`
	// Content for non-text broadcast message types.
	Content BroadcastContentParam `json:"content,omitzero"`
	// Type of message for broadcast.
	//
	// Any of "text", "image", "video", "audio", "document", "template".
	MessageType BroadcastMessageType `json:"messageType,omitzero"`
	Metadata    map[string]string    `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (BroadcastNewParams) MarshalJSON

func (r BroadcastNewParams) MarshalJSON() (data []byte, err error)

func (*BroadcastNewParams) UnmarshalJSON

func (r *BroadcastNewParams) UnmarshalJSON(data []byte) error

type BroadcastNewResponse

type BroadcastNewResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastNewResponse) RawJSON

func (r BroadcastNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastNewResponse) UnmarshalJSON

func (r *BroadcastNewResponse) UnmarshalJSON(data []byte) error

type BroadcastProgress

type BroadcastProgress struct {
	BroadcastID string `json:"broadcastId" api:"required"`
	// Successfully delivered.
	Delivered int64 `json:"delivered" api:"required"`
	// Failed to deliver.
	Failed int64 `json:"failed" api:"required"`
	// Not yet queued for sending.
	Pending int64 `json:"pending" api:"required"`
	// Percentage complete (0-100).
	PercentComplete float64 `json:"percentComplete" api:"required"`
	// Currently being sent.
	Sending int64 `json:"sending" api:"required"`
	// Skipped (broadcast cancelled).
	Skipped int64 `json:"skipped" api:"required"`
	// Current status of the broadcast.
	//
	// Any of "draft", "pending_review", "approved", "rejected", "escalated",
	// "rejected_final", "scheduled", "sending", "paused", "completed", "cancelled",
	// "failed".
	Status BroadcastStatus `json:"status" api:"required"`
	// Total contacts in broadcast.
	Total int64 `json:"total" api:"required"`
	// Actual cost so far in USD.
	ActualCost            float64   `json:"actualCost" api:"nullable"`
	EstimatedCompletionAt time.Time `json:"estimatedCompletionAt" format:"date-time"`
	// Estimated total cost in USD.
	EstimatedCost float64 `json:"estimatedCost" api:"nullable"`
	// Amount reserved from balance in USD.
	ReservedAmount float64   `json:"reservedAmount" api:"nullable"`
	StartedAt      time.Time `json:"startedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BroadcastID           respjson.Field
		Delivered             respjson.Field
		Failed                respjson.Field
		Pending               respjson.Field
		PercentComplete       respjson.Field
		Sending               respjson.Field
		Skipped               respjson.Field
		Status                respjson.Field
		Total                 respjson.Field
		ActualCost            respjson.Field
		EstimatedCompletionAt respjson.Field
		EstimatedCost         respjson.Field
		ReservedAmount        respjson.Field
		StartedAt             respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastProgress) RawJSON

func (r BroadcastProgress) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastProgress) UnmarshalJSON

func (r *BroadcastProgress) UnmarshalJSON(data []byte) error

type BroadcastRescheduleParams

type BroadcastRescheduleParams struct {
	// New scheduled time for the broadcast.
	ScheduledAt time.Time `json:"scheduledAt" api:"required" format:"date-time"`
	// contains filtered or unexported fields
}

func (BroadcastRescheduleParams) MarshalJSON

func (r BroadcastRescheduleParams) MarshalJSON() (data []byte, err error)

func (*BroadcastRescheduleParams) UnmarshalJSON

func (r *BroadcastRescheduleParams) UnmarshalJSON(data []byte) error

type BroadcastRescheduleResponse

type BroadcastRescheduleResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastRescheduleResponse) RawJSON

func (r BroadcastRescheduleResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastRescheduleResponse) UnmarshalJSON

func (r *BroadcastRescheduleResponse) UnmarshalJSON(data []byte) error

type BroadcastReviewResult

type BroadcastReviewResult struct {
	// Policy categories violated, if any.
	Categories []string `json:"categories"`
	// Problematic text fragments, if any.
	FlaggedContent []string `json:"flaggedContent" api:"nullable"`
	// Explanation of the review decision.
	Reasoning  string    `json:"reasoning"`
	ReviewedAt time.Time `json:"reviewedAt" format:"date-time"`
	// Content safety score from 0.0 to 1.0, where 1.0 is completely safe.
	Score float64 `json:"score"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Categories     respjson.Field
		FlaggedContent respjson.Field
		Reasoning      respjson.Field
		ReviewedAt     respjson.Field
		Score          respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AI content review result.

func (BroadcastReviewResult) RawJSON

func (r BroadcastReviewResult) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastReviewResult) UnmarshalJSON

func (r *BroadcastReviewResult) UnmarshalJSON(data []byte) error

type BroadcastSendParams

type BroadcastSendParams struct {
	// Schedule for future delivery. Omit to send immediately.
	ScheduledAt param.Opt[time.Time] `json:"scheduledAt,omitzero" format:"date-time"`
	// contains filtered or unexported fields
}

func (BroadcastSendParams) MarshalJSON

func (r BroadcastSendParams) MarshalJSON() (data []byte, err error)

func (*BroadcastSendParams) UnmarshalJSON

func (r *BroadcastSendParams) UnmarshalJSON(data []byte) error

type BroadcastSendResponse

type BroadcastSendResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastSendResponse) RawJSON

func (r BroadcastSendResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastSendResponse) UnmarshalJSON

func (r *BroadcastSendResponse) UnmarshalJSON(data []byte) error

type BroadcastService

type BroadcastService struct {
	Options  []option.RequestOption
	Contacts BroadcastContactService
}

BroadcastService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewBroadcastService method instead.

func NewBroadcastService

func NewBroadcastService(opts ...option.RequestOption) (r BroadcastService)

NewBroadcastService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*BroadcastService) Cancel

func (r *BroadcastService) Cancel(ctx context.Context, broadcastID string, opts ...option.RequestOption) (res *BroadcastCancelResponse, err error)

Cancel a broadcast. Pending contacts will be skipped, but already queued messages may still be delivered.

func (*BroadcastService) Delete

func (r *BroadcastService) Delete(ctx context.Context, broadcastID string, opts ...option.RequestOption) (err error)

Delete a broadcast in draft status.

func (*BroadcastService) Get

func (r *BroadcastService) Get(ctx context.Context, broadcastID string, opts ...option.RequestOption) (res *BroadcastGetResponse, err error)

Get broadcast

func (*BroadcastService) List

List broadcasts for this project.

func (*BroadcastService) ListAutoPaging

List broadcasts for this project.

func (*BroadcastService) New

Create a new broadcast campaign. Add contacts after creation, then send.

func (*BroadcastService) Progress

func (r *BroadcastService) Progress(ctx context.Context, broadcastID string, opts ...option.RequestOption) (res *BroadcastProgress, err error)

Get real-time progress of a broadcast including delivery counts and estimated completion time.

func (*BroadcastService) Reschedule

func (r *BroadcastService) Reschedule(ctx context.Context, broadcastID string, body BroadcastRescheduleParams, opts ...option.RequestOption) (res *BroadcastRescheduleResponse, err error)

Update the scheduled time for a broadcast. The broadcast must be in scheduled status.

func (*BroadcastService) Send

func (r *BroadcastService) Send(ctx context.Context, broadcastID string, body BroadcastSendParams, opts ...option.RequestOption) (res *BroadcastSendResponse, err error)

Start sending the broadcast immediately or schedule for later. Broadcasts go through automated AI content review before sending. If the review passes, the broadcast proceeds. If rejected, use PATCH to edit content, then call POST /retry-review. Reserves the estimated cost from your balance.

func (*BroadcastService) Update

func (r *BroadcastService) Update(ctx context.Context, broadcastID string, body BroadcastUpdateParams, opts ...option.RequestOption) (res *BroadcastUpdateResponse, err error)

Update a broadcast in draft status.

type BroadcastStatus

type BroadcastStatus string

Current status of the broadcast.

const (
	BroadcastStatusDraft         BroadcastStatus = "draft"
	BroadcastStatusPendingReview BroadcastStatus = "pending_review"
	BroadcastStatusApproved      BroadcastStatus = "approved"
	BroadcastStatusRejected      BroadcastStatus = "rejected"
	BroadcastStatusEscalated     BroadcastStatus = "escalated"
	BroadcastStatusRejectedFinal BroadcastStatus = "rejected_final"
	BroadcastStatusScheduled     BroadcastStatus = "scheduled"
	BroadcastStatusSending       BroadcastStatus = "sending"
	BroadcastStatusPaused        BroadcastStatus = "paused"
	BroadcastStatusCompleted     BroadcastStatus = "completed"
	BroadcastStatusCancelled     BroadcastStatus = "cancelled"
	BroadcastStatusFailed        BroadcastStatus = "failed"
)

type BroadcastUpdateParams

type BroadcastUpdateParams struct {
	EmailHTMLBody param.Opt[string] `json:"emailHtmlBody,omitzero"`
	EmailSubject  param.Opt[string] `json:"emailSubject,omitzero"`
	Name          param.Opt[string] `json:"name,omitzero"`
	Text          param.Opt[string] `json:"text,omitzero"`
	// Content for non-text broadcast message types.
	Content  BroadcastContentParam `json:"content,omitzero"`
	Metadata map[string]string     `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (BroadcastUpdateParams) MarshalJSON

func (r BroadcastUpdateParams) MarshalJSON() (data []byte, err error)

func (*BroadcastUpdateParams) UnmarshalJSON

func (r *BroadcastUpdateParams) UnmarshalJSON(data []byte) error

type BroadcastUpdateResponse

type BroadcastUpdateResponse struct {
	Broadcast Broadcast `json:"broadcast" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Broadcast   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (BroadcastUpdateResponse) RawJSON

func (r BroadcastUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*BroadcastUpdateResponse) UnmarshalJSON

func (r *BroadcastUpdateResponse) UnmarshalJSON(data []byte) error

type Channel

type Channel string

Delivery channel. Use 'auto' for intelligent routing.

const (
	ChannelAuto      Channel = "auto"
	ChannelSMS       Channel = "sms"
	ChannelSMSOneway Channel = "sms_oneway"
	ChannelWhatsapp  Channel = "whatsapp"
	ChannelTelegram  Channel = "telegram"
	ChannelEmail     Channel = "email"
	ChannelInstagram Channel = "instagram"
	ChannelVoice     Channel = "voice"
)

type Client

type Client struct {
	Options             []option.RequestOption
	Messages            MessageService
	Templates           TemplateService
	Senders             SenderService
	Contacts            ContactService
	Broadcasts          BroadcastService
	Introspect          IntrospectService
	PhoneNumbers        PhoneNumberService
	Addresses           AddressService
	RegulatoryDocuments RegulatoryDocumentService
}

Client creates a struct with services and top level methods that help with interacting with the zavudev API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (ZAVUDEV_API_KEY, ZAVUDEV_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Contact

type Contact struct {
	ID string `json:"id" api:"required"`
	// List of available messaging channels for this contact.
	AvailableChannels []string          `json:"availableChannels" api:"required"`
	CreatedAt         time.Time         `json:"createdAt" api:"required" format:"date-time"`
	Metadata          map[string]string `json:"metadata" api:"required"`
	// Whether this contact has been verified.
	Verified bool `json:"verified" api:"required"`
	// All communication channels for this contact.
	Channels    []ContactChannel `json:"channels"`
	CountryCode string           `json:"countryCode"`
	// Preferred channel for this contact.
	//
	// Any of "sms", "whatsapp", "telegram", "email", "instagram", "voice".
	DefaultChannel ContactDefaultChannel `json:"defaultChannel"`
	// Display name for the contact.
	DisplayName string `json:"displayName"`
	// DEPRECATED: Use primaryPhone instead. Primary phone number in E.164 format.
	PhoneNumber string `json:"phoneNumber"`
	// Primary email address.
	PrimaryEmail string `json:"primaryEmail" format:"email"`
	// Primary phone number in E.164 format.
	PrimaryPhone string `json:"primaryPhone"`
	// Contact's WhatsApp profile name. Only available for WhatsApp contacts.
	ProfileName string `json:"profileName" api:"nullable"`
	// ID of a contact suggested for merging.
	SuggestedMergeWith string    `json:"suggestedMergeWith"`
	UpdatedAt          time.Time `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		AvailableChannels  respjson.Field
		CreatedAt          respjson.Field
		Metadata           respjson.Field
		Verified           respjson.Field
		Channels           respjson.Field
		CountryCode        respjson.Field
		DefaultChannel     respjson.Field
		DisplayName        respjson.Field
		PhoneNumber        respjson.Field
		PrimaryEmail       respjson.Field
		PrimaryPhone       respjson.Field
		ProfileName        respjson.Field
		SuggestedMergeWith respjson.Field
		UpdatedAt          respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Contact) RawJSON

func (r Contact) RawJSON() string

Returns the unmodified JSON received from the API

func (*Contact) UnmarshalJSON

func (r *Contact) UnmarshalJSON(data []byte) error

type ContactChannel

type ContactChannel struct {
	ID string `json:"id" api:"required"`
	// Channel type.
	//
	// Any of "sms", "whatsapp", "email", "telegram", "voice".
	Channel   string    `json:"channel" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Channel identifier (phone number or email address).
	Identifier string `json:"identifier" api:"required"`
	// Whether this is the primary channel for its type.
	IsPrimary bool `json:"isPrimary" api:"required"`
	// Whether this channel has been verified.
	Verified bool `json:"verified" api:"required"`
	// ISO country code for phone numbers.
	CountryCode string `json:"countryCode"`
	// Optional label for the channel.
	Label string `json:"label"`
	// Last time a message was received on this channel.
	LastInboundAt time.Time         `json:"lastInboundAt" format:"date-time"`
	Metadata      map[string]string `json:"metadata"`
	// Delivery metrics for this channel.
	Metrics   ContactChannelMetrics `json:"metrics"`
	UpdatedAt time.Time             `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID            respjson.Field
		Channel       respjson.Field
		CreatedAt     respjson.Field
		Identifier    respjson.Field
		IsPrimary     respjson.Field
		Verified      respjson.Field
		CountryCode   respjson.Field
		Label         respjson.Field
		LastInboundAt respjson.Field
		Metadata      respjson.Field
		Metrics       respjson.Field
		UpdatedAt     respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A communication channel for a contact.

func (ContactChannel) RawJSON

func (r ContactChannel) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContactChannel) UnmarshalJSON

func (r *ContactChannel) UnmarshalJSON(data []byte) error

type ContactChannelMetrics

type ContactChannelMetrics struct {
	AvgDeliveryTimeMs float64   `json:"avgDeliveryTimeMs"`
	FailureCount      int64     `json:"failureCount"`
	LastSuccessAt     time.Time `json:"lastSuccessAt" format:"date-time"`
	SuccessCount      int64     `json:"successCount"`
	TotalAttempts     int64     `json:"totalAttempts"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvgDeliveryTimeMs respjson.Field
		FailureCount      respjson.Field
		LastSuccessAt     respjson.Field
		SuccessCount      respjson.Field
		TotalAttempts     respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Delivery metrics for this channel.

func (ContactChannelMetrics) RawJSON

func (r ContactChannelMetrics) RawJSON() string

Returns the unmodified JSON received from the API

func (*ContactChannelMetrics) UnmarshalJSON

func (r *ContactChannelMetrics) UnmarshalJSON(data []byte) error

type ContactDefaultChannel

type ContactDefaultChannel string

Preferred channel for this contact.

const (
	ContactDefaultChannelSMS       ContactDefaultChannel = "sms"
	ContactDefaultChannelWhatsapp  ContactDefaultChannel = "whatsapp"
	ContactDefaultChannelTelegram  ContactDefaultChannel = "telegram"
	ContactDefaultChannelEmail     ContactDefaultChannel = "email"
	ContactDefaultChannelInstagram ContactDefaultChannel = "instagram"
	ContactDefaultChannelVoice     ContactDefaultChannel = "voice"
)

type ContactListParams

type ContactListParams struct {
	Cursor      param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit       param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	PhoneNumber param.Opt[string] `query:"phoneNumber,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (ContactListParams) URLQuery

func (r ContactListParams) URLQuery() (v url.Values, err error)

URLQuery serializes ContactListParams's query parameters as `url.Values`.

type ContactService

type ContactService struct {
	Options []option.RequestOption
}

ContactService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewContactService method instead.

func NewContactService

func NewContactService(opts ...option.RequestOption) (r ContactService)

NewContactService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ContactService) Get

func (r *ContactService) Get(ctx context.Context, contactID string, opts ...option.RequestOption) (res *Contact, err error)

Get contact

func (*ContactService) GetByPhone

func (r *ContactService) GetByPhone(ctx context.Context, phoneNumber string, opts ...option.RequestOption) (res *Contact, err error)

Get contact by phone number

func (*ContactService) List

List contacts with their communication channels.

func (*ContactService) ListAutoPaging

List contacts with their communication channels.

func (*ContactService) Update

func (r *ContactService) Update(ctx context.Context, contactID string, body ContactUpdateParams, opts ...option.RequestOption) (res *Contact, err error)

Update contact

type ContactUpdateParams

type ContactUpdateParams struct {
	// Preferred channel for this contact. Set to null to clear.
	//
	// Any of "sms", "whatsapp", "telegram", "email", "instagram", "voice".
	DefaultChannel ContactUpdateParamsDefaultChannel `json:"defaultChannel,omitzero"`
	Metadata       map[string]string                 `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (ContactUpdateParams) MarshalJSON

func (r ContactUpdateParams) MarshalJSON() (data []byte, err error)

func (*ContactUpdateParams) UnmarshalJSON

func (r *ContactUpdateParams) UnmarshalJSON(data []byte) error

type ContactUpdateParamsDefaultChannel

type ContactUpdateParamsDefaultChannel string

Preferred channel for this contact. Set to null to clear.

const (
	ContactUpdateParamsDefaultChannelSMS       ContactUpdateParamsDefaultChannel = "sms"
	ContactUpdateParamsDefaultChannelWhatsapp  ContactUpdateParamsDefaultChannel = "whatsapp"
	ContactUpdateParamsDefaultChannelTelegram  ContactUpdateParamsDefaultChannel = "telegram"
	ContactUpdateParamsDefaultChannelEmail     ContactUpdateParamsDefaultChannel = "email"
	ContactUpdateParamsDefaultChannelInstagram ContactUpdateParamsDefaultChannel = "instagram"
	ContactUpdateParamsDefaultChannelVoice     ContactUpdateParamsDefaultChannel = "voice"
)

type Error

type Error = apierror.Error

type IntrospectService

type IntrospectService struct {
	Options []option.RequestOption
}

IntrospectService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewIntrospectService method instead.

func NewIntrospectService

func NewIntrospectService(opts ...option.RequestOption) (r IntrospectService)

NewIntrospectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*IntrospectService) ValidatePhone

Validate a phone number and check if a WhatsApp conversation window is open.

type IntrospectValidatePhoneParams

type IntrospectValidatePhoneParams struct {
	PhoneNumber string `json:"phoneNumber" api:"required"`
	// contains filtered or unexported fields
}

func (IntrospectValidatePhoneParams) MarshalJSON

func (r IntrospectValidatePhoneParams) MarshalJSON() (data []byte, err error)

func (*IntrospectValidatePhoneParams) UnmarshalJSON

func (r *IntrospectValidatePhoneParams) UnmarshalJSON(data []byte) error

type IntrospectValidatePhoneResponse

type IntrospectValidatePhoneResponse struct {
	CountryCode string `json:"countryCode" api:"required"`
	PhoneNumber string `json:"phoneNumber" api:"required"`
	ValidNumber bool   `json:"validNumber" api:"required"`
	// List of available messaging channels for this phone number.
	AvailableChannels []string `json:"availableChannels"`
	// Carrier information for the phone number.
	Carrier IntrospectValidatePhoneResponseCarrier `json:"carrier"`
	// Type of phone line.
	//
	// Any of "mobile", "landline", "voip", "toll_free", "unknown".
	LineType LineType `json:"lineType"`
	// Phone number in national format.
	NationalFormat string `json:"nationalFormat"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CountryCode       respjson.Field
		PhoneNumber       respjson.Field
		ValidNumber       respjson.Field
		AvailableChannels respjson.Field
		Carrier           respjson.Field
		LineType          respjson.Field
		NationalFormat    respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (IntrospectValidatePhoneResponse) RawJSON

Returns the unmodified JSON received from the API

func (*IntrospectValidatePhoneResponse) UnmarshalJSON

func (r *IntrospectValidatePhoneResponse) UnmarshalJSON(data []byte) error

type IntrospectValidatePhoneResponseCarrier

type IntrospectValidatePhoneResponseCarrier struct {
	// Carrier name.
	Name string `json:"name" api:"nullable"`
	// Type of phone line.
	//
	// Any of "mobile", "landline", "voip", "toll_free", "unknown".
	Type LineType `json:"type"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Type        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Carrier information for the phone number.

func (IntrospectValidatePhoneResponseCarrier) RawJSON

Returns the unmodified JSON received from the API

func (*IntrospectValidatePhoneResponseCarrier) UnmarshalJSON

func (r *IntrospectValidatePhoneResponseCarrier) UnmarshalJSON(data []byte) error

type LineType

type LineType string

Type of phone line.

const (
	LineTypeMobile   LineType = "mobile"
	LineTypeLandline LineType = "landline"
	LineTypeVoip     LineType = "voip"
	LineTypeTollFree LineType = "toll_free"
	LineTypeUnknown  LineType = "unknown"
)

type Message

type Message struct {
	ID string `json:"id" api:"required"`
	// Delivery channel. Use 'auto' for intelligent routing.
	//
	// Any of "auto", "sms", "sms_oneway", "whatsapp", "telegram", "email",
	// "instagram", "voice".
	Channel   Channel   `json:"channel" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Type of message. Non-text types are supported by WhatsApp and Telegram (varies
	// by type).
	//
	// Any of "text", "image", "video", "audio", "document", "sticker", "location",
	// "contact", "buttons", "list", "reaction", "template".
	MessageType MessageType `json:"messageType" api:"required"`
	// Any of "queued", "sending", "sent", "delivered", "failed", "received",
	// "pending_url_verification".
	Status MessageStatus `json:"status" api:"required"`
	To     string        `json:"to" api:"required"`
	// Content for non-text message types (WhatsApp and Telegram).
	Content MessageContent `json:"content"`
	// MAU cost in USD (charged for first contact of the month).
	Cost float64 `json:"cost" api:"nullable"`
	// Provider cost in USD (Telnyx, SES, etc.).
	CostProvider float64 `json:"costProvider" api:"nullable"`
	// Total cost in USD (MAU + provider cost).
	CostTotal    float64           `json:"costTotal" api:"nullable"`
	ErrorCode    string            `json:"errorCode" api:"nullable"`
	ErrorMessage string            `json:"errorMessage" api:"nullable"`
	From         string            `json:"from"`
	Metadata     map[string]string `json:"metadata"`
	// Message ID from the delivery provider.
	ProviderMessageID string `json:"providerMessageId"`
	SenderID          string `json:"senderId"`
	// Text content or caption.
	Text      string    `json:"text"`
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                respjson.Field
		Channel           respjson.Field
		CreatedAt         respjson.Field
		MessageType       respjson.Field
		Status            respjson.Field
		To                respjson.Field
		Content           respjson.Field
		Cost              respjson.Field
		CostProvider      respjson.Field
		CostTotal         respjson.Field
		ErrorCode         respjson.Field
		ErrorMessage      respjson.Field
		From              respjson.Field
		Metadata          respjson.Field
		ProviderMessageID respjson.Field
		SenderID          respjson.Field
		Text              respjson.Field
		UpdatedAt         respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Message) RawJSON

func (r Message) RawJSON() string

Returns the unmodified JSON received from the API

func (*Message) UnmarshalJSON

func (r *Message) UnmarshalJSON(data []byte) error

type MessageContent

type MessageContent struct {
	// Interactive buttons (max 3).
	Buttons []MessageContentButton `json:"buttons"`
	// Contact cards for contact messages.
	Contacts []MessageContentContact `json:"contacts"`
	// Emoji for reaction messages.
	Emoji string `json:"emoji"`
	// Filename for documents.
	Filename string `json:"filename"`
	// Latitude for location messages.
	Latitude float64 `json:"latitude"`
	// Button text for list messages.
	ListButton string `json:"listButton"`
	// Address of the location.
	LocationAddress string `json:"locationAddress"`
	// Name of the location.
	LocationName string `json:"locationName"`
	// Longitude for location messages.
	Longitude float64 `json:"longitude"`
	// WhatsApp media ID if already uploaded.
	MediaID string `json:"mediaId"`
	// URL of the media file (for image, video, audio, document, sticker).
	MediaURL string `json:"mediaUrl"`
	// MIME type of the media.
	MimeType string `json:"mimeType"`
	// Message ID to react to.
	ReactToMessageID string `json:"reactToMessageId"`
	// Sections for list messages.
	Sections []MessageContentSection `json:"sections"`
	// Template ID for template messages.
	TemplateID string `json:"templateId"`
	// Variables for template rendering. Keys are variable positions (1, 2, 3...).
	TemplateVariables map[string]string `json:"templateVariables"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Buttons           respjson.Field
		Contacts          respjson.Field
		Emoji             respjson.Field
		Filename          respjson.Field
		Latitude          respjson.Field
		ListButton        respjson.Field
		LocationAddress   respjson.Field
		LocationName      respjson.Field
		Longitude         respjson.Field
		MediaID           respjson.Field
		MediaURL          respjson.Field
		MimeType          respjson.Field
		ReactToMessageID  respjson.Field
		Sections          respjson.Field
		TemplateID        respjson.Field
		TemplateVariables respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Content for non-text message types (WhatsApp and Telegram).

func (MessageContent) RawJSON

func (r MessageContent) RawJSON() string

Returns the unmodified JSON received from the API

func (MessageContent) ToParam

func (r MessageContent) ToParam() MessageContentParam

ToParam converts this MessageContent to a MessageContentParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with MessageContentParam.Overrides()

func (*MessageContent) UnmarshalJSON

func (r *MessageContent) UnmarshalJSON(data []byte) error

type MessageContentButton

type MessageContentButton struct {
	ID    string `json:"id" api:"required"`
	Title string `json:"title" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Title       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageContentButton) RawJSON

func (r MessageContentButton) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentButton) UnmarshalJSON

func (r *MessageContentButton) UnmarshalJSON(data []byte) error

type MessageContentButtonParam

type MessageContentButtonParam struct {
	ID    string `json:"id" api:"required"`
	Title string `json:"title" api:"required"`
	// contains filtered or unexported fields
}

The properties ID, Title are required.

func (MessageContentButtonParam) MarshalJSON

func (r MessageContentButtonParam) MarshalJSON() (data []byte, err error)

func (*MessageContentButtonParam) UnmarshalJSON

func (r *MessageContentButtonParam) UnmarshalJSON(data []byte) error

type MessageContentContact

type MessageContentContact struct {
	Name   string   `json:"name"`
	Phones []string `json:"phones"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Name        respjson.Field
		Phones      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageContentContact) RawJSON

func (r MessageContentContact) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentContact) UnmarshalJSON

func (r *MessageContentContact) UnmarshalJSON(data []byte) error

type MessageContentContactParam

type MessageContentContactParam struct {
	Name   param.Opt[string] `json:"name,omitzero"`
	Phones []string          `json:"phones,omitzero"`
	// contains filtered or unexported fields
}

func (MessageContentContactParam) MarshalJSON

func (r MessageContentContactParam) MarshalJSON() (data []byte, err error)

func (*MessageContentContactParam) UnmarshalJSON

func (r *MessageContentContactParam) UnmarshalJSON(data []byte) error

type MessageContentParam

type MessageContentParam struct {
	// Emoji for reaction messages.
	Emoji param.Opt[string] `json:"emoji,omitzero"`
	// Filename for documents.
	Filename param.Opt[string] `json:"filename,omitzero"`
	// Latitude for location messages.
	Latitude param.Opt[float64] `json:"latitude,omitzero"`
	// Button text for list messages.
	ListButton param.Opt[string] `json:"listButton,omitzero"`
	// Address of the location.
	LocationAddress param.Opt[string] `json:"locationAddress,omitzero"`
	// Name of the location.
	LocationName param.Opt[string] `json:"locationName,omitzero"`
	// Longitude for location messages.
	Longitude param.Opt[float64] `json:"longitude,omitzero"`
	// WhatsApp media ID if already uploaded.
	MediaID param.Opt[string] `json:"mediaId,omitzero"`
	// URL of the media file (for image, video, audio, document, sticker).
	MediaURL param.Opt[string] `json:"mediaUrl,omitzero"`
	// MIME type of the media.
	MimeType param.Opt[string] `json:"mimeType,omitzero"`
	// Message ID to react to.
	ReactToMessageID param.Opt[string] `json:"reactToMessageId,omitzero"`
	// Template ID for template messages.
	TemplateID param.Opt[string] `json:"templateId,omitzero"`
	// Interactive buttons (max 3).
	Buttons []MessageContentButtonParam `json:"buttons,omitzero"`
	// Contact cards for contact messages.
	Contacts []MessageContentContactParam `json:"contacts,omitzero"`
	// Sections for list messages.
	Sections []MessageContentSectionParam `json:"sections,omitzero"`
	// Variables for template rendering. Keys are variable positions (1, 2, 3...).
	TemplateVariables map[string]string `json:"templateVariables,omitzero"`
	// contains filtered or unexported fields
}

Content for non-text message types (WhatsApp and Telegram).

func (MessageContentParam) MarshalJSON

func (r MessageContentParam) MarshalJSON() (data []byte, err error)

func (*MessageContentParam) UnmarshalJSON

func (r *MessageContentParam) UnmarshalJSON(data []byte) error

type MessageContentSection

type MessageContentSection struct {
	Rows  []MessageContentSectionRow `json:"rows" api:"required"`
	Title string                     `json:"title" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Rows        respjson.Field
		Title       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageContentSection) RawJSON

func (r MessageContentSection) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentSection) UnmarshalJSON

func (r *MessageContentSection) UnmarshalJSON(data []byte) error

type MessageContentSectionParam

type MessageContentSectionParam struct {
	Rows  []MessageContentSectionRowParam `json:"rows,omitzero" api:"required"`
	Title string                          `json:"title" api:"required"`
	// contains filtered or unexported fields
}

The properties Rows, Title are required.

func (MessageContentSectionParam) MarshalJSON

func (r MessageContentSectionParam) MarshalJSON() (data []byte, err error)

func (*MessageContentSectionParam) UnmarshalJSON

func (r *MessageContentSectionParam) UnmarshalJSON(data []byte) error

type MessageContentSectionRow

type MessageContentSectionRow struct {
	ID          string `json:"id" api:"required"`
	Title       string `json:"title" api:"required"`
	Description string `json:"description"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Title       respjson.Field
		Description respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageContentSectionRow) RawJSON

func (r MessageContentSectionRow) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageContentSectionRow) UnmarshalJSON

func (r *MessageContentSectionRow) UnmarshalJSON(data []byte) error

type MessageContentSectionRowParam

type MessageContentSectionRowParam struct {
	ID          string            `json:"id" api:"required"`
	Title       string            `json:"title" api:"required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

The properties ID, Title are required.

func (MessageContentSectionRowParam) MarshalJSON

func (r MessageContentSectionRowParam) MarshalJSON() (data []byte, err error)

func (*MessageContentSectionRowParam) UnmarshalJSON

func (r *MessageContentSectionRowParam) UnmarshalJSON(data []byte) error

type MessageListParams

type MessageListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	To     param.Opt[string] `query:"to,omitzero" json:"-"`
	// Delivery channel. Use 'auto' for intelligent routing.
	//
	// Any of "auto", "sms", "sms_oneway", "whatsapp", "telegram", "email",
	// "instagram", "voice".
	Channel Channel `query:"channel,omitzero" json:"-"`
	// Any of "queued", "sending", "sent", "delivered", "failed", "received",
	// "pending_url_verification".
	Status MessageStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (MessageListParams) URLQuery

func (r MessageListParams) URLQuery() (v url.Values, err error)

URLQuery serializes MessageListParams's query parameters as `url.Values`.

type MessageReactParams

type MessageReactParams struct {
	// Single emoji character to react with.
	Emoji      string            `json:"emoji" api:"required"`
	ZavuSender param.Opt[string] `header:"Zavu-Sender,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (MessageReactParams) MarshalJSON

func (r MessageReactParams) MarshalJSON() (data []byte, err error)

func (*MessageReactParams) UnmarshalJSON

func (r *MessageReactParams) UnmarshalJSON(data []byte) error

type MessageResponse

type MessageResponse struct {
	Message Message `json:"message" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (MessageResponse) RawJSON

func (r MessageResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*MessageResponse) UnmarshalJSON

func (r *MessageResponse) UnmarshalJSON(data []byte) error

type MessageSendParams

type MessageSendParams struct {
	// Recipient phone number in E.164 format, email address, or numeric chat ID (for
	// Telegram/Instagram).
	To string `json:"to" api:"required"`
	// Whether to enable automatic fallback to SMS if WhatsApp fails. Defaults to true.
	FallbackEnabled param.Opt[bool] `json:"fallbackEnabled,omitzero"`
	// HTML body for email messages. If provided, email will be sent as multipart with
	// both text and HTML.
	HTMLBody param.Opt[string] `json:"htmlBody,omitzero"`
	// Optional idempotency key to avoid duplicate sends.
	IdempotencyKey param.Opt[string] `json:"idempotencyKey,omitzero"`
	// Reply-To email address for email messages.
	ReplyTo param.Opt[string] `json:"replyTo,omitzero" format:"email"`
	// Email subject line. Required when channel is 'email' or recipient is an email
	// address.
	Subject param.Opt[string] `json:"subject,omitzero"`
	// Text body for text messages or caption for media messages.
	Text param.Opt[string] `json:"text,omitzero"`
	// Language code for voice text-to-speech (e.g., 'en-US', 'es-ES', 'pt-BR'). If
	// omitted, language is auto-detected from recipient's country code.
	VoiceLanguage param.Opt[string] `json:"voiceLanguage,omitzero"`
	ZavuSender    param.Opt[string] `header:"Zavu-Sender,omitzero" json:"-"`
	// Delivery channel. Use 'auto' for intelligent routing. If omitted with non-text
	// messageType, WhatsApp is used. For email recipients, defaults to 'email'.
	//
	// Any of "auto", "sms", "sms_oneway", "whatsapp", "telegram", "email",
	// "instagram", "voice".
	Channel Channel `json:"channel,omitzero"`
	// Additional content for non-text message types.
	Content MessageContentParam `json:"content,omitzero"`
	// Type of message. Defaults to 'text'.
	//
	// Any of "text", "image", "video", "audio", "document", "sticker", "location",
	// "contact", "buttons", "list", "reaction", "template".
	MessageType MessageType `json:"messageType,omitzero"`
	// Arbitrary metadata to associate with the message.
	Metadata map[string]string `json:"metadata,omitzero"`
	// contains filtered or unexported fields
}

func (MessageSendParams) MarshalJSON

func (r MessageSendParams) MarshalJSON() (data []byte, err error)

func (*MessageSendParams) UnmarshalJSON

func (r *MessageSendParams) UnmarshalJSON(data []byte) error

type MessageService

type MessageService struct {
	Options []option.RequestOption
}

MessageService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMessageService method instead.

func NewMessageService

func NewMessageService(opts ...option.RequestOption) (r MessageService)

NewMessageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*MessageService) Get

func (r *MessageService) Get(ctx context.Context, messageID string, opts ...option.RequestOption) (res *MessageResponse, err error)

Get message by ID

func (*MessageService) List

List messages previously sent by this project.

func (*MessageService) ListAutoPaging

List messages previously sent by this project.

func (*MessageService) React

func (r *MessageService) React(ctx context.Context, messageID string, params MessageReactParams, opts ...option.RequestOption) (res *MessageResponse, err error)

Send an emoji reaction to an existing WhatsApp message. Reactions are only supported for WhatsApp messages.

func (*MessageService) Send

func (r *MessageService) Send(ctx context.Context, params MessageSendParams, opts ...option.RequestOption) (res *MessageResponse, err error)

Send a message to a recipient via SMS or WhatsApp.

**Channel selection:**

- If `channel` is omitted and `messageType` is `text`, defaults to SMS - If `messageType` is anything other than `text`, WhatsApp is used automatically

**WhatsApp 24-hour window:**

- Free-form messages (non-template) require an open 24h window - Window opens when the user messages you first - Use template messages to initiate conversations outside the window

**Daily limits:**

- Unverified accounts: 200 messages per channel per day - Complete KYC verification to increase limits to 10,000/day

type MessageStatus

type MessageStatus string
const (
	MessageStatusQueued                 MessageStatus = "queued"
	MessageStatusSending                MessageStatus = "sending"
	MessageStatusSent                   MessageStatus = "sent"
	MessageStatusDelivered              MessageStatus = "delivered"
	MessageStatusFailed                 MessageStatus = "failed"
	MessageStatusReceived               MessageStatus = "received"
	MessageStatusPendingURLVerification MessageStatus = "pending_url_verification"
)

type MessageType

type MessageType string

Type of message. Non-text types are supported by WhatsApp and Telegram (varies by type).

const (
	MessageTypeText     MessageType = "text"
	MessageTypeImage    MessageType = "image"
	MessageTypeVideo    MessageType = "video"
	MessageTypeAudio    MessageType = "audio"
	MessageTypeDocument MessageType = "document"
	MessageTypeSticker  MessageType = "sticker"
	MessageTypeLocation MessageType = "location"
	MessageTypeContact  MessageType = "contact"
	MessageTypeButtons  MessageType = "buttons"
	MessageTypeList     MessageType = "list"
	MessageTypeReaction MessageType = "reaction"
	MessageTypeTemplate MessageType = "template"
)

type OwnedPhoneNumber

type OwnedPhoneNumber struct {
	ID           string                  `json:"id" api:"required"`
	Capabilities []string                `json:"capabilities" api:"required"`
	CreatedAt    time.Time               `json:"createdAt" api:"required" format:"date-time"`
	PhoneNumber  string                  `json:"phoneNumber" api:"required"`
	Pricing      OwnedPhoneNumberPricing `json:"pricing" api:"required"`
	// Any of "active", "suspended", "pending".
	Status PhoneNumberStatus `json:"status" api:"required"`
	// Optional custom name for the phone number.
	Name            string    `json:"name"`
	NextRenewalDate time.Time `json:"nextRenewalDate" format:"date-time"`
	// Sender ID if the phone number is assigned to a sender.
	SenderID  string    `json:"senderId"`
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		Capabilities    respjson.Field
		CreatedAt       respjson.Field
		PhoneNumber     respjson.Field
		Pricing         respjson.Field
		Status          respjson.Field
		Name            respjson.Field
		NextRenewalDate respjson.Field
		SenderID        respjson.Field
		UpdatedAt       respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OwnedPhoneNumber) RawJSON

func (r OwnedPhoneNumber) RawJSON() string

Returns the unmodified JSON received from the API

func (*OwnedPhoneNumber) UnmarshalJSON

func (r *OwnedPhoneNumber) UnmarshalJSON(data []byte) error

type OwnedPhoneNumberPricing

type OwnedPhoneNumberPricing struct {
	// Whether this is a free number.
	IsFreeNumber bool `json:"isFreeNumber"`
	// Monthly cost in cents.
	MonthlyCost float64 `json:"monthlyCost"`
	// Monthly price in USD.
	MonthlyPrice float64 `json:"monthlyPrice"`
	// One-time purchase cost in cents.
	UpfrontCost float64 `json:"upfrontCost"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsFreeNumber respjson.Field
		MonthlyCost  respjson.Field
		MonthlyPrice respjson.Field
		UpfrontCost  respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (OwnedPhoneNumberPricing) RawJSON

func (r OwnedPhoneNumberPricing) RawJSON() string

Returns the unmodified JSON received from the API

func (*OwnedPhoneNumberPricing) UnmarshalJSON

func (r *OwnedPhoneNumberPricing) UnmarshalJSON(data []byte) error

type PhoneNumberCapabilities

type PhoneNumberCapabilities struct {
	Mms   bool `json:"mms"`
	SMS   bool `json:"sms"`
	Voice bool `json:"voice"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Mms         respjson.Field
		SMS         respjson.Field
		Voice       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberCapabilities) RawJSON

func (r PhoneNumberCapabilities) RawJSON() string

Returns the unmodified JSON received from the API

func (*PhoneNumberCapabilities) UnmarshalJSON

func (r *PhoneNumberCapabilities) UnmarshalJSON(data []byte) error

type PhoneNumberGetResponse

type PhoneNumberGetResponse struct {
	PhoneNumber OwnedPhoneNumber `json:"phoneNumber" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PhoneNumber respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberGetResponse) RawJSON

func (r PhoneNumberGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PhoneNumberGetResponse) UnmarshalJSON

func (r *PhoneNumberGetResponse) UnmarshalJSON(data []byte) error

type PhoneNumberListParams

type PhoneNumberListParams struct {
	// Pagination cursor.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Filter by phone number status.
	//
	// Any of "active", "suspended", "pending".
	Status PhoneNumberStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PhoneNumberListParams) URLQuery

func (r PhoneNumberListParams) URLQuery() (v url.Values, err error)

URLQuery serializes PhoneNumberListParams's query parameters as `url.Values`.

type PhoneNumberPricing

type PhoneNumberPricing struct {
	// Whether this number qualifies for the free first US number offer.
	IsFreeEligible bool `json:"isFreeEligible"`
	// Monthly price in USD.
	MonthlyPrice float64 `json:"monthlyPrice"`
	// One-time purchase price in USD.
	UpfrontPrice float64 `json:"upfrontPrice"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		IsFreeEligible respjson.Field
		MonthlyPrice   respjson.Field
		UpfrontPrice   respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberPricing) RawJSON

func (r PhoneNumberPricing) RawJSON() string

Returns the unmodified JSON received from the API

func (*PhoneNumberPricing) UnmarshalJSON

func (r *PhoneNumberPricing) UnmarshalJSON(data []byte) error

type PhoneNumberPurchaseParams

type PhoneNumberPurchaseParams struct {
	// Phone number in E.164 format.
	PhoneNumber string `json:"phoneNumber" api:"required"`
	// Optional custom name for the phone number.
	Name param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (PhoneNumberPurchaseParams) MarshalJSON

func (r PhoneNumberPurchaseParams) MarshalJSON() (data []byte, err error)

func (*PhoneNumberPurchaseParams) UnmarshalJSON

func (r *PhoneNumberPurchaseParams) UnmarshalJSON(data []byte) error

type PhoneNumberPurchaseResponse

type PhoneNumberPurchaseResponse struct {
	PhoneNumber OwnedPhoneNumber `json:"phoneNumber" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PhoneNumber respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberPurchaseResponse) RawJSON

func (r PhoneNumberPurchaseResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PhoneNumberPurchaseResponse) UnmarshalJSON

func (r *PhoneNumberPurchaseResponse) UnmarshalJSON(data []byte) error

type PhoneNumberRequirementsParams

type PhoneNumberRequirementsParams struct {
	// Two-letter ISO country code.
	CountryCode string `query:"countryCode" api:"required" json:"-"`
	// Type of phone number (local, mobile, tollFree).
	//
	// Any of "local", "mobile", "tollFree".
	Type PhoneNumberType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PhoneNumberRequirementsParams) URLQuery

func (r PhoneNumberRequirementsParams) URLQuery() (v url.Values, err error)

URLQuery serializes PhoneNumberRequirementsParams's query parameters as `url.Values`.

type PhoneNumberRequirementsResponse

type PhoneNumberRequirementsResponse struct {
	Items []Requirement `json:"items" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberRequirementsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*PhoneNumberRequirementsResponse) UnmarshalJSON

func (r *PhoneNumberRequirementsResponse) UnmarshalJSON(data []byte) error

type PhoneNumberSearchAvailableParams

type PhoneNumberSearchAvailableParams struct {
	// Two-letter ISO country code.
	CountryCode string `query:"countryCode" api:"required" json:"-"`
	// Search for numbers containing this string.
	Contains param.Opt[string] `query:"contains,omitzero" json:"-"`
	// Maximum number of results to return.
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Type of phone number to search for.
	//
	// Any of "local", "mobile", "tollFree".
	Type PhoneNumberType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (PhoneNumberSearchAvailableParams) URLQuery

func (r PhoneNumberSearchAvailableParams) URLQuery() (v url.Values, err error)

URLQuery serializes PhoneNumberSearchAvailableParams's query parameters as `url.Values`.

type PhoneNumberSearchAvailableResponse

type PhoneNumberSearchAvailableResponse struct {
	Items []AvailablePhoneNumber `json:"items" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Items       respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberSearchAvailableResponse) RawJSON

Returns the unmodified JSON received from the API

func (*PhoneNumberSearchAvailableResponse) UnmarshalJSON

func (r *PhoneNumberSearchAvailableResponse) UnmarshalJSON(data []byte) error

type PhoneNumberService

type PhoneNumberService struct {
	Options []option.RequestOption
}

PhoneNumberService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPhoneNumberService method instead.

func NewPhoneNumberService

func NewPhoneNumberService(opts ...option.RequestOption) (r PhoneNumberService)

NewPhoneNumberService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*PhoneNumberService) Get

func (r *PhoneNumberService) Get(ctx context.Context, phoneNumberID string, opts ...option.RequestOption) (res *PhoneNumberGetResponse, err error)

Get details of a specific phone number.

func (*PhoneNumberService) List

List all phone numbers owned by this project.

func (*PhoneNumberService) ListAutoPaging

List all phone numbers owned by this project.

func (*PhoneNumberService) Purchase

Purchase an available phone number. The first US phone number is free for each team.

func (*PhoneNumberService) Release

func (r *PhoneNumberService) Release(ctx context.Context, phoneNumberID string, opts ...option.RequestOption) (err error)

Release a phone number. The phone number must not be assigned to a sender.

func (*PhoneNumberService) Requirements

Get regulatory requirements for purchasing phone numbers in a specific country. Some countries require additional documentation (addresses, identity documents) before phone numbers can be activated.

func (*PhoneNumberService) SearchAvailable

Search for available phone numbers to purchase by country and type.

func (*PhoneNumberService) Update

func (r *PhoneNumberService) Update(ctx context.Context, phoneNumberID string, body PhoneNumberUpdateParams, opts ...option.RequestOption) (res *PhoneNumberUpdateResponse, err error)

Update a phone number's name or sender assignment.

type PhoneNumberStatus

type PhoneNumberStatus string
const (
	PhoneNumberStatusActive    PhoneNumberStatus = "active"
	PhoneNumberStatusSuspended PhoneNumberStatus = "suspended"
	PhoneNumberStatusPending   PhoneNumberStatus = "pending"
)

type PhoneNumberType

type PhoneNumberType string
const (
	PhoneNumberTypeLocal    PhoneNumberType = "local"
	PhoneNumberTypeMobile   PhoneNumberType = "mobile"
	PhoneNumberTypeTollFree PhoneNumberType = "tollFree"
)

type PhoneNumberUpdateParams

type PhoneNumberUpdateParams struct {
	// Custom name for the phone number. Set to null to clear.
	Name param.Opt[string] `json:"name,omitzero"`
	// Sender ID to assign the phone number to. Set to null to unassign.
	SenderID param.Opt[string] `json:"senderId,omitzero"`
	// contains filtered or unexported fields
}

func (PhoneNumberUpdateParams) MarshalJSON

func (r PhoneNumberUpdateParams) MarshalJSON() (data []byte, err error)

func (*PhoneNumberUpdateParams) UnmarshalJSON

func (r *PhoneNumberUpdateParams) UnmarshalJSON(data []byte) error

type PhoneNumberUpdateResponse

type PhoneNumberUpdateResponse struct {
	PhoneNumber OwnedPhoneNumber `json:"phoneNumber" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		PhoneNumber respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (PhoneNumberUpdateResponse) RawJSON

func (r PhoneNumberUpdateResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*PhoneNumberUpdateResponse) UnmarshalJSON

func (r *PhoneNumberUpdateResponse) UnmarshalJSON(data []byte) error

type RegulatoryDocument

type RegulatoryDocument struct {
	ID        string    `json:"id" api:"required"`
	CreatedAt time.Time `json:"createdAt" api:"required" format:"date-time"`
	// Any of "passport", "national_id", "drivers_license", "utility_bill", "tax_id",
	// "business_registration", "proof_of_address", "other".
	DocumentType RegulatoryDocumentDocumentType `json:"documentType" api:"required"`
	Name         string                         `json:"name" api:"required"`
	// Any of "pending", "uploaded", "verified", "rejected".
	Status          RegulatoryDocumentStatus `json:"status" api:"required"`
	FileSize        int64                    `json:"fileSize"`
	MimeType        string                   `json:"mimeType"`
	RejectionReason string                   `json:"rejectionReason" api:"nullable"`
	UpdatedAt       time.Time                `json:"updatedAt" format:"date-time"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID              respjson.Field
		CreatedAt       respjson.Field
		DocumentType    respjson.Field
		Name            respjson.Field
		Status          respjson.Field
		FileSize        respjson.Field
		MimeType        respjson.Field
		RejectionReason respjson.Field
		UpdatedAt       respjson.Field
		ExtraFields     map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A regulatory document for phone number requirements.

func (RegulatoryDocument) RawJSON

func (r RegulatoryDocument) RawJSON() string

Returns the unmodified JSON received from the API

func (*RegulatoryDocument) UnmarshalJSON

func (r *RegulatoryDocument) UnmarshalJSON(data []byte) error

type RegulatoryDocumentDocumentType

type RegulatoryDocumentDocumentType string
const (
	RegulatoryDocumentDocumentTypePassport             RegulatoryDocumentDocumentType = "passport"
	RegulatoryDocumentDocumentTypeNationalID           RegulatoryDocumentDocumentType = "national_id"
	RegulatoryDocumentDocumentTypeDriversLicense       RegulatoryDocumentDocumentType = "drivers_license"
	RegulatoryDocumentDocumentTypeUtilityBill          RegulatoryDocumentDocumentType = "utility_bill"
	RegulatoryDocumentDocumentTypeTaxID                RegulatoryDocumentDocumentType = "tax_id"
	RegulatoryDocumentDocumentTypeBusinessRegistration RegulatoryDocumentDocumentType = "business_registration"
	RegulatoryDocumentDocumentTypeProofOfAddress       RegulatoryDocumentDocumentType = "proof_of_address"
	RegulatoryDocumentDocumentTypeOther                RegulatoryDocumentDocumentType = "other"
)

type RegulatoryDocumentGetResponse

type RegulatoryDocumentGetResponse struct {
	// A regulatory document for phone number requirements.
	Document RegulatoryDocument `json:"document" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Document    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RegulatoryDocumentGetResponse) RawJSON

Returns the unmodified JSON received from the API

func (*RegulatoryDocumentGetResponse) UnmarshalJSON

func (r *RegulatoryDocumentGetResponse) UnmarshalJSON(data []byte) error

type RegulatoryDocumentListParams

type RegulatoryDocumentListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (RegulatoryDocumentListParams) URLQuery

func (r RegulatoryDocumentListParams) URLQuery() (v url.Values, err error)

URLQuery serializes RegulatoryDocumentListParams's query parameters as `url.Values`.

type RegulatoryDocumentNewParams

type RegulatoryDocumentNewParams struct {
	// Any of "passport", "national_id", "drivers_license", "utility_bill", "tax_id",
	// "business_registration", "proof_of_address", "other".
	DocumentType RegulatoryDocumentNewParamsDocumentType `json:"documentType,omitzero" api:"required"`
	FileSize     int64                                   `json:"fileSize" api:"required"`
	MimeType     string                                  `json:"mimeType" api:"required"`
	Name         string                                  `json:"name" api:"required"`
	// Storage ID from the upload-url endpoint.
	StorageID string `json:"storageId" api:"required"`
	// contains filtered or unexported fields
}

func (RegulatoryDocumentNewParams) MarshalJSON

func (r RegulatoryDocumentNewParams) MarshalJSON() (data []byte, err error)

func (*RegulatoryDocumentNewParams) UnmarshalJSON

func (r *RegulatoryDocumentNewParams) UnmarshalJSON(data []byte) error

type RegulatoryDocumentNewParamsDocumentType

type RegulatoryDocumentNewParamsDocumentType string
const (
	RegulatoryDocumentNewParamsDocumentTypePassport             RegulatoryDocumentNewParamsDocumentType = "passport"
	RegulatoryDocumentNewParamsDocumentTypeNationalID           RegulatoryDocumentNewParamsDocumentType = "national_id"
	RegulatoryDocumentNewParamsDocumentTypeDriversLicense       RegulatoryDocumentNewParamsDocumentType = "drivers_license"
	RegulatoryDocumentNewParamsDocumentTypeUtilityBill          RegulatoryDocumentNewParamsDocumentType = "utility_bill"
	RegulatoryDocumentNewParamsDocumentTypeTaxID                RegulatoryDocumentNewParamsDocumentType = "tax_id"
	RegulatoryDocumentNewParamsDocumentTypeBusinessRegistration RegulatoryDocumentNewParamsDocumentType = "business_registration"
	RegulatoryDocumentNewParamsDocumentTypeProofOfAddress       RegulatoryDocumentNewParamsDocumentType = "proof_of_address"
	RegulatoryDocumentNewParamsDocumentTypeOther                RegulatoryDocumentNewParamsDocumentType = "other"
)

type RegulatoryDocumentNewResponse

type RegulatoryDocumentNewResponse struct {
	// A regulatory document for phone number requirements.
	Document RegulatoryDocument `json:"document" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Document    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RegulatoryDocumentNewResponse) RawJSON

Returns the unmodified JSON received from the API

func (*RegulatoryDocumentNewResponse) UnmarshalJSON

func (r *RegulatoryDocumentNewResponse) UnmarshalJSON(data []byte) error

type RegulatoryDocumentService

type RegulatoryDocumentService struct {
	Options []option.RequestOption
}

RegulatoryDocumentService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewRegulatoryDocumentService method instead.

func NewRegulatoryDocumentService

func NewRegulatoryDocumentService(opts ...option.RequestOption) (r RegulatoryDocumentService)

NewRegulatoryDocumentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*RegulatoryDocumentService) Delete

func (r *RegulatoryDocumentService) Delete(ctx context.Context, documentID string, opts ...option.RequestOption) (err error)

Delete a regulatory document. Cannot delete verified documents.

func (*RegulatoryDocumentService) Get

Get a specific regulatory document.

func (*RegulatoryDocumentService) List

List regulatory documents for this project.

func (*RegulatoryDocumentService) ListAutoPaging

List regulatory documents for this project.

func (*RegulatoryDocumentService) New

Create a regulatory document record after uploading the file. Use the upload-url endpoint first to get an upload URL.

func (*RegulatoryDocumentService) UploadURL

Get a presigned URL to upload a document file. After uploading, use the storageId to create the document record.

type RegulatoryDocumentStatus

type RegulatoryDocumentStatus string
const (
	RegulatoryDocumentStatusPending  RegulatoryDocumentStatus = "pending"
	RegulatoryDocumentStatusUploaded RegulatoryDocumentStatus = "uploaded"
	RegulatoryDocumentStatusVerified RegulatoryDocumentStatus = "verified"
	RegulatoryDocumentStatusRejected RegulatoryDocumentStatus = "rejected"
)

type RegulatoryDocumentUploadURLResponse

type RegulatoryDocumentUploadURLResponse struct {
	// Pre-signed URL for uploading the file.
	UploadURL string `json:"uploadUrl" api:"required" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		UploadURL   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (RegulatoryDocumentUploadURLResponse) RawJSON

Returns the unmodified JSON received from the API

func (*RegulatoryDocumentUploadURLResponse) UnmarshalJSON

func (r *RegulatoryDocumentUploadURLResponse) UnmarshalJSON(data []byte) error

type Requirement

type Requirement struct {
	ID               string            `json:"id" api:"required"`
	Action           string            `json:"action" api:"required"`
	CountryCode      string            `json:"countryCode" api:"required"`
	PhoneNumberType  string            `json:"phoneNumberType" api:"required"`
	RequirementTypes []RequirementType `json:"requirementTypes" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID               respjson.Field
		Action           respjson.Field
		CountryCode      respjson.Field
		PhoneNumberType  respjson.Field
		RequirementTypes respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A group of requirements for a specific country/phone type combination.

func (Requirement) RawJSON

func (r Requirement) RawJSON() string

Returns the unmodified JSON received from the API

func (*Requirement) UnmarshalJSON

func (r *Requirement) UnmarshalJSON(data []byte) error

type RequirementAcceptanceCriteria

type RequirementAcceptanceCriteria struct {
	AllowedValues []string `json:"allowedValues" api:"nullable"`
	MaxLength     int64    `json:"maxLength" api:"nullable"`
	MinLength     int64    `json:"minLength" api:"nullable"`
	RegexPattern  string   `json:"regexPattern" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AllowedValues respjson.Field
		MaxLength     respjson.Field
		MinLength     respjson.Field
		RegexPattern  respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Acceptance criteria for a requirement.

func (RequirementAcceptanceCriteria) RawJSON

Returns the unmodified JSON received from the API

func (*RequirementAcceptanceCriteria) UnmarshalJSON

func (r *RequirementAcceptanceCriteria) UnmarshalJSON(data []byte) error

type RequirementFieldType

type RequirementFieldType string

Type of requirement field.

const (
	RequirementFieldTypeTextual  RequirementFieldType = "textual"
	RequirementFieldTypeAddress  RequirementFieldType = "address"
	RequirementFieldTypeDocument RequirementFieldType = "document"
	RequirementFieldTypeAction   RequirementFieldType = "action"
)

type RequirementType

type RequirementType struct {
	ID          string `json:"id" api:"required"`
	Description string `json:"description" api:"required"`
	Name        string `json:"name" api:"required"`
	// Type of requirement field.
	//
	// Any of "textual", "address", "document", "action".
	Type RequirementFieldType `json:"type" api:"required"`
	// Acceptance criteria for a requirement.
	AcceptanceCriteria RequirementAcceptanceCriteria `json:"acceptanceCriteria"`
	Example            string                        `json:"example" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                 respjson.Field
		Description        respjson.Field
		Name               respjson.Field
		Type               respjson.Field
		AcceptanceCriteria respjson.Field
		Example            respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

A specific requirement type within a requirement group.

func (RequirementType) RawJSON

func (r RequirementType) RawJSON() string

Returns the unmodified JSON received from the API

func (*RequirementType) UnmarshalJSON

func (r *RequirementType) UnmarshalJSON(data []byte) error

type Sender

type Sender struct {
	ID   string `json:"id" api:"required"`
	Name string `json:"name" api:"required"`
	// Phone number in E.164 format.
	PhoneNumber string    `json:"phoneNumber" api:"required"`
	CreatedAt   time.Time `json:"createdAt" format:"date-time"`
	// Whether inbound email receiving is enabled for this sender.
	EmailReceivingEnabled bool `json:"emailReceivingEnabled"`
	// Whether this sender is the project's default.
	IsDefault bool      `json:"isDefault"`
	UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
	// Webhook configuration for the sender.
	Webhook SenderWebhook `json:"webhook"`
	// WhatsApp Business Account information. Only present if a WABA is connected.
	Whatsapp SenderWhatsapp `json:"whatsapp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                    respjson.Field
		Name                  respjson.Field
		PhoneNumber           respjson.Field
		CreatedAt             respjson.Field
		EmailReceivingEnabled respjson.Field
		IsDefault             respjson.Field
		UpdatedAt             respjson.Field
		Webhook               respjson.Field
		Whatsapp              respjson.Field
		ExtraFields           map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Sender) RawJSON

func (r Sender) RawJSON() string

Returns the unmodified JSON received from the API

func (*Sender) UnmarshalJSON

func (r *Sender) UnmarshalJSON(data []byte) error

type SenderAgentExecutionListParams

type SenderAgentExecutionListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// Status of an agent execution.
	//
	// Any of "success", "error", "filtered", "rate_limited", "balance_insufficient".
	Status AgentExecutionStatus `query:"status,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderAgentExecutionListParams) URLQuery

func (r SenderAgentExecutionListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SenderAgentExecutionListParams's query parameters as `url.Values`.

type SenderAgentExecutionService

type SenderAgentExecutionService struct {
	Options []option.RequestOption
}

SenderAgentExecutionService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentExecutionService method instead.

func NewSenderAgentExecutionService

func NewSenderAgentExecutionService(opts ...option.RequestOption) (r SenderAgentExecutionService)

NewSenderAgentExecutionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentExecutionService) List

List recent agent executions with pagination.

func (*SenderAgentExecutionService) ListAutoPaging

List recent agent executions with pagination.

type SenderAgentFlowDeleteParams

type SenderAgentFlowDeleteParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentFlowDuplicateParams

type SenderAgentFlowDuplicateParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	NewName  string `json:"newName" api:"required"`
	// contains filtered or unexported fields
}

func (SenderAgentFlowDuplicateParams) MarshalJSON

func (r SenderAgentFlowDuplicateParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowDuplicateParams) UnmarshalJSON

func (r *SenderAgentFlowDuplicateParams) UnmarshalJSON(data []byte) error

type SenderAgentFlowDuplicateResponse

type SenderAgentFlowDuplicateResponse struct {
	Flow AgentFlow `json:"flow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Flow        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentFlowDuplicateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentFlowDuplicateResponse) UnmarshalJSON

func (r *SenderAgentFlowDuplicateResponse) UnmarshalJSON(data []byte) error

type SenderAgentFlowGetParams

type SenderAgentFlowGetParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentFlowGetResponse

type SenderAgentFlowGetResponse struct {
	Flow AgentFlow `json:"flow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Flow        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentFlowGetResponse) RawJSON

func (r SenderAgentFlowGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderAgentFlowGetResponse) UnmarshalJSON

func (r *SenderAgentFlowGetResponse) UnmarshalJSON(data []byte) error

type SenderAgentFlowListParams

type SenderAgentFlowListParams struct {
	Cursor  param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Enabled param.Opt[bool]   `query:"enabled,omitzero" json:"-"`
	Limit   param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderAgentFlowListParams) URLQuery

func (r SenderAgentFlowListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SenderAgentFlowListParams's query parameters as `url.Values`.

type SenderAgentFlowNewParams

type SenderAgentFlowNewParams struct {
	Name        string                          `json:"name" api:"required"`
	Steps       []SenderAgentFlowNewParamsStep  `json:"steps,omitzero" api:"required"`
	Trigger     SenderAgentFlowNewParamsTrigger `json:"trigger,omitzero" api:"required"`
	Description param.Opt[string]               `json:"description,omitzero"`
	Enabled     param.Opt[bool]                 `json:"enabled,omitzero"`
	Priority    param.Opt[int64]                `json:"priority,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentFlowNewParams) MarshalJSON

func (r SenderAgentFlowNewParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowNewParams) UnmarshalJSON

func (r *SenderAgentFlowNewParams) UnmarshalJSON(data []byte) error

type SenderAgentFlowNewParamsStep

type SenderAgentFlowNewParamsStep struct {
	// Unique step identifier.
	ID string `json:"id" api:"required"`
	// Step configuration (varies by type).
	Config map[string]any `json:"config,omitzero" api:"required"`
	// Type of flow step.
	//
	// Any of "message", "collect", "condition", "tool", "llm", "transfer".
	Type string `json:"type,omitzero" api:"required"`
	// ID of the next step to execute.
	NextStepID param.Opt[string] `json:"nextStepId,omitzero"`
	// contains filtered or unexported fields
}

The properties ID, Config, Type are required.

func (SenderAgentFlowNewParamsStep) MarshalJSON

func (r SenderAgentFlowNewParamsStep) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowNewParamsStep) UnmarshalJSON

func (r *SenderAgentFlowNewParamsStep) UnmarshalJSON(data []byte) error

type SenderAgentFlowNewParamsTrigger

type SenderAgentFlowNewParamsTrigger struct {
	// Type of trigger for a flow.
	//
	// Any of "keyword", "intent", "always", "manual".
	Type string `json:"type,omitzero" api:"required"`
	// Intent that triggers the flow (for intent type).
	Intent param.Opt[string] `json:"intent,omitzero"`
	// Keywords that trigger the flow (for keyword type).
	Keywords []string `json:"keywords,omitzero"`
	// contains filtered or unexported fields
}

The property Type is required.

func (SenderAgentFlowNewParamsTrigger) MarshalJSON

func (r SenderAgentFlowNewParamsTrigger) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowNewParamsTrigger) UnmarshalJSON

func (r *SenderAgentFlowNewParamsTrigger) UnmarshalJSON(data []byte) error

type SenderAgentFlowNewResponse

type SenderAgentFlowNewResponse struct {
	Flow AgentFlow `json:"flow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Flow        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentFlowNewResponse) RawJSON

func (r SenderAgentFlowNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderAgentFlowNewResponse) UnmarshalJSON

func (r *SenderAgentFlowNewResponse) UnmarshalJSON(data []byte) error

type SenderAgentFlowService

type SenderAgentFlowService struct {
	Options []option.RequestOption
}

SenderAgentFlowService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentFlowService method instead.

func NewSenderAgentFlowService

func NewSenderAgentFlowService(opts ...option.RequestOption) (r SenderAgentFlowService)

NewSenderAgentFlowService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentFlowService) Delete

Delete a flow. Cannot delete flows with active sessions.

func (*SenderAgentFlowService) Duplicate

Create a copy of an existing flow with a new name.

func (*SenderAgentFlowService) Get

Get a specific flow.

func (*SenderAgentFlowService) List

List flows for an agent.

func (*SenderAgentFlowService) ListAutoPaging

List flows for an agent.

func (*SenderAgentFlowService) New

Create a new flow for an agent.

func (*SenderAgentFlowService) Update

Update a flow.

type SenderAgentFlowUpdateParams

type SenderAgentFlowUpdateParams struct {
	SenderID    string                             `path:"senderId" api:"required" json:"-"`
	Description param.Opt[string]                  `json:"description,omitzero"`
	Enabled     param.Opt[bool]                    `json:"enabled,omitzero"`
	Name        param.Opt[string]                  `json:"name,omitzero"`
	Priority    param.Opt[int64]                   `json:"priority,omitzero"`
	Steps       []SenderAgentFlowUpdateParamsStep  `json:"steps,omitzero"`
	Trigger     SenderAgentFlowUpdateParamsTrigger `json:"trigger,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentFlowUpdateParams) MarshalJSON

func (r SenderAgentFlowUpdateParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowUpdateParams) UnmarshalJSON

func (r *SenderAgentFlowUpdateParams) UnmarshalJSON(data []byte) error

type SenderAgentFlowUpdateParamsStep

type SenderAgentFlowUpdateParamsStep struct {
	// Unique step identifier.
	ID string `json:"id" api:"required"`
	// Step configuration (varies by type).
	Config map[string]any `json:"config,omitzero" api:"required"`
	// Type of flow step.
	//
	// Any of "message", "collect", "condition", "tool", "llm", "transfer".
	Type string `json:"type,omitzero" api:"required"`
	// ID of the next step to execute.
	NextStepID param.Opt[string] `json:"nextStepId,omitzero"`
	// contains filtered or unexported fields
}

The properties ID, Config, Type are required.

func (SenderAgentFlowUpdateParamsStep) MarshalJSON

func (r SenderAgentFlowUpdateParamsStep) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowUpdateParamsStep) UnmarshalJSON

func (r *SenderAgentFlowUpdateParamsStep) UnmarshalJSON(data []byte) error

type SenderAgentFlowUpdateParamsTrigger

type SenderAgentFlowUpdateParamsTrigger struct {
	// Type of trigger for a flow.
	//
	// Any of "keyword", "intent", "always", "manual".
	Type string `json:"type,omitzero" api:"required"`
	// Intent that triggers the flow (for intent type).
	Intent param.Opt[string] `json:"intent,omitzero"`
	// Keywords that trigger the flow (for keyword type).
	Keywords []string `json:"keywords,omitzero"`
	// contains filtered or unexported fields
}

The property Type is required.

func (SenderAgentFlowUpdateParamsTrigger) MarshalJSON

func (r SenderAgentFlowUpdateParamsTrigger) MarshalJSON() (data []byte, err error)

func (*SenderAgentFlowUpdateParamsTrigger) UnmarshalJSON

func (r *SenderAgentFlowUpdateParamsTrigger) UnmarshalJSON(data []byte) error

type SenderAgentFlowUpdateResponse

type SenderAgentFlowUpdateResponse struct {
	Flow AgentFlow `json:"flow" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Flow        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentFlowUpdateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentFlowUpdateResponse) UnmarshalJSON

func (r *SenderAgentFlowUpdateResponse) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseDeleteParams

type SenderAgentKnowledgeBaseDeleteParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentKnowledgeBaseDocumentDeleteParams

type SenderAgentKnowledgeBaseDocumentDeleteParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	KBID     string `path:"kbId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentKnowledgeBaseDocumentListParams

type SenderAgentKnowledgeBaseDocumentListParams struct {
	SenderID string            `path:"senderId" api:"required" json:"-"`
	Cursor   param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit    param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderAgentKnowledgeBaseDocumentListParams) URLQuery

URLQuery serializes SenderAgentKnowledgeBaseDocumentListParams's query parameters as `url.Values`.

type SenderAgentKnowledgeBaseDocumentNewParams

type SenderAgentKnowledgeBaseDocumentNewParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	Content  string `json:"content" api:"required"`
	Title    string `json:"title" api:"required"`
	// contains filtered or unexported fields
}

func (SenderAgentKnowledgeBaseDocumentNewParams) MarshalJSON

func (r SenderAgentKnowledgeBaseDocumentNewParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentKnowledgeBaseDocumentNewParams) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseDocumentNewParams) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseDocumentNewResponse

type SenderAgentKnowledgeBaseDocumentNewResponse struct {
	Document AgentDocument `json:"document" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Document    respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentKnowledgeBaseDocumentNewResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentKnowledgeBaseDocumentNewResponse) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseDocumentNewResponse) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseDocumentService

type SenderAgentKnowledgeBaseDocumentService struct {
	Options []option.RequestOption
}

SenderAgentKnowledgeBaseDocumentService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentKnowledgeBaseDocumentService method instead.

func NewSenderAgentKnowledgeBaseDocumentService

func NewSenderAgentKnowledgeBaseDocumentService(opts ...option.RequestOption) (r SenderAgentKnowledgeBaseDocumentService)

NewSenderAgentKnowledgeBaseDocumentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentKnowledgeBaseDocumentService) Delete

Delete a document from a knowledge base.

func (*SenderAgentKnowledgeBaseDocumentService) List

List documents in a knowledge base.

func (*SenderAgentKnowledgeBaseDocumentService) ListAutoPaging

List documents in a knowledge base.

func (*SenderAgentKnowledgeBaseDocumentService) New

Add a document to a knowledge base. The document will be automatically processed for RAG.

type SenderAgentKnowledgeBaseGetParams

type SenderAgentKnowledgeBaseGetParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentKnowledgeBaseGetResponse

type SenderAgentKnowledgeBaseGetResponse struct {
	KnowledgeBase AgentKnowledgeBase `json:"knowledgeBase" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		KnowledgeBase respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentKnowledgeBaseGetResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentKnowledgeBaseGetResponse) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseGetResponse) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseListParams

type SenderAgentKnowledgeBaseListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderAgentKnowledgeBaseListParams) URLQuery

func (r SenderAgentKnowledgeBaseListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SenderAgentKnowledgeBaseListParams's query parameters as `url.Values`.

type SenderAgentKnowledgeBaseNewParams

type SenderAgentKnowledgeBaseNewParams struct {
	Name        string            `json:"name" api:"required"`
	Description param.Opt[string] `json:"description,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentKnowledgeBaseNewParams) MarshalJSON

func (r SenderAgentKnowledgeBaseNewParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentKnowledgeBaseNewParams) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseNewParams) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseNewResponse

type SenderAgentKnowledgeBaseNewResponse struct {
	KnowledgeBase AgentKnowledgeBase `json:"knowledgeBase" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		KnowledgeBase respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentKnowledgeBaseNewResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentKnowledgeBaseNewResponse) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseNewResponse) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseService

type SenderAgentKnowledgeBaseService struct {
	Options   []option.RequestOption
	Documents SenderAgentKnowledgeBaseDocumentService
}

SenderAgentKnowledgeBaseService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentKnowledgeBaseService method instead.

func NewSenderAgentKnowledgeBaseService

func NewSenderAgentKnowledgeBaseService(opts ...option.RequestOption) (r SenderAgentKnowledgeBaseService)

NewSenderAgentKnowledgeBaseService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentKnowledgeBaseService) Delete

Delete a knowledge base and all its documents.

func (*SenderAgentKnowledgeBaseService) Get

Get a specific knowledge base.

func (*SenderAgentKnowledgeBaseService) List

List knowledge bases for an agent.

func (*SenderAgentKnowledgeBaseService) ListAutoPaging

List knowledge bases for an agent.

func (*SenderAgentKnowledgeBaseService) New

Create a new knowledge base for an agent.

func (*SenderAgentKnowledgeBaseService) Update

Update a knowledge base.

type SenderAgentKnowledgeBaseUpdateParams

type SenderAgentKnowledgeBaseUpdateParams struct {
	SenderID    string            `path:"senderId" api:"required" json:"-"`
	Description param.Opt[string] `json:"description,omitzero"`
	Name        param.Opt[string] `json:"name,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentKnowledgeBaseUpdateParams) MarshalJSON

func (r SenderAgentKnowledgeBaseUpdateParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentKnowledgeBaseUpdateParams) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseUpdateParams) UnmarshalJSON(data []byte) error

type SenderAgentKnowledgeBaseUpdateResponse

type SenderAgentKnowledgeBaseUpdateResponse struct {
	KnowledgeBase AgentKnowledgeBase `json:"knowledgeBase" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		KnowledgeBase respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentKnowledgeBaseUpdateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentKnowledgeBaseUpdateResponse) UnmarshalJSON

func (r *SenderAgentKnowledgeBaseUpdateResponse) UnmarshalJSON(data []byte) error

type SenderAgentNewParams

type SenderAgentNewParams struct {
	Model string `json:"model" api:"required"`
	Name  string `json:"name" api:"required"`
	// LLM provider for the AI agent.
	//
	// Any of "openai", "anthropic", "google", "mistral", "zavu".
	Provider     AgentProvider `json:"provider,omitzero" api:"required"`
	SystemPrompt string        `json:"systemPrompt" api:"required"`
	// API key for the LLM provider. Required unless provider is 'zavu'.
	APIKey                 param.Opt[string]  `json:"apiKey,omitzero"`
	ContextWindowMessages  param.Opt[int64]   `json:"contextWindowMessages,omitzero"`
	IncludeContactMetadata param.Opt[bool]    `json:"includeContactMetadata,omitzero"`
	MaxTokens              param.Opt[int64]   `json:"maxTokens,omitzero"`
	Temperature            param.Opt[float64] `json:"temperature,omitzero"`
	TriggerOnChannels      []string           `json:"triggerOnChannels,omitzero"`
	TriggerOnMessageTypes  []string           `json:"triggerOnMessageTypes,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentNewParams) MarshalJSON

func (r SenderAgentNewParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentNewParams) UnmarshalJSON

func (r *SenderAgentNewParams) UnmarshalJSON(data []byte) error

type SenderAgentService

type SenderAgentService struct {
	Options        []option.RequestOption
	Executions     SenderAgentExecutionService
	Flows          SenderAgentFlowService
	Tools          SenderAgentToolService
	KnowledgeBases SenderAgentKnowledgeBaseService
}

SenderAgentService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentService method instead.

func NewSenderAgentService

func NewSenderAgentService(opts ...option.RequestOption) (r SenderAgentService)

NewSenderAgentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentService) Delete

func (r *SenderAgentService) Delete(ctx context.Context, senderID string, opts ...option.RequestOption) (err error)

Delete an AI agent.

func (*SenderAgentService) Get

func (r *SenderAgentService) Get(ctx context.Context, senderID string, opts ...option.RequestOption) (res *AgentResponse, err error)

Get the AI agent configuration for a sender.

func (*SenderAgentService) New

func (r *SenderAgentService) New(ctx context.Context, senderID string, body SenderAgentNewParams, opts ...option.RequestOption) (res *AgentResponse, err error)

Create an AI agent for a sender. Each sender can have at most one agent.

func (*SenderAgentService) Stats

func (r *SenderAgentService) Stats(ctx context.Context, senderID string, opts ...option.RequestOption) (res *AgentStats, err error)

Get statistics for an AI agent including invocations, tokens, and costs.

func (*SenderAgentService) Update

func (r *SenderAgentService) Update(ctx context.Context, senderID string, body SenderAgentUpdateParams, opts ...option.RequestOption) (res *AgentResponse, err error)

Update an AI agent's configuration.

type SenderAgentToolDeleteParams

type SenderAgentToolDeleteParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentToolGetParams

type SenderAgentToolGetParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// contains filtered or unexported fields
}

type SenderAgentToolGetResponse

type SenderAgentToolGetResponse struct {
	Tool AgentTool `json:"tool" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Tool        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentToolGetResponse) RawJSON

func (r SenderAgentToolGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderAgentToolGetResponse) UnmarshalJSON

func (r *SenderAgentToolGetResponse) UnmarshalJSON(data []byte) error

type SenderAgentToolListParams

type SenderAgentToolListParams struct {
	Cursor  param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Enabled param.Opt[bool]   `query:"enabled,omitzero" json:"-"`
	Limit   param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderAgentToolListParams) URLQuery

func (r SenderAgentToolListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SenderAgentToolListParams's query parameters as `url.Values`.

type SenderAgentToolNewParams

type SenderAgentToolNewParams struct {
	Description string                             `json:"description" api:"required"`
	Name        string                             `json:"name" api:"required"`
	Parameters  SenderAgentToolNewParamsParameters `json:"parameters,omitzero" api:"required"`
	// Must be HTTPS.
	WebhookURL string          `json:"webhookUrl" api:"required" format:"uri"`
	Enabled    param.Opt[bool] `json:"enabled,omitzero"`
	// Optional secret for webhook signature verification.
	WebhookSecret param.Opt[string] `json:"webhookSecret,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentToolNewParams) MarshalJSON

func (r SenderAgentToolNewParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolNewParams) UnmarshalJSON

func (r *SenderAgentToolNewParams) UnmarshalJSON(data []byte) error

type SenderAgentToolNewParamsParameters

type SenderAgentToolNewParamsParameters struct {
	Properties map[string]SenderAgentToolNewParamsParametersProperty `json:"properties,omitzero" api:"required"`
	Required   []string                                              `json:"required,omitzero" api:"required"`
	// Any of "object".
	Type string `json:"type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties Properties, Required, Type are required.

func (SenderAgentToolNewParamsParameters) MarshalJSON

func (r SenderAgentToolNewParamsParameters) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolNewParamsParameters) UnmarshalJSON

func (r *SenderAgentToolNewParamsParameters) UnmarshalJSON(data []byte) error

type SenderAgentToolNewParamsParametersProperty

type SenderAgentToolNewParamsParametersProperty struct {
	Description param.Opt[string] `json:"description,omitzero"`
	Type        param.Opt[string] `json:"type,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentToolNewParamsParametersProperty) MarshalJSON

func (r SenderAgentToolNewParamsParametersProperty) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolNewParamsParametersProperty) UnmarshalJSON

func (r *SenderAgentToolNewParamsParametersProperty) UnmarshalJSON(data []byte) error

type SenderAgentToolNewResponse

type SenderAgentToolNewResponse struct {
	Tool AgentTool `json:"tool" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Tool        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentToolNewResponse) RawJSON

func (r SenderAgentToolNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderAgentToolNewResponse) UnmarshalJSON

func (r *SenderAgentToolNewResponse) UnmarshalJSON(data []byte) error

type SenderAgentToolService

type SenderAgentToolService struct {
	Options []option.RequestOption
}

SenderAgentToolService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderAgentToolService method instead.

func NewSenderAgentToolService

func NewSenderAgentToolService(opts ...option.RequestOption) (r SenderAgentToolService)

NewSenderAgentToolService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderAgentToolService) Delete

Delete a tool.

func (*SenderAgentToolService) Get

Get a specific tool.

func (*SenderAgentToolService) List

List tools for an agent.

func (*SenderAgentToolService) ListAutoPaging

List tools for an agent.

func (*SenderAgentToolService) New

Create a new tool for an agent. Tools allow the agent to call external webhooks.

func (*SenderAgentToolService) Test

Test a tool by triggering its webhook with test parameters.

func (*SenderAgentToolService) Update

Update a tool.

type SenderAgentToolTestParams

type SenderAgentToolTestParams struct {
	SenderID string `path:"senderId" api:"required" json:"-"`
	// Parameters to pass to the tool for testing.
	TestParams map[string]any `json:"testParams,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (SenderAgentToolTestParams) MarshalJSON

func (r SenderAgentToolTestParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolTestParams) UnmarshalJSON

func (r *SenderAgentToolTestParams) UnmarshalJSON(data []byte) error

type SenderAgentToolTestResponse

type SenderAgentToolTestResponse struct {
	Scheduled bool `json:"scheduled" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Scheduled   respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentToolTestResponse) RawJSON

func (r SenderAgentToolTestResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderAgentToolTestResponse) UnmarshalJSON

func (r *SenderAgentToolTestResponse) UnmarshalJSON(data []byte) error

type SenderAgentToolUpdateParams

type SenderAgentToolUpdateParams struct {
	SenderID      string                                `path:"senderId" api:"required" json:"-"`
	WebhookSecret param.Opt[string]                     `json:"webhookSecret,omitzero"`
	Description   param.Opt[string]                     `json:"description,omitzero"`
	Enabled       param.Opt[bool]                       `json:"enabled,omitzero"`
	Name          param.Opt[string]                     `json:"name,omitzero"`
	WebhookURL    param.Opt[string]                     `json:"webhookUrl,omitzero" format:"uri"`
	Parameters    SenderAgentToolUpdateParamsParameters `json:"parameters,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentToolUpdateParams) MarshalJSON

func (r SenderAgentToolUpdateParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolUpdateParams) UnmarshalJSON

func (r *SenderAgentToolUpdateParams) UnmarshalJSON(data []byte) error

type SenderAgentToolUpdateParamsParameters

type SenderAgentToolUpdateParamsParameters struct {
	Properties map[string]SenderAgentToolUpdateParamsParametersProperty `json:"properties,omitzero" api:"required"`
	Required   []string                                                 `json:"required,omitzero" api:"required"`
	// Any of "object".
	Type string `json:"type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

The properties Properties, Required, Type are required.

func (SenderAgentToolUpdateParamsParameters) MarshalJSON

func (r SenderAgentToolUpdateParamsParameters) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolUpdateParamsParameters) UnmarshalJSON

func (r *SenderAgentToolUpdateParamsParameters) UnmarshalJSON(data []byte) error

type SenderAgentToolUpdateParamsParametersProperty

type SenderAgentToolUpdateParamsParametersProperty struct {
	Description param.Opt[string] `json:"description,omitzero"`
	Type        param.Opt[string] `json:"type,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentToolUpdateParamsParametersProperty) MarshalJSON

func (r SenderAgentToolUpdateParamsParametersProperty) MarshalJSON() (data []byte, err error)

func (*SenderAgentToolUpdateParamsParametersProperty) UnmarshalJSON

func (r *SenderAgentToolUpdateParamsParametersProperty) UnmarshalJSON(data []byte) error

type SenderAgentToolUpdateResponse

type SenderAgentToolUpdateResponse struct {
	Tool AgentTool `json:"tool" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Tool        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderAgentToolUpdateResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderAgentToolUpdateResponse) UnmarshalJSON

func (r *SenderAgentToolUpdateResponse) UnmarshalJSON(data []byte) error

type SenderAgentUpdateParams

type SenderAgentUpdateParams struct {
	MaxTokens              param.Opt[int64]   `json:"maxTokens,omitzero"`
	Temperature            param.Opt[float64] `json:"temperature,omitzero"`
	APIKey                 param.Opt[string]  `json:"apiKey,omitzero"`
	ContextWindowMessages  param.Opt[int64]   `json:"contextWindowMessages,omitzero"`
	Enabled                param.Opt[bool]    `json:"enabled,omitzero"`
	IncludeContactMetadata param.Opt[bool]    `json:"includeContactMetadata,omitzero"`
	Model                  param.Opt[string]  `json:"model,omitzero"`
	Name                   param.Opt[string]  `json:"name,omitzero"`
	SystemPrompt           param.Opt[string]  `json:"systemPrompt,omitzero"`
	// LLM provider for the AI agent.
	//
	// Any of "openai", "anthropic", "google", "mistral", "zavu".
	Provider              AgentProvider `json:"provider,omitzero"`
	TriggerOnChannels     []string      `json:"triggerOnChannels,omitzero"`
	TriggerOnMessageTypes []string      `json:"triggerOnMessageTypes,omitzero"`
	// contains filtered or unexported fields
}

func (SenderAgentUpdateParams) MarshalJSON

func (r SenderAgentUpdateParams) MarshalJSON() (data []byte, err error)

func (*SenderAgentUpdateParams) UnmarshalJSON

func (r *SenderAgentUpdateParams) UnmarshalJSON(data []byte) error

type SenderListParams

type SenderListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (SenderListParams) URLQuery

func (r SenderListParams) URLQuery() (v url.Values, err error)

URLQuery serializes SenderListParams's query parameters as `url.Values`.

type SenderNewParams

type SenderNewParams struct {
	Name         string          `json:"name" api:"required"`
	PhoneNumber  string          `json:"phoneNumber" api:"required"`
	SetAsDefault param.Opt[bool] `json:"setAsDefault,omitzero"`
	// HTTPS URL for webhook events.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero" format:"uri"`
	// Events to subscribe to.
	WebhookEvents []WebhookEvent `json:"webhookEvents,omitzero"`
	// contains filtered or unexported fields
}

func (SenderNewParams) MarshalJSON

func (r SenderNewParams) MarshalJSON() (data []byte, err error)

func (*SenderNewParams) UnmarshalJSON

func (r *SenderNewParams) UnmarshalJSON(data []byte) error

type SenderService

type SenderService struct {
	Options []option.RequestOption
	Agent   SenderAgentService
}

SenderService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSenderService method instead.

func NewSenderService

func NewSenderService(opts ...option.RequestOption) (r SenderService)

NewSenderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*SenderService) Delete

func (r *SenderService) Delete(ctx context.Context, senderID string, opts ...option.RequestOption) (err error)

Delete sender

func (*SenderService) Get

func (r *SenderService) Get(ctx context.Context, senderID string, opts ...option.RequestOption) (res *Sender, err error)

Get sender

func (*SenderService) GetProfile

func (r *SenderService) GetProfile(ctx context.Context, senderID string, opts ...option.RequestOption) (res *WhatsappBusinessProfileResponse, err error)

Get the WhatsApp Business profile for a sender. The sender must have a WhatsApp Business Account connected.

func (*SenderService) List

func (r *SenderService) List(ctx context.Context, query SenderListParams, opts ...option.RequestOption) (res *pagination.Cursor[Sender], err error)

List senders

func (*SenderService) ListAutoPaging

List senders

func (*SenderService) New

func (r *SenderService) New(ctx context.Context, body SenderNewParams, opts ...option.RequestOption) (res *Sender, err error)

Create sender

func (*SenderService) RegenerateWebhookSecret

func (r *SenderService) RegenerateWebhookSecret(ctx context.Context, senderID string, opts ...option.RequestOption) (res *WebhookSecretResponse, err error)

Regenerate the webhook secret for a sender. The old secret will be invalidated immediately.

func (*SenderService) Update

func (r *SenderService) Update(ctx context.Context, senderID string, body SenderUpdateParams, opts ...option.RequestOption) (res *Sender, err error)

Update sender

func (*SenderService) UpdateProfile

func (r *SenderService) UpdateProfile(ctx context.Context, senderID string, body SenderUpdateProfileParams, opts ...option.RequestOption) (res *SenderUpdateProfileResponse, err error)

Update the WhatsApp Business profile for a sender. The sender must have a WhatsApp Business Account connected.

func (*SenderService) UploadProfilePicture

func (r *SenderService) UploadProfilePicture(ctx context.Context, senderID string, body SenderUploadProfilePictureParams, opts ...option.RequestOption) (res *SenderUploadProfilePictureResponse, err error)

Upload a new profile picture for the WhatsApp Business profile. The image will be uploaded to Meta and set as the profile picture.

type SenderUpdateParams

type SenderUpdateParams struct {
	// HTTPS URL for webhook events. Set to null to remove webhook.
	WebhookURL param.Opt[string] `json:"webhookUrl,omitzero" format:"uri"`
	// Enable or disable inbound email receiving for this sender.
	EmailReceivingEnabled param.Opt[bool]   `json:"emailReceivingEnabled,omitzero"`
	Name                  param.Opt[string] `json:"name,omitzero"`
	SetAsDefault          param.Opt[bool]   `json:"setAsDefault,omitzero"`
	// Whether the webhook is active.
	WebhookActive param.Opt[bool] `json:"webhookActive,omitzero"`
	// Events to subscribe to.
	WebhookEvents []WebhookEvent `json:"webhookEvents,omitzero"`
	// contains filtered or unexported fields
}

func (SenderUpdateParams) MarshalJSON

func (r SenderUpdateParams) MarshalJSON() (data []byte, err error)

func (*SenderUpdateParams) UnmarshalJSON

func (r *SenderUpdateParams) UnmarshalJSON(data []byte) error

type SenderUpdateProfileParams

type SenderUpdateProfileParams struct {
	// Short description of the business (max 139 characters).
	About param.Opt[string] `json:"about,omitzero"`
	// Physical address of the business (max 256 characters).
	Address param.Opt[string] `json:"address,omitzero"`
	// Extended description of the business (max 512 characters).
	Description param.Opt[string] `json:"description,omitzero"`
	// Business email address.
	Email param.Opt[string] `json:"email,omitzero" format:"email"`
	// Business category for WhatsApp Business profile.
	//
	// Any of "UNDEFINED", "OTHER", "AUTO", "BEAUTY", "APPAREL", "EDU", "ENTERTAIN",
	// "EVENT_PLAN", "FINANCE", "GROCERY", "GOVT", "HOTEL", "HEALTH", "NONPROFIT",
	// "PROF_SERVICES", "RETAIL", "TRAVEL", "RESTAURANT", "NOT_A_BIZ".
	Vertical WhatsappBusinessProfileVertical `json:"vertical,omitzero"`
	// Business website URLs (maximum 2).
	Websites []string `json:"websites,omitzero" format:"uri"`
	// contains filtered or unexported fields
}

func (SenderUpdateProfileParams) MarshalJSON

func (r SenderUpdateProfileParams) MarshalJSON() (data []byte, err error)

func (*SenderUpdateProfileParams) UnmarshalJSON

func (r *SenderUpdateProfileParams) UnmarshalJSON(data []byte) error

type SenderUpdateProfileResponse

type SenderUpdateProfileResponse struct {
	// WhatsApp Business profile information.
	Profile WhatsappBusinessProfile `json:"profile" api:"required"`
	Success bool                    `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Profile     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderUpdateProfileResponse) RawJSON

func (r SenderUpdateProfileResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderUpdateProfileResponse) UnmarshalJSON

func (r *SenderUpdateProfileResponse) UnmarshalJSON(data []byte) error

type SenderUploadProfilePictureParams

type SenderUploadProfilePictureParams struct {
	// URL of the image to upload.
	ImageURL string `json:"imageUrl" api:"required" format:"uri"`
	// MIME type of the image.
	//
	// Any of "image/jpeg", "image/png".
	MimeType SenderUploadProfilePictureParamsMimeType `json:"mimeType,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (SenderUploadProfilePictureParams) MarshalJSON

func (r SenderUploadProfilePictureParams) MarshalJSON() (data []byte, err error)

func (*SenderUploadProfilePictureParams) UnmarshalJSON

func (r *SenderUploadProfilePictureParams) UnmarshalJSON(data []byte) error

type SenderUploadProfilePictureParamsMimeType

type SenderUploadProfilePictureParamsMimeType string

MIME type of the image.

const (
	SenderUploadProfilePictureParamsMimeTypeImageJpeg SenderUploadProfilePictureParamsMimeType = "image/jpeg"
	SenderUploadProfilePictureParamsMimeTypeImagePng  SenderUploadProfilePictureParamsMimeType = "image/png"
)

type SenderUploadProfilePictureResponse

type SenderUploadProfilePictureResponse struct {
	// WhatsApp Business profile information.
	Profile WhatsappBusinessProfile `json:"profile" api:"required"`
	Success bool                    `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Profile     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (SenderUploadProfilePictureResponse) RawJSON

Returns the unmodified JSON received from the API

func (*SenderUploadProfilePictureResponse) UnmarshalJSON

func (r *SenderUploadProfilePictureResponse) UnmarshalJSON(data []byte) error

type SenderWebhook

type SenderWebhook struct {
	// Whether the webhook is active.
	Active bool `json:"active" api:"required"`
	// List of events the webhook is subscribed to.
	Events []WebhookEvent `json:"events" api:"required"`
	// HTTPS URL that will receive webhook events.
	URL string `json:"url" api:"required" format:"uri"`
	// Webhook secret for signature verification. Only returned on create or
	// regenerate.
	Secret string `json:"secret"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Active      respjson.Field
		Events      respjson.Field
		URL         respjson.Field
		Secret      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Webhook configuration for the sender.

func (SenderWebhook) RawJSON

func (r SenderWebhook) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderWebhook) UnmarshalJSON

func (r *SenderWebhook) UnmarshalJSON(data []byte) error

type SenderWhatsapp

type SenderWhatsapp struct {
	// Display phone number.
	DisplayPhoneNumber string `json:"displayPhoneNumber"`
	// Payment configuration status from Meta.
	PaymentStatus SenderWhatsappPaymentStatus `json:"paymentStatus"`
	// WhatsApp phone number ID from Meta.
	PhoneNumberID string `json:"phoneNumberId"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DisplayPhoneNumber respjson.Field
		PaymentStatus      respjson.Field
		PhoneNumberID      respjson.Field
		ExtraFields        map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

WhatsApp Business Account information. Only present if a WABA is connected.

func (SenderWhatsapp) RawJSON

func (r SenderWhatsapp) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderWhatsapp) UnmarshalJSON

func (r *SenderWhatsapp) UnmarshalJSON(data []byte) error

type SenderWhatsappPaymentStatus

type SenderWhatsappPaymentStatus struct {
	// Whether template messages can be sent. Requires setupStatus=COMPLETE and
	// methodStatus=VALID.
	CanSendTemplates bool `json:"canSendTemplates"`
	// Payment method status (VALID, NONE, etc.).
	MethodStatus string `json:"methodStatus"`
	// Payment setup status (COMPLETE, NOT_STARTED, etc.).
	SetupStatus string `json:"setupStatus"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CanSendTemplates respjson.Field
		MethodStatus     respjson.Field
		SetupStatus      respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Payment configuration status from Meta.

func (SenderWhatsappPaymentStatus) RawJSON

func (r SenderWhatsappPaymentStatus) RawJSON() string

Returns the unmodified JSON received from the API

func (*SenderWhatsappPaymentStatus) UnmarshalJSON

func (r *SenderWhatsappPaymentStatus) UnmarshalJSON(data []byte) error

type Template

type Template struct {
	ID string `json:"id" api:"required"`
	// Template body with variables: {{1}}, {{2}}, etc.
	Body string `json:"body" api:"required"`
	// WhatsApp template category.
	//
	// Any of "UTILITY", "MARKETING", "AUTHENTICATION".
	Category WhatsappCategory `json:"category" api:"required"`
	// Language code.
	Language string `json:"language" api:"required"`
	// Template name (must match WhatsApp template name).
	Name string `json:"name" api:"required"`
	// Add 'Do not share this code' disclaimer. Only for AUTHENTICATION templates.
	AddSecurityRecommendation bool `json:"addSecurityRecommendation"`
	// Template buttons.
	Buttons []TemplateButton `json:"buttons"`
	// Code expiration time in minutes. Only for AUTHENTICATION templates.
	CodeExpirationMinutes int64     `json:"codeExpirationMinutes"`
	CreatedAt             time.Time `json:"createdAt" format:"date-time"`
	// Footer text for the template.
	Footer string `json:"footer"`
	// Header content (text or media URL).
	HeaderContent string `json:"headerContent"`
	// Type of header (text, image, video, document).
	HeaderType string `json:"headerType"`
	// Any of "draft", "pending", "approved", "rejected".
	Status    TemplateStatus `json:"status"`
	UpdatedAt time.Time      `json:"updatedAt" format:"date-time"`
	// List of variable names for documentation.
	Variables []string `json:"variables"`
	// WhatsApp-specific template information.
	Whatsapp TemplateWhatsapp `json:"whatsapp"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID                        respjson.Field
		Body                      respjson.Field
		Category                  respjson.Field
		Language                  respjson.Field
		Name                      respjson.Field
		AddSecurityRecommendation respjson.Field
		Buttons                   respjson.Field
		CodeExpirationMinutes     respjson.Field
		CreatedAt                 respjson.Field
		Footer                    respjson.Field
		HeaderContent             respjson.Field
		HeaderType                respjson.Field
		Status                    respjson.Field
		UpdatedAt                 respjson.Field
		Variables                 respjson.Field
		Whatsapp                  respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Template) RawJSON

func (r Template) RawJSON() string

Returns the unmodified JSON received from the API

func (*Template) UnmarshalJSON

func (r *Template) UnmarshalJSON(data []byte) error

type TemplateButton

type TemplateButton struct {
	// OTP button type. Required when type is 'otp'.
	//
	// Any of "COPY_CODE", "ONE_TAP".
	OtpType string `json:"otpType"`
	// Android package name. Required for ONE_TAP buttons.
	PackageName string `json:"packageName"`
	PhoneNumber string `json:"phoneNumber"`
	// Android app signature hash. Required for ONE_TAP buttons.
	SignatureHash string `json:"signatureHash"`
	Text          string `json:"text"`
	// Any of "quick_reply", "url", "phone", "otp".
	Type string `json:"type"`
	URL  string `json:"url"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		OtpType       respjson.Field
		PackageName   respjson.Field
		PhoneNumber   respjson.Field
		SignatureHash respjson.Field
		Text          respjson.Field
		Type          respjson.Field
		URL           respjson.Field
		ExtraFields   map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (TemplateButton) RawJSON

func (r TemplateButton) RawJSON() string

Returns the unmodified JSON received from the API

func (*TemplateButton) UnmarshalJSON

func (r *TemplateButton) UnmarshalJSON(data []byte) error

type TemplateListParams

type TemplateListParams struct {
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	Limit  param.Opt[int64]  `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TemplateListParams) URLQuery

func (r TemplateListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TemplateListParams's query parameters as `url.Values`.

type TemplateNewParams

type TemplateNewParams struct {
	Body     string `json:"body" api:"required"`
	Language string `json:"language" api:"required"`
	Name     string `json:"name" api:"required"`
	// Add 'Do not share this code' disclaimer. Only for AUTHENTICATION templates.
	AddSecurityRecommendation param.Opt[bool] `json:"addSecurityRecommendation,omitzero"`
	// Code expiration time in minutes. Only for AUTHENTICATION templates.
	CodeExpirationMinutes param.Opt[int64] `json:"codeExpirationMinutes,omitzero"`
	// Template buttons (max 3).
	Buttons   []TemplateNewParamsButton `json:"buttons,omitzero"`
	Variables []string                  `json:"variables,omitzero"`
	// WhatsApp template category.
	//
	// Any of "UTILITY", "MARKETING", "AUTHENTICATION".
	WhatsappCategory WhatsappCategory `json:"whatsappCategory,omitzero"`
	// contains filtered or unexported fields
}

func (TemplateNewParams) MarshalJSON

func (r TemplateNewParams) MarshalJSON() (data []byte, err error)

func (*TemplateNewParams) UnmarshalJSON

func (r *TemplateNewParams) UnmarshalJSON(data []byte) error

type TemplateNewParamsButton

type TemplateNewParamsButton struct {
	Text string `json:"text" api:"required"`
	// Any of "quick_reply", "url", "phone", "otp".
	Type string `json:"type,omitzero" api:"required"`
	// Android package name. Required for ONE_TAP buttons.
	PackageName param.Opt[string] `json:"packageName,omitzero"`
	PhoneNumber param.Opt[string] `json:"phoneNumber,omitzero"`
	// Android app signature hash. Required for ONE_TAP buttons.
	SignatureHash param.Opt[string] `json:"signatureHash,omitzero"`
	URL           param.Opt[string] `json:"url,omitzero" format:"uri"`
	// Required when type is 'otp'. COPY_CODE shows copy button, ONE_TAP enables
	// Android autofill.
	//
	// Any of "COPY_CODE", "ONE_TAP".
	OtpType string `json:"otpType,omitzero"`
	// contains filtered or unexported fields
}

The properties Text, Type are required.

func (TemplateNewParamsButton) MarshalJSON

func (r TemplateNewParamsButton) MarshalJSON() (data []byte, err error)

func (*TemplateNewParamsButton) UnmarshalJSON

func (r *TemplateNewParamsButton) UnmarshalJSON(data []byte) error

type TemplateService

type TemplateService struct {
	Options []option.RequestOption
}

TemplateService contains methods and other services that help with interacting with the zavudev API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTemplateService method instead.

func NewTemplateService

func NewTemplateService(opts ...option.RequestOption) (r TemplateService)

NewTemplateService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TemplateService) Delete

func (r *TemplateService) Delete(ctx context.Context, templateID string, opts ...option.RequestOption) (err error)

Delete template

func (*TemplateService) Get

func (r *TemplateService) Get(ctx context.Context, templateID string, opts ...option.RequestOption) (res *Template, err error)

Get template

func (*TemplateService) List

List WhatsApp message templates for this project.

func (*TemplateService) ListAutoPaging

List WhatsApp message templates for this project.

func (*TemplateService) New

func (r *TemplateService) New(ctx context.Context, body TemplateNewParams, opts ...option.RequestOption) (res *Template, err error)

Create a WhatsApp message template. Note: Templates must be approved by Meta before use.

func (*TemplateService) Submit

func (r *TemplateService) Submit(ctx context.Context, templateID string, body TemplateSubmitParams, opts ...option.RequestOption) (res *Template, err error)

Submit a WhatsApp template to Meta for approval. The template must be in draft status and associated with a sender that has a WhatsApp Business Account configured.

type TemplateStatus

type TemplateStatus string
const (
	TemplateStatusDraft    TemplateStatus = "draft"
	TemplateStatusPending  TemplateStatus = "pending"
	TemplateStatusApproved TemplateStatus = "approved"
	TemplateStatusRejected TemplateStatus = "rejected"
)

type TemplateSubmitParams

type TemplateSubmitParams struct {
	// The sender ID with the WhatsApp Business Account to submit the template to.
	SenderID string `json:"senderId" api:"required"`
	// Template category. If not provided, uses the category set on the template.
	//
	// Any of "UTILITY", "MARKETING", "AUTHENTICATION".
	Category WhatsappCategory `json:"category,omitzero"`
	// contains filtered or unexported fields
}

func (TemplateSubmitParams) MarshalJSON

func (r TemplateSubmitParams) MarshalJSON() (data []byte, err error)

func (*TemplateSubmitParams) UnmarshalJSON

func (r *TemplateSubmitParams) UnmarshalJSON(data []byte) error

type TemplateWhatsapp

type TemplateWhatsapp struct {
	// WhatsApp Business Account namespace.
	Namespace string `json:"namespace"`
	// WhatsApp approval status.
	Status string `json:"status"`
	// WhatsApp template name.
	TemplateName string `json:"templateName"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Namespace    respjson.Field
		Status       respjson.Field
		TemplateName respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

WhatsApp-specific template information.

func (TemplateWhatsapp) RawJSON

func (r TemplateWhatsapp) RawJSON() string

Returns the unmodified JSON received from the API

func (*TemplateWhatsapp) UnmarshalJSON

func (r *TemplateWhatsapp) UnmarshalJSON(data []byte) error

type WebhookEvent

type WebhookEvent string

Type of event that triggers the webhook.

**Message lifecycle events:**

  • `message.queued`: Message created and queued for sending. `data.status` = `queued`
  • `message.sent`: Message accepted by the provider. `data.status` = `sent`
  • `message.delivered`: Message delivered to recipient. `data.status` = `delivered`
  • `message.failed`: Message failed to send. `data.status` = `failed`

**Inbound events:**

  • `message.inbound`: New message received from a contact. Reactions are delivered as `message.inbound` with `messageType='reaction'`
  • `message.unsupported`: Received a message type that is not supported

**Other events:**

- `conversation.new`: New conversation started with a contact - `template.status_changed`: WhatsApp template approval status changed

const (
	WebhookEventMessageQueued         WebhookEvent = "message.queued"
	WebhookEventMessageSent           WebhookEvent = "message.sent"
	WebhookEventMessageDelivered      WebhookEvent = "message.delivered"
	WebhookEventMessageFailed         WebhookEvent = "message.failed"
	WebhookEventMessageInbound        WebhookEvent = "message.inbound"
	WebhookEventMessageUnsupported    WebhookEvent = "message.unsupported"
	WebhookEventConversationNew       WebhookEvent = "conversation.new"
	WebhookEventTemplateStatusChanged WebhookEvent = "template.status_changed"
)

type WebhookSecretResponse

type WebhookSecretResponse struct {
	// The new webhook secret.
	Secret string `json:"secret" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Secret      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WebhookSecretResponse) RawJSON

func (r WebhookSecretResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*WebhookSecretResponse) UnmarshalJSON

func (r *WebhookSecretResponse) UnmarshalJSON(data []byte) error

type WhatsappBusinessProfile

type WhatsappBusinessProfile struct {
	// Short description of the business (max 139 characters).
	About string `json:"about"`
	// Physical address of the business (max 256 characters).
	Address string `json:"address"`
	// Extended description of the business (max 512 characters).
	Description string `json:"description"`
	// Business email address.
	Email string `json:"email" format:"email"`
	// URL of the business profile picture.
	ProfilePictureURL string `json:"profilePictureUrl" format:"uri"`
	// Business category for WhatsApp Business profile.
	//
	// Any of "UNDEFINED", "OTHER", "AUTO", "BEAUTY", "APPAREL", "EDU", "ENTERTAIN",
	// "EVENT_PLAN", "FINANCE", "GROCERY", "GOVT", "HOTEL", "HEALTH", "NONPROFIT",
	// "PROF_SERVICES", "RETAIL", "TRAVEL", "RESTAURANT", "NOT_A_BIZ".
	Vertical WhatsappBusinessProfileVertical `json:"vertical"`
	// Business website URLs (maximum 2).
	Websites []string `json:"websites" format:"uri"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		About             respjson.Field
		Address           respjson.Field
		Description       respjson.Field
		Email             respjson.Field
		ProfilePictureURL respjson.Field
		Vertical          respjson.Field
		Websites          respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

WhatsApp Business profile information.

func (WhatsappBusinessProfile) RawJSON

func (r WhatsappBusinessProfile) RawJSON() string

Returns the unmodified JSON received from the API

func (*WhatsappBusinessProfile) UnmarshalJSON

func (r *WhatsappBusinessProfile) UnmarshalJSON(data []byte) error

type WhatsappBusinessProfileResponse

type WhatsappBusinessProfileResponse struct {
	// WhatsApp Business profile information.
	Profile WhatsappBusinessProfile `json:"profile" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Profile     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (WhatsappBusinessProfileResponse) RawJSON

Returns the unmodified JSON received from the API

func (*WhatsappBusinessProfileResponse) UnmarshalJSON

func (r *WhatsappBusinessProfileResponse) UnmarshalJSON(data []byte) error

type WhatsappBusinessProfileVertical

type WhatsappBusinessProfileVertical string

Business category for WhatsApp Business profile.

const (
	WhatsappBusinessProfileVerticalUndefined    WhatsappBusinessProfileVertical = "UNDEFINED"
	WhatsappBusinessProfileVerticalOther        WhatsappBusinessProfileVertical = "OTHER"
	WhatsappBusinessProfileVerticalAuto         WhatsappBusinessProfileVertical = "AUTO"
	WhatsappBusinessProfileVerticalBeauty       WhatsappBusinessProfileVertical = "BEAUTY"
	WhatsappBusinessProfileVerticalApparel      WhatsappBusinessProfileVertical = "APPAREL"
	WhatsappBusinessProfileVerticalEdu          WhatsappBusinessProfileVertical = "EDU"
	WhatsappBusinessProfileVerticalEntertain    WhatsappBusinessProfileVertical = "ENTERTAIN"
	WhatsappBusinessProfileVerticalEventPlan    WhatsappBusinessProfileVertical = "EVENT_PLAN"
	WhatsappBusinessProfileVerticalFinance      WhatsappBusinessProfileVertical = "FINANCE"
	WhatsappBusinessProfileVerticalGrocery      WhatsappBusinessProfileVertical = "GROCERY"
	WhatsappBusinessProfileVerticalGovt         WhatsappBusinessProfileVertical = "GOVT"
	WhatsappBusinessProfileVerticalHotel        WhatsappBusinessProfileVertical = "HOTEL"
	WhatsappBusinessProfileVerticalHealth       WhatsappBusinessProfileVertical = "HEALTH"
	WhatsappBusinessProfileVerticalNonprofit    WhatsappBusinessProfileVertical = "NONPROFIT"
	WhatsappBusinessProfileVerticalProfServices WhatsappBusinessProfileVertical = "PROF_SERVICES"
	WhatsappBusinessProfileVerticalRetail       WhatsappBusinessProfileVertical = "RETAIL"
	WhatsappBusinessProfileVerticalTravel       WhatsappBusinessProfileVertical = "TRAVEL"
	WhatsappBusinessProfileVerticalRestaurant   WhatsappBusinessProfileVertical = "RESTAURANT"
	WhatsappBusinessProfileVerticalNotABiz      WhatsappBusinessProfileVertical = "NOT_A_BIZ"
)

type WhatsappCategory

type WhatsappCategory string

WhatsApp template category.

const (
	WhatsappCategoryUtility        WhatsappCategory = "UTILITY"
	WhatsappCategoryMarketing      WhatsappCategory = "MARKETING"
	WhatsappCategoryAuthentication WhatsappCategory = "AUTHENTICATION"
)

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL