prelude

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

Prelude Go API Library

Go Reference

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

It is generated with Stainless.

Installation

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

Or to pin the version:

go get -u 'github.com/prelude-so/go-sdk@v0.10.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/prelude-so/go-sdk"
	"github.com/prelude-so/go-sdk/option"
)

func main() {
	client := prelude.NewClient(
		option.WithAPIToken("My API Token"), // defaults to os.LookupEnv("API_TOKEN")
	)
	verification, err := client.Verification.New(context.TODO(), prelude.VerificationNewParams{
		Target: prelude.F(prelude.VerificationNewParamsTarget{
			Type:  prelude.F(prelude.VerificationNewParamsTargetTypePhoneNumber),
			Value: prelude.F("+30123456789"),
		}),
	})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", verification.ID)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: prelude.F("hello"),

	// Explicitly send `"description": null`
	Description: prelude.Null[string](),

	Point: prelude.F(prelude.Point{
		X: prelude.Int(0),
		Y: prelude.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: prelude.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras 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()
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 := prelude.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Verification.New(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"}),
)

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:

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.:

Errors

When the API returns a non-success status code, we return an error with type *prelude.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.Verification.New(context.TODO(), prelude.VerificationNewParams{
	Target: prelude.F(prelude.VerificationNewParamsTarget{
		Type:  prelude.F(prelude.VerificationNewParamsTargetTypePhoneNumber),
		Value: prelude.F("+30123456789"),
	}),
})
if err != nil {
	var apierr *prelude.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 "/v2/verification": 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.Verification.New(
	ctx,
	prelude.VerificationNewParams{
		Target: prelude.F(prelude.VerificationNewParamsTarget{
			Type:  prelude.F(prelude.VerificationNewParamsTargetTypePhoneNumber),
			Value: prelude.F("+30123456789"),
		}),
	},
	// 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 param.Field[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 prelude.FileParam(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 := prelude.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Verification.New(
	context.TODO(),
	prelude.VerificationNewParams{
		Target: prelude.F(prelude.VerificationNewParamsTarget{
			Type:  prelude.F(prelude.VerificationNewParamsTargetTypePhoneNumber),
			Value: prelude.F("+30123456789"),
		}),
	},
	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
verification, err := client.Verification.New(
	context.TODO(),
	prelude.VerificationNewParams{
		Target: prelude.F(prelude.VerificationNewParamsTarget{
			Type:  prelude.F(prelude.VerificationNewParamsTargetTypePhoneNumber),
			Value: prelude.F("+30123456789"),
		}),
	},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", verification)

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]interface{}

    // 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:   prelude.F("id_xxxx"),
    Data: prelude.F(FooNewParamsData{
        FirstName: prelude.F("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 := prelude.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(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions added in v0.3.0

func DefaultClientOptions() []option.RequestOption

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

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type Client

type Client struct {
	Options                []option.RequestOption
	Lookup                 *LookupService
	Notify                 *NotifyService
	Transactional          *TransactionalService
	Verification           *VerificationService
	VerificationManagement *VerificationManagementService
	Watch                  *WatchService
}

Client creates a struct with services and top level methods that help with interacting with the Prelude 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 (API_TOKEN, PRELUDE_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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 Error

type Error = apierror.Error

type LookupLookupParams added in v0.3.0

type LookupLookupParams struct {
	// Optional features. Possible values are:
	//
	//   - `cnam` - Retrieve CNAM (Caller ID Name) along with other information. Contact
	//     us if you need to use this functionality.
	Type param.Field[[]LookupLookupParamsType] `query:"type"`
}

func (LookupLookupParams) URLQuery added in v0.3.0

func (r LookupLookupParams) URLQuery() (v url.Values)

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

type LookupLookupParamsType added in v0.3.0

type LookupLookupParamsType string
const (
	LookupLookupParamsTypeCnam LookupLookupParamsType = "cnam"
)

func (LookupLookupParamsType) IsKnown added in v0.3.0

func (r LookupLookupParamsType) IsKnown() bool

type LookupLookupResponse added in v0.3.0

type LookupLookupResponse struct {
	// The CNAM (Caller ID Name) associated with the phone number. Contact us if you
	// need to use this functionality. Once enabled, put `cnam` option to `type` query
	// parameter.
	CallerName string `json:"caller_name"`
	// The country code of the phone number.
	CountryCode string `json:"country_code"`
	// A list of flags associated with the phone number.
	//
	//   - `ported` - Indicates the phone number has been transferred from one carrier to
	//     another.
	//   - `temporary` - Indicates the phone number is likely a temporary or virtual
	//     number, often used for verification services or burner phones.
	Flags []LookupLookupResponseFlag `json:"flags"`
	// The type of phone line.
	//
	//   - `calling_cards` - Numbers that are associated with providers of pre-paid
	//     domestic and international calling cards.
	//   - `fixed_line` - Landline phone numbers.
	//   - `isp` - Numbers reserved for Internet Service Providers.
	//   - `local_rate` - Numbers that can be assigned non-geographically.
	//   - `mobile` - Mobile phone numbers.
	//   - `other` - Other types of services.
	//   - `pager` - Number ranges specifically allocated to paging devices.
	//   - `payphone` - Allocated numbers for payphone kiosks in some countries.
	//   - `premium_rate` - Landline numbers where the calling party pays more than
	//     standard.
	//   - `satellite` - Satellite phone numbers.
	//   - `service` - Automated applications.
	//   - `shared_cost` - Specific landline ranges where the cost of making the call is
	//     shared between the calling and called party.
	//   - `short_codes_commercial` - Short codes are memorable, easy-to-use numbers,
	//     like the UK's NHS 111, often sold to businesses. Not available in all
	//     countries.
	//   - `toll_free` - Number where the called party pays for the cost of the call not
	//     the calling party.
	//   - `universal_access` - Number ranges reserved for Universal Access initiatives.
	//   - `unknown` - Unknown phone number type.
	//   - `vpn` - Numbers are used exclusively within a private telecommunications
	//     network, connecting the operator's terminals internally and not accessible via
	//     the public telephone network.
	//   - `voice_mail` - A specific category of Interactive Voice Response (IVR)
	//     services.
	//   - `voip` - Specific ranges for providers of VoIP services to allow incoming
	//     calls from the regular telephony network.
	LineType LookupLookupResponseLineType `json:"line_type"`
	// The current carrier information.
	NetworkInfo LookupLookupResponseNetworkInfo `json:"network_info"`
	// The original carrier information.
	OriginalNetworkInfo LookupLookupResponseOriginalNetworkInfo `json:"original_network_info"`
	// The phone number.
	PhoneNumber string                   `json:"phone_number"`
	JSON        lookupLookupResponseJSON `json:"-"`
}

func (*LookupLookupResponse) UnmarshalJSON added in v0.3.0

func (r *LookupLookupResponse) UnmarshalJSON(data []byte) (err error)

type LookupLookupResponseFlag added in v0.3.0

type LookupLookupResponseFlag string
const (
	LookupLookupResponseFlagPorted    LookupLookupResponseFlag = "ported"
	LookupLookupResponseFlagTemporary LookupLookupResponseFlag = "temporary"
)

func (LookupLookupResponseFlag) IsKnown added in v0.3.0

func (r LookupLookupResponseFlag) IsKnown() bool

type LookupLookupResponseLineType added in v0.3.0

type LookupLookupResponseLineType string

The type of phone line.

  • `calling_cards` - Numbers that are associated with providers of pre-paid domestic and international calling cards.
  • `fixed_line` - Landline phone numbers.
  • `isp` - Numbers reserved for Internet Service Providers.
  • `local_rate` - Numbers that can be assigned non-geographically.
  • `mobile` - Mobile phone numbers.
  • `other` - Other types of services.
  • `pager` - Number ranges specifically allocated to paging devices.
  • `payphone` - Allocated numbers for payphone kiosks in some countries.
  • `premium_rate` - Landline numbers where the calling party pays more than standard.
  • `satellite` - Satellite phone numbers.
  • `service` - Automated applications.
  • `shared_cost` - Specific landline ranges where the cost of making the call is shared between the calling and called party.
  • `short_codes_commercial` - Short codes are memorable, easy-to-use numbers, like the UK's NHS 111, often sold to businesses. Not available in all countries.
  • `toll_free` - Number where the called party pays for the cost of the call not the calling party.
  • `universal_access` - Number ranges reserved for Universal Access initiatives.
  • `unknown` - Unknown phone number type.
  • `vpn` - Numbers are used exclusively within a private telecommunications network, connecting the operator's terminals internally and not accessible via the public telephone network.
  • `voice_mail` - A specific category of Interactive Voice Response (IVR) services.
  • `voip` - Specific ranges for providers of VoIP services to allow incoming calls from the regular telephony network.
const (
	LookupLookupResponseLineTypeCallingCards         LookupLookupResponseLineType = "calling_cards"
	LookupLookupResponseLineTypeFixedLine            LookupLookupResponseLineType = "fixed_line"
	LookupLookupResponseLineTypeIsp                  LookupLookupResponseLineType = "isp"
	LookupLookupResponseLineTypeLocalRate            LookupLookupResponseLineType = "local_rate"
	LookupLookupResponseLineTypeMobile               LookupLookupResponseLineType = "mobile"
	LookupLookupResponseLineTypeOther                LookupLookupResponseLineType = "other"
	LookupLookupResponseLineTypePager                LookupLookupResponseLineType = "pager"
	LookupLookupResponseLineTypePayphone             LookupLookupResponseLineType = "payphone"
	LookupLookupResponseLineTypePremiumRate          LookupLookupResponseLineType = "premium_rate"
	LookupLookupResponseLineTypeSatellite            LookupLookupResponseLineType = "satellite"
	LookupLookupResponseLineTypeService              LookupLookupResponseLineType = "service"
	LookupLookupResponseLineTypeSharedCost           LookupLookupResponseLineType = "shared_cost"
	LookupLookupResponseLineTypeShortCodesCommercial LookupLookupResponseLineType = "short_codes_commercial"
	LookupLookupResponseLineTypeTollFree             LookupLookupResponseLineType = "toll_free"
	LookupLookupResponseLineTypeUniversalAccess      LookupLookupResponseLineType = "universal_access"
	LookupLookupResponseLineTypeUnknown              LookupLookupResponseLineType = "unknown"
	LookupLookupResponseLineTypeVpn                  LookupLookupResponseLineType = "vpn"
	LookupLookupResponseLineTypeVoiceMail            LookupLookupResponseLineType = "voice_mail"
	LookupLookupResponseLineTypeVoip                 LookupLookupResponseLineType = "voip"
)

func (LookupLookupResponseLineType) IsKnown added in v0.3.0

func (r LookupLookupResponseLineType) IsKnown() bool

type LookupLookupResponseNetworkInfo added in v0.3.0

type LookupLookupResponseNetworkInfo struct {
	// The name of the carrier.
	CarrierName string `json:"carrier_name"`
	// Mobile Country Code.
	Mcc string `json:"mcc"`
	// Mobile Network Code.
	Mnc  string                              `json:"mnc"`
	JSON lookupLookupResponseNetworkInfoJSON `json:"-"`
}

The current carrier information.

func (*LookupLookupResponseNetworkInfo) UnmarshalJSON added in v0.3.0

func (r *LookupLookupResponseNetworkInfo) UnmarshalJSON(data []byte) (err error)

type LookupLookupResponseOriginalNetworkInfo added in v0.3.0

type LookupLookupResponseOriginalNetworkInfo struct {
	// The name of the original carrier.
	CarrierName string `json:"carrier_name"`
	// Mobile Country Code.
	Mcc string `json:"mcc"`
	// Mobile Network Code.
	Mnc  string                                      `json:"mnc"`
	JSON lookupLookupResponseOriginalNetworkInfoJSON `json:"-"`
}

The original carrier information.

func (*LookupLookupResponseOriginalNetworkInfo) UnmarshalJSON added in v0.3.0

func (r *LookupLookupResponseOriginalNetworkInfo) UnmarshalJSON(data []byte) (err error)

type LookupService added in v0.3.0

type LookupService struct {
	Options []option.RequestOption
}

LookupService contains methods and other services that help with interacting with the Prelude 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 NewLookupService method instead.

func NewLookupService added in v0.3.0

func NewLookupService(opts ...option.RequestOption) (r *LookupService)

NewLookupService 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 (*LookupService) Lookup added in v0.3.0

func (r *LookupService) Lookup(ctx context.Context, phoneNumber string, query LookupLookupParams, opts ...option.RequestOption) (res *LookupLookupResponse, err error)

Retrieve detailed information about a phone number including carrier data, line type, and portability status.

type NotifyGetSubscriptionConfigResponse added in v0.10.0

type NotifyGetSubscriptionConfigResponse struct {
	// The subscription configuration ID.
	ID string `json:"id,required"`
	// The URL to call when subscription status changes.
	CallbackURL string `json:"callback_url,required" format:"uri"`
	// The date and time when the configuration was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The subscription messages configuration.
	Messages NotifyGetSubscriptionConfigResponseMessages `json:"messages,required"`
	// The human-readable name for the subscription configuration.
	Name string `json:"name,required"`
	// The date and time when the configuration was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// A list of phone numbers for receiving inbound messages.
	MoPhoneNumbers []NotifyGetSubscriptionConfigResponseMoPhoneNumber `json:"mo_phone_numbers"`
	JSON           notifyGetSubscriptionConfigResponseJSON            `json:"-"`
}

func (*NotifyGetSubscriptionConfigResponse) UnmarshalJSON added in v0.10.0

func (r *NotifyGetSubscriptionConfigResponse) UnmarshalJSON(data []byte) (err error)

type NotifyGetSubscriptionConfigResponseMessages added in v0.10.0

type NotifyGetSubscriptionConfigResponseMessages struct {
	// Message sent when user requests help.
	HelpMessage string `json:"help_message"`
	// Message sent when user subscribes.
	StartMessage string `json:"start_message"`
	// Message sent when user unsubscribes.
	StopMessage string                                          `json:"stop_message"`
	JSON        notifyGetSubscriptionConfigResponseMessagesJSON `json:"-"`
}

The subscription messages configuration.

func (*NotifyGetSubscriptionConfigResponseMessages) UnmarshalJSON added in v0.10.0

func (r *NotifyGetSubscriptionConfigResponseMessages) UnmarshalJSON(data []byte) (err error)

type NotifyGetSubscriptionConfigResponseMoPhoneNumber added in v0.10.0

type NotifyGetSubscriptionConfigResponseMoPhoneNumber struct {
	// The ISO 3166-1 alpha-2 country code.
	CountryCode string `json:"country_code,required"`
	// The phone number in E.164 format for long codes, or short code format for short
	// codes.
	PhoneNumber string                                               `json:"phone_number,required"`
	JSON        notifyGetSubscriptionConfigResponseMoPhoneNumberJSON `json:"-"`
}

func (*NotifyGetSubscriptionConfigResponseMoPhoneNumber) UnmarshalJSON added in v0.10.0

func (r *NotifyGetSubscriptionConfigResponseMoPhoneNumber) UnmarshalJSON(data []byte) (err error)

type NotifyGetSubscriptionPhoneNumberResponse added in v0.10.0

type NotifyGetSubscriptionPhoneNumberResponse struct {
	// The subscription configuration ID.
	ConfigID string `json:"config_id,required"`
	// The phone number in E.164 format.
	PhoneNumber string `json:"phone_number,required" format:"phone_number"`
	// How the subscription state was changed:
	//
	// - `MO_KEYWORD` - User sent a keyword (STOP/START)
	// - `API` - Changed via API
	// - `CSV_IMPORT` - Imported from CSV
	// - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect
	Source NotifyGetSubscriptionPhoneNumberResponseSource `json:"source,required"`
	// The subscription state:
	//
	// - `SUB` - Subscribed (user can receive marketing messages)
	// - `UNSUB` - Unsubscribed (user has opted out)
	State NotifyGetSubscriptionPhoneNumberResponseState `json:"state,required"`
	// The date and time when the subscription status was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Additional context about the state change (e.g., the keyword that was sent).
	Reason string                                       `json:"reason"`
	JSON   notifyGetSubscriptionPhoneNumberResponseJSON `json:"-"`
}

func (*NotifyGetSubscriptionPhoneNumberResponse) UnmarshalJSON added in v0.10.0

func (r *NotifyGetSubscriptionPhoneNumberResponse) UnmarshalJSON(data []byte) (err error)

type NotifyGetSubscriptionPhoneNumberResponseSource added in v0.10.0

type NotifyGetSubscriptionPhoneNumberResponseSource string

How the subscription state was changed:

- `MO_KEYWORD` - User sent a keyword (STOP/START) - `API` - Changed via API - `CSV_IMPORT` - Imported from CSV - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect

const (
	NotifyGetSubscriptionPhoneNumberResponseSourceMoKeyword         NotifyGetSubscriptionPhoneNumberResponseSource = "MO_KEYWORD"
	NotifyGetSubscriptionPhoneNumberResponseSourceAPI               NotifyGetSubscriptionPhoneNumberResponseSource = "API"
	NotifyGetSubscriptionPhoneNumberResponseSourceCsvImport         NotifyGetSubscriptionPhoneNumberResponseSource = "CSV_IMPORT"
	NotifyGetSubscriptionPhoneNumberResponseSourceCarrierDisconnect NotifyGetSubscriptionPhoneNumberResponseSource = "CARRIER_DISCONNECT"
)

func (NotifyGetSubscriptionPhoneNumberResponseSource) IsKnown added in v0.10.0

type NotifyGetSubscriptionPhoneNumberResponseState added in v0.10.0

type NotifyGetSubscriptionPhoneNumberResponseState string

The subscription state:

- `SUB` - Subscribed (user can receive marketing messages) - `UNSUB` - Unsubscribed (user has opted out)

const (
	NotifyGetSubscriptionPhoneNumberResponseStateSub   NotifyGetSubscriptionPhoneNumberResponseState = "SUB"
	NotifyGetSubscriptionPhoneNumberResponseStateUnsub NotifyGetSubscriptionPhoneNumberResponseState = "UNSUB"
)

func (NotifyGetSubscriptionPhoneNumberResponseState) IsKnown added in v0.10.0

type NotifyListSubscriptionConfigsParams added in v0.10.0

type NotifyListSubscriptionConfigsParams struct {
	// Pagination cursor from the previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of configurations to return per page
	Limit param.Field[int64] `query:"limit"`
}

func (NotifyListSubscriptionConfigsParams) URLQuery added in v0.10.0

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

type NotifyListSubscriptionConfigsResponse added in v0.10.0

type NotifyListSubscriptionConfigsResponse struct {
	// A list of subscription management configurations.
	Configs []NotifyListSubscriptionConfigsResponseConfig `json:"configs,required"`
	// Pagination cursor for the next page of results. Omitted if there are no more
	// pages.
	NextCursor string                                    `json:"next_cursor"`
	JSON       notifyListSubscriptionConfigsResponseJSON `json:"-"`
}

func (*NotifyListSubscriptionConfigsResponse) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionConfigsResponse) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionConfigsResponseConfig added in v0.10.0

type NotifyListSubscriptionConfigsResponseConfig struct {
	// The subscription configuration ID.
	ID string `json:"id,required"`
	// The URL to call when subscription status changes.
	CallbackURL string `json:"callback_url,required" format:"uri"`
	// The date and time when the configuration was created.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The subscription messages configuration.
	Messages NotifyListSubscriptionConfigsResponseConfigsMessages `json:"messages,required"`
	// The human-readable name for the subscription configuration.
	Name string `json:"name,required"`
	// The date and time when the configuration was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// A list of phone numbers for receiving inbound messages.
	MoPhoneNumbers []NotifyListSubscriptionConfigsResponseConfigsMoPhoneNumber `json:"mo_phone_numbers"`
	JSON           notifyListSubscriptionConfigsResponseConfigJSON             `json:"-"`
}

func (*NotifyListSubscriptionConfigsResponseConfig) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionConfigsResponseConfig) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionConfigsResponseConfigsMessages added in v0.10.0

type NotifyListSubscriptionConfigsResponseConfigsMessages struct {
	// Message sent when user requests help.
	HelpMessage string `json:"help_message"`
	// Message sent when user subscribes.
	StartMessage string `json:"start_message"`
	// Message sent when user unsubscribes.
	StopMessage string                                                   `json:"stop_message"`
	JSON        notifyListSubscriptionConfigsResponseConfigsMessagesJSON `json:"-"`
}

The subscription messages configuration.

func (*NotifyListSubscriptionConfigsResponseConfigsMessages) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionConfigsResponseConfigsMessages) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionConfigsResponseConfigsMoPhoneNumber added in v0.10.0

type NotifyListSubscriptionConfigsResponseConfigsMoPhoneNumber struct {
	// The ISO 3166-1 alpha-2 country code.
	CountryCode string `json:"country_code,required"`
	// The phone number in E.164 format for long codes, or short code format for short
	// codes.
	PhoneNumber string                                                        `json:"phone_number,required"`
	JSON        notifyListSubscriptionConfigsResponseConfigsMoPhoneNumberJSON `json:"-"`
}

func (*NotifyListSubscriptionConfigsResponseConfigsMoPhoneNumber) UnmarshalJSON added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsParams added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsParams struct {
	// Pagination cursor from the previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of events to return per page
	Limit param.Field[int64] `query:"limit"`
}

func (NotifyListSubscriptionPhoneNumberEventsParams) URLQuery added in v0.10.0

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

type NotifyListSubscriptionPhoneNumberEventsResponse added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsResponse struct {
	// A list of subscription events (status changes) ordered by timestamp descending.
	Events []NotifyListSubscriptionPhoneNumberEventsResponseEvent `json:"events,required"`
	// Pagination cursor for the next page of results. Omitted if there are no more
	// pages.
	NextCursor string                                              `json:"next_cursor"`
	JSON       notifyListSubscriptionPhoneNumberEventsResponseJSON `json:"-"`
}

func (*NotifyListSubscriptionPhoneNumberEventsResponse) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionPhoneNumberEventsResponse) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionPhoneNumberEventsResponseEvent added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsResponseEvent struct {
	// The subscription configuration ID.
	ConfigID string `json:"config_id,required"`
	// The phone number in E.164 format.
	PhoneNumber string `json:"phone_number,required" format:"phone_number"`
	// How the subscription state was changed:
	//
	// - `MO_KEYWORD` - User sent a keyword (STOP/START)
	// - `API` - Changed via API
	// - `CSV_IMPORT` - Imported from CSV
	// - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect
	Source NotifyListSubscriptionPhoneNumberEventsResponseEventsSource `json:"source,required"`
	// The subscription state after this event:
	//
	// - `SUB` - Subscribed (user can receive marketing messages)
	// - `UNSUB` - Unsubscribed (user has opted out)
	State NotifyListSubscriptionPhoneNumberEventsResponseEventsState `json:"state,required"`
	// The date and time when the event occurred.
	Timestamp time.Time `json:"timestamp,required" format:"date-time"`
	// Additional context about the state change (e.g., the keyword that was sent).
	Reason string                                                   `json:"reason"`
	JSON   notifyListSubscriptionPhoneNumberEventsResponseEventJSON `json:"-"`
}

func (*NotifyListSubscriptionPhoneNumberEventsResponseEvent) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionPhoneNumberEventsResponseEvent) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionPhoneNumberEventsResponseEventsSource added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsResponseEventsSource string

How the subscription state was changed:

- `MO_KEYWORD` - User sent a keyword (STOP/START) - `API` - Changed via API - `CSV_IMPORT` - Imported from CSV - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect

const (
	NotifyListSubscriptionPhoneNumberEventsResponseEventsSourceMoKeyword         NotifyListSubscriptionPhoneNumberEventsResponseEventsSource = "MO_KEYWORD"
	NotifyListSubscriptionPhoneNumberEventsResponseEventsSourceAPI               NotifyListSubscriptionPhoneNumberEventsResponseEventsSource = "API"
	NotifyListSubscriptionPhoneNumberEventsResponseEventsSourceCsvImport         NotifyListSubscriptionPhoneNumberEventsResponseEventsSource = "CSV_IMPORT"
	NotifyListSubscriptionPhoneNumberEventsResponseEventsSourceCarrierDisconnect NotifyListSubscriptionPhoneNumberEventsResponseEventsSource = "CARRIER_DISCONNECT"
)

func (NotifyListSubscriptionPhoneNumberEventsResponseEventsSource) IsKnown added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsResponseEventsState added in v0.10.0

type NotifyListSubscriptionPhoneNumberEventsResponseEventsState string

The subscription state after this event:

- `SUB` - Subscribed (user can receive marketing messages) - `UNSUB` - Unsubscribed (user has opted out)

const (
	NotifyListSubscriptionPhoneNumberEventsResponseEventsStateSub   NotifyListSubscriptionPhoneNumberEventsResponseEventsState = "SUB"
	NotifyListSubscriptionPhoneNumberEventsResponseEventsStateUnsub NotifyListSubscriptionPhoneNumberEventsResponseEventsState = "UNSUB"
)

func (NotifyListSubscriptionPhoneNumberEventsResponseEventsState) IsKnown added in v0.10.0

type NotifyListSubscriptionPhoneNumbersParams added in v0.10.0

type NotifyListSubscriptionPhoneNumbersParams struct {
	// Pagination cursor from the previous response
	Cursor param.Field[string] `query:"cursor"`
	// Maximum number of phone numbers to return per page
	Limit param.Field[int64] `query:"limit"`
	// Filter by subscription state
	State param.Field[NotifyListSubscriptionPhoneNumbersParamsState] `query:"state"`
}

func (NotifyListSubscriptionPhoneNumbersParams) URLQuery added in v0.10.0

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

type NotifyListSubscriptionPhoneNumbersParamsState added in v0.10.0

type NotifyListSubscriptionPhoneNumbersParamsState string

Filter by subscription state

const (
	NotifyListSubscriptionPhoneNumbersParamsStateSub   NotifyListSubscriptionPhoneNumbersParamsState = "SUB"
	NotifyListSubscriptionPhoneNumbersParamsStateUnsub NotifyListSubscriptionPhoneNumbersParamsState = "UNSUB"
)

func (NotifyListSubscriptionPhoneNumbersParamsState) IsKnown added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponse added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponse struct {
	// A list of phone numbers and their subscription statuses.
	PhoneNumbers []NotifyListSubscriptionPhoneNumbersResponsePhoneNumber `json:"phone_numbers,required"`
	// Pagination cursor for the next page of results. Omitted if there are no more
	// pages.
	NextCursor string                                         `json:"next_cursor"`
	JSON       notifyListSubscriptionPhoneNumbersResponseJSON `json:"-"`
}

func (*NotifyListSubscriptionPhoneNumbersResponse) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionPhoneNumbersResponse) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumber added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumber struct {
	// The subscription configuration ID.
	ConfigID string `json:"config_id,required"`
	// The phone number in E.164 format.
	PhoneNumber string `json:"phone_number,required" format:"phone_number"`
	// How the subscription state was changed:
	//
	// - `MO_KEYWORD` - User sent a keyword (STOP/START)
	// - `API` - Changed via API
	// - `CSV_IMPORT` - Imported from CSV
	// - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect
	Source NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource `json:"source,required"`
	// The subscription state:
	//
	// - `SUB` - Subscribed (user can receive marketing messages)
	// - `UNSUB` - Unsubscribed (user has opted out)
	State NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState `json:"state,required"`
	// The date and time when the subscription status was last updated.
	UpdatedAt time.Time `json:"updated_at,required" format:"date-time"`
	// Additional context about the state change (e.g., the keyword that was sent).
	Reason string                                                    `json:"reason"`
	JSON   notifyListSubscriptionPhoneNumbersResponsePhoneNumberJSON `json:"-"`
}

func (*NotifyListSubscriptionPhoneNumbersResponsePhoneNumber) UnmarshalJSON added in v0.10.0

func (r *NotifyListSubscriptionPhoneNumbersResponsePhoneNumber) UnmarshalJSON(data []byte) (err error)

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource string

How the subscription state was changed:

- `MO_KEYWORD` - User sent a keyword (STOP/START) - `API` - Changed via API - `CSV_IMPORT` - Imported from CSV - `CARRIER_DISCONNECT` - Automatically unsubscribed due to carrier disconnect

const (
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSourceMoKeyword         NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource = "MO_KEYWORD"
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSourceAPI               NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource = "API"
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSourceCsvImport         NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource = "CSV_IMPORT"
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSourceCarrierDisconnect NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource = "CARRIER_DISCONNECT"
)

func (NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersSource) IsKnown added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState added in v0.10.0

type NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState string

The subscription state:

- `SUB` - Subscribed (user can receive marketing messages) - `UNSUB` - Unsubscribed (user has opted out)

const (
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersStateSub   NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState = "SUB"
	NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersStateUnsub NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState = "UNSUB"
)

func (NotifyListSubscriptionPhoneNumbersResponsePhoneNumbersState) IsKnown added in v0.10.0

type NotifySendBatchParams added in v0.10.0

type NotifySendBatchParams struct {
	// The template identifier configured by your Customer Success team.
	TemplateID param.Field[string] `json:"template_id,required"`
	// The list of recipients' phone numbers in E.164 format.
	To param.Field[[]string] `json:"to,required" format:"phone_number"`
	// The URL where webhooks will be sent for delivery events.
	CallbackURL param.Field[string] `json:"callback_url"`
	// A user-defined identifier to correlate this request with your internal systems.
	CorrelationID param.Field[string] `json:"correlation_id"`
	// The message expiration date in RFC3339 format. Messages will not be sent after
	// this time.
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// The Sender ID. Must be approved for your account.
	From param.Field[string] `json:"from"`
	// A BCP-47 formatted locale string.
	Locale param.Field[string] `json:"locale"`
	// Preferred channel for delivery. If unavailable, automatic fallback applies.
	PreferredChannel param.Field[NotifySendBatchParamsPreferredChannel] `json:"preferred_channel"`
	// Schedule delivery in RFC3339 format. Marketing sends may be adjusted to comply
	// with local time windows.
	ScheduleAt param.Field[time.Time] `json:"schedule_at" format:"date-time"`
	// The variables to be replaced in the template.
	Variables param.Field[map[string]string] `json:"variables"`
}

func (NotifySendBatchParams) MarshalJSON added in v0.10.0

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

type NotifySendBatchParamsPreferredChannel added in v0.10.0

type NotifySendBatchParamsPreferredChannel string

Preferred channel for delivery. If unavailable, automatic fallback applies.

const (
	NotifySendBatchParamsPreferredChannelSMS      NotifySendBatchParamsPreferredChannel = "sms"
	NotifySendBatchParamsPreferredChannelWhatsapp NotifySendBatchParamsPreferredChannel = "whatsapp"
)

func (NotifySendBatchParamsPreferredChannel) IsKnown added in v0.10.0

type NotifySendBatchResponse added in v0.10.0

type NotifySendBatchResponse struct {
	// Number of failed sends.
	ErrorCount int64 `json:"error_count,required"`
	// The per-recipient result of the bulk send.
	Results []NotifySendBatchResponseResult `json:"results,required"`
	// Number of successful sends.
	SuccessCount int64 `json:"success_count,required"`
	// Total number of recipients.
	TotalCount int64 `json:"total_count,required"`
	// The callback URL used for this bulk request, if any.
	CallbackURL string `json:"callback_url"`
	// A string that identifies this specific request.
	RequestID string `json:"request_id"`
	// The template identifier used for this bulk request.
	TemplateID string `json:"template_id"`
	// The variables used for this bulk request.
	Variables map[string]string           `json:"variables"`
	JSON      notifySendBatchResponseJSON `json:"-"`
}

func (*NotifySendBatchResponse) UnmarshalJSON added in v0.10.0

func (r *NotifySendBatchResponse) UnmarshalJSON(data []byte) (err error)

type NotifySendBatchResponseResult added in v0.10.0

type NotifySendBatchResponseResult struct {
	// The recipient's phone number in E.164 format.
	PhoneNumber string `json:"phone_number,required"`
	// Whether the message was accepted for delivery.
	Success bool `json:"success,required"`
	// Present only if success is false.
	Error NotifySendBatchResponseResultsError `json:"error"`
	// Present only if success is true.
	Message NotifySendBatchResponseResultsMessage `json:"message"`
	JSON    notifySendBatchResponseResultJSON     `json:"-"`
}

func (*NotifySendBatchResponseResult) UnmarshalJSON added in v0.10.0

func (r *NotifySendBatchResponseResult) UnmarshalJSON(data []byte) (err error)

type NotifySendBatchResponseResultsError added in v0.10.0

type NotifySendBatchResponseResultsError struct {
	// The error code.
	Code string `json:"code"`
	// A human-readable error message.
	Message string                                  `json:"message"`
	JSON    notifySendBatchResponseResultsErrorJSON `json:"-"`
}

Present only if success is false.

func (*NotifySendBatchResponseResultsError) UnmarshalJSON added in v0.10.0

func (r *NotifySendBatchResponseResultsError) UnmarshalJSON(data []byte) (err error)

type NotifySendBatchResponseResultsMessage added in v0.10.0

type NotifySendBatchResponseResultsMessage struct {
	// The message identifier.
	ID string `json:"id"`
	// The correlation identifier for the message.
	CorrelationID string `json:"correlation_id"`
	// The message creation date in RFC3339 format.
	CreatedAt time.Time `json:"created_at" format:"date-time"`
	// The message expiration date in RFC3339 format.
	ExpiresAt time.Time `json:"expires_at" format:"date-time"`
	// The Sender ID used for this message.
	From string `json:"from"`
	// The locale used for the message, if any.
	Locale string `json:"locale"`
	// When the message will actually be sent in RFC3339 format with timezone offset.
	ScheduleAt time.Time `json:"schedule_at" format:"date-time"`
	// The recipient's phone number in E.164 format.
	To   string                                    `json:"to"`
	JSON notifySendBatchResponseResultsMessageJSON `json:"-"`
}

Present only if success is true.

func (*NotifySendBatchResponseResultsMessage) UnmarshalJSON added in v0.10.0

func (r *NotifySendBatchResponseResultsMessage) UnmarshalJSON(data []byte) (err error)

type NotifySendParams added in v0.10.0

type NotifySendParams struct {
	// The template identifier configured by your Customer Success team.
	TemplateID param.Field[string] `json:"template_id,required"`
	// The recipient's phone number in E.164 format.
	To param.Field[string] `json:"to,required"`
	// The URL where webhooks will be sent for message delivery events.
	CallbackURL param.Field[string] `json:"callback_url"`
	// A user-defined identifier to correlate this message with your internal systems.
	// It is returned in the response and any webhook events that refer to this
	// message.
	CorrelationID param.Field[string] `json:"correlation_id"`
	// The message expiration date in RFC3339 format. The message will not be sent if
	// this time is reached.
	ExpiresAt param.Field[time.Time] `json:"expires_at" format:"date-time"`
	// The Sender ID. Must be approved for your account.
	From param.Field[string] `json:"from"`
	// A BCP-47 formatted locale string with the language the text message will be sent
	// to. If there's no locale set, the language will be determined by the country
	// code of the phone number. If the language specified doesn't exist, the default
	// set on the template will be used.
	Locale param.Field[string] `json:"locale"`
	// The preferred channel to be used in priority for message delivery. If the
	// channel is unavailable, the system will fallback to other available channels.
	PreferredChannel param.Field[NotifySendParamsPreferredChannel] `json:"preferred_channel"`
	// Schedule the message for future delivery in RFC3339 format. Marketing messages
	// can be scheduled up to 90 days in advance and will be automatically adjusted for
	// compliance with local time window restrictions.
	ScheduleAt param.Field[time.Time] `json:"schedule_at" format:"date-time"`
	// The variables to be replaced in the template.
	Variables param.Field[map[string]string] `json:"variables"`
}

func (NotifySendParams) MarshalJSON added in v0.10.0

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

type NotifySendParamsPreferredChannel added in v0.10.0

type NotifySendParamsPreferredChannel string

The preferred channel to be used in priority for message delivery. If the channel is unavailable, the system will fallback to other available channels.

const (
	NotifySendParamsPreferredChannelSMS      NotifySendParamsPreferredChannel = "sms"
	NotifySendParamsPreferredChannelWhatsapp NotifySendParamsPreferredChannel = "whatsapp"
)

func (NotifySendParamsPreferredChannel) IsKnown added in v0.10.0

type NotifySendResponse added in v0.10.0

type NotifySendResponse struct {
	// The message identifier.
	ID string `json:"id,required"`
	// The message creation date in RFC3339 format.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The message expiration date in RFC3339 format.
	ExpiresAt time.Time `json:"expires_at,required" format:"date-time"`
	// The template identifier.
	TemplateID string `json:"template_id,required"`
	// The recipient's phone number in E.164 format.
	To string `json:"to,required"`
	// The variables to be replaced in the template.
	Variables map[string]string `json:"variables,required"`
	// The callback URL where webhooks will be sent.
	CallbackURL string `json:"callback_url"`
	// A user-defined identifier to correlate this message with your internal systems.
	CorrelationID string `json:"correlation_id"`
	// The Sender ID used for this message.
	From string `json:"from"`
	// When the message will actually be sent in RFC3339 format with timezone offset.
	// For marketing messages, this may differ from the requested schedule_at due to
	// automatic compliance adjustments.
	ScheduleAt time.Time              `json:"schedule_at" format:"date-time"`
	JSON       notifySendResponseJSON `json:"-"`
}

func (*NotifySendResponse) UnmarshalJSON added in v0.10.0

func (r *NotifySendResponse) UnmarshalJSON(data []byte) (err error)

type NotifyService added in v0.10.0

type NotifyService struct {
	Options []option.RequestOption
}

NotifyService contains methods and other services that help with interacting with the Prelude 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 NewNotifyService method instead.

func NewNotifyService added in v0.10.0

func NewNotifyService(opts ...option.RequestOption) (r *NotifyService)

NewNotifyService 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 (*NotifyService) GetSubscriptionConfig added in v0.10.0

func (r *NotifyService) GetSubscriptionConfig(ctx context.Context, configID string, opts ...option.RequestOption) (res *NotifyGetSubscriptionConfigResponse, err error)

Retrieve a specific subscription management configuration by its ID.

func (*NotifyService) GetSubscriptionPhoneNumber added in v0.10.0

func (r *NotifyService) GetSubscriptionPhoneNumber(ctx context.Context, configID string, phoneNumber string, opts ...option.RequestOption) (res *NotifyGetSubscriptionPhoneNumberResponse, err error)

Retrieve the current subscription status for a specific phone number within a subscription configuration.

func (*NotifyService) ListSubscriptionConfigs added in v0.10.0

Retrieve a paginated list of subscription management configurations for your account.

Each configuration represents a subscription management setup with phone numbers for receiving opt-out/opt-in requests and a callback URL for webhook events.

func (*NotifyService) ListSubscriptionPhoneNumberEvents added in v0.10.0

func (r *NotifyService) ListSubscriptionPhoneNumberEvents(ctx context.Context, configID string, phoneNumber string, query NotifyListSubscriptionPhoneNumberEventsParams, opts ...option.RequestOption) (res *NotifyListSubscriptionPhoneNumberEventsResponse, err error)

Retrieve a paginated list of subscription events (status changes) for a specific phone number within a subscription configuration.

Events are ordered by timestamp in descending order (most recent first).

func (*NotifyService) ListSubscriptionPhoneNumbers added in v0.10.0

Retrieve a paginated list of phone numbers and their subscription statuses for a specific subscription configuration.

You can optionally filter by subscription state (SUB or UNSUB).

func (*NotifyService) Send added in v0.10.0

Send transactional and marketing messages to your users via SMS and WhatsApp with automatic compliance enforcement.

func (*NotifyService) SendBatch added in v0.10.0

Send the same message to multiple recipients in a single request.

type TransactionalSendParams

type TransactionalSendParams struct {
	// The template identifier.
	TemplateID param.Field[string] `json:"template_id,required"`
	// The recipient's phone number.
	To param.Field[string] `json:"to,required"`
	// The callback URL.
	CallbackURL param.Field[string] `json:"callback_url"`
	// A user-defined identifier to correlate this transactional message with. It is
	// returned in the response and any webhook events that refer to this
	// transactionalmessage.
	CorrelationID param.Field[string] `json:"correlation_id"`
	// The message expiration date.
	ExpiresAt param.Field[string] `json:"expires_at"`
	// The Sender ID.
	From param.Field[string] `json:"from"`
	// A BCP-47 formatted locale string with the language the text message will be sent
	// to. If there's no locale set, the language will be determined by the country
	// code of the phone number. If the language specified doesn't exist, the default
	// set on the template will be used.
	Locale param.Field[string] `json:"locale"`
	// The preferred delivery channel for the message. When specified, the system will
	// prioritize sending via the requested channel if the template is configured for
	// it.
	//
	// If not specified and the template is configured for WhatsApp, the message will
	// be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery
	// is unavailable.
	//
	// Supported channels: `sms`, `rcs`, `whatsapp`.
	PreferredChannel param.Field[TransactionalSendParamsPreferredChannel] `json:"preferred_channel"`
	// The variables to be replaced in the template.
	Variables param.Field[map[string]string] `json:"variables"`
}

func (TransactionalSendParams) MarshalJSON

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

type TransactionalSendParamsPreferredChannel added in v0.9.0

type TransactionalSendParamsPreferredChannel string

The preferred delivery channel for the message. When specified, the system will prioritize sending via the requested channel if the template is configured for it.

If not specified and the template is configured for WhatsApp, the message will be sent via WhatsApp first, with automatic fallback to SMS if WhatsApp delivery is unavailable.

Supported channels: `sms`, `rcs`, `whatsapp`.

const (
	TransactionalSendParamsPreferredChannelSMS      TransactionalSendParamsPreferredChannel = "sms"
	TransactionalSendParamsPreferredChannelRcs      TransactionalSendParamsPreferredChannel = "rcs"
	TransactionalSendParamsPreferredChannelWhatsapp TransactionalSendParamsPreferredChannel = "whatsapp"
)

func (TransactionalSendParamsPreferredChannel) IsKnown added in v0.9.0

type TransactionalSendResponse

type TransactionalSendResponse struct {
	// The message identifier.
	ID string `json:"id,required"`
	// The message creation date.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// The message expiration date.
	ExpiresAt time.Time `json:"expires_at,required" format:"date-time"`
	// The template identifier.
	TemplateID string `json:"template_id,required"`
	// The recipient's phone number.
	To string `json:"to,required"`
	// The variables to be replaced in the template.
	Variables map[string]string `json:"variables,required"`
	// The callback URL.
	CallbackURL string `json:"callback_url"`
	// A user-defined identifier to correlate this transactional message with. It is
	// returned in the response and any webhook events that refer to this transactional
	// message.
	CorrelationID string `json:"correlation_id"`
	// The Sender ID.
	From string                        `json:"from"`
	JSON transactionalSendResponseJSON `json:"-"`
}

func (*TransactionalSendResponse) UnmarshalJSON

func (r *TransactionalSendResponse) UnmarshalJSON(data []byte) (err error)

type TransactionalService

type TransactionalService struct {
	Options []option.RequestOption
}

TransactionalService contains methods and other services that help with interacting with the Prelude 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 NewTransactionalService method instead.

func NewTransactionalService

func NewTransactionalService(opts ...option.RequestOption) (r *TransactionalService)

NewTransactionalService 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 (*TransactionalService) Send deprecated

Legacy route maintained for backward compatibility. Migrate to `/v2/notify` instead.

Deprecated: deprecated

type VerificationCheckParams

type VerificationCheckParams struct {
	// The OTP code to validate.
	Code param.Field[string] `json:"code,required"`
	// The verification target. Either a phone number or an email address. To use the
	// email verification feature contact us to discuss your use case.
	Target param.Field[VerificationCheckParamsTarget] `json:"target,required"`
}

func (VerificationCheckParams) MarshalJSON

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

type VerificationCheckParamsTarget

type VerificationCheckParamsTarget struct {
	// The type of the target. Either "phone_number" or "email_address".
	Type param.Field[VerificationCheckParamsTargetType] `json:"type,required"`
	// An E.164 formatted phone number or an email address.
	Value param.Field[string] `json:"value,required"`
}

The verification target. Either a phone number or an email address. To use the email verification feature contact us to discuss your use case.

func (VerificationCheckParamsTarget) MarshalJSON

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

type VerificationCheckParamsTargetType

type VerificationCheckParamsTargetType string

The type of the target. Either "phone_number" or "email_address".

const (
	VerificationCheckParamsTargetTypePhoneNumber  VerificationCheckParamsTargetType = "phone_number"
	VerificationCheckParamsTargetTypeEmailAddress VerificationCheckParamsTargetType = "email_address"
)

func (VerificationCheckParamsTargetType) IsKnown

type VerificationCheckResponse

type VerificationCheckResponse struct {
	// The status of the check.
	Status VerificationCheckResponseStatus `json:"status,required"`
	// The verification identifier.
	ID string `json:"id"`
	// The metadata for this verification.
	Metadata  VerificationCheckResponseMetadata `json:"metadata"`
	RequestID string                            `json:"request_id"`
	JSON      verificationCheckResponseJSON     `json:"-"`
}

func (*VerificationCheckResponse) UnmarshalJSON

func (r *VerificationCheckResponse) UnmarshalJSON(data []byte) (err error)

type VerificationCheckResponseMetadata

type VerificationCheckResponseMetadata struct {
	// A user-defined identifier to correlate this verification with. It is returned in
	// the response and any webhook events that refer to this verification.
	CorrelationID string                                `json:"correlation_id"`
	JSON          verificationCheckResponseMetadataJSON `json:"-"`
}

The metadata for this verification.

func (*VerificationCheckResponseMetadata) UnmarshalJSON

func (r *VerificationCheckResponseMetadata) UnmarshalJSON(data []byte) (err error)

type VerificationCheckResponseStatus

type VerificationCheckResponseStatus string

The status of the check.

const (
	VerificationCheckResponseStatusSuccess           VerificationCheckResponseStatus = "success"
	VerificationCheckResponseStatusFailure           VerificationCheckResponseStatus = "failure"
	VerificationCheckResponseStatusExpiredOrNotFound VerificationCheckResponseStatus = "expired_or_not_found"
)

func (VerificationCheckResponseStatus) IsKnown

type VerificationManagementDeletePhoneNumberParams added in v0.9.0

type VerificationManagementDeletePhoneNumberParams struct {
	// An E.164 formatted phone number to remove from the list.
	PhoneNumber param.Field[string] `json:"phone_number,required" format:"phone_number"`
}

func (VerificationManagementDeletePhoneNumberParams) MarshalJSON added in v0.9.0

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

type VerificationManagementDeletePhoneNumberParamsAction added in v0.9.0

type VerificationManagementDeletePhoneNumberParamsAction string
const (
	VerificationManagementDeletePhoneNumberParamsActionAllow VerificationManagementDeletePhoneNumberParamsAction = "allow"
	VerificationManagementDeletePhoneNumberParamsActionBlock VerificationManagementDeletePhoneNumberParamsAction = "block"
)

func (VerificationManagementDeletePhoneNumberParamsAction) IsKnown added in v0.9.0

type VerificationManagementDeletePhoneNumberResponse added in v0.9.0

type VerificationManagementDeletePhoneNumberResponse struct {
	// The E.164 formatted phone number that was removed from the list.
	PhoneNumber string                                              `json:"phone_number,required" format:"phone_number"`
	JSON        verificationManagementDeletePhoneNumberResponseJSON `json:"-"`
}

func (*VerificationManagementDeletePhoneNumberResponse) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementDeletePhoneNumberResponse) UnmarshalJSON(data []byte) (err error)

type VerificationManagementListPhoneNumbersParamsAction added in v0.9.0

type VerificationManagementListPhoneNumbersParamsAction string
const (
	VerificationManagementListPhoneNumbersParamsActionAllow VerificationManagementListPhoneNumbersParamsAction = "allow"
	VerificationManagementListPhoneNumbersParamsActionBlock VerificationManagementListPhoneNumbersParamsAction = "block"
)

func (VerificationManagementListPhoneNumbersParamsAction) IsKnown added in v0.9.0

type VerificationManagementListPhoneNumbersResponse added in v0.9.0

type VerificationManagementListPhoneNumbersResponse struct {
	// A list of phone numbers in the allow or block list.
	PhoneNumbers []VerificationManagementListPhoneNumbersResponsePhoneNumber `json:"phone_numbers,required"`
	JSON         verificationManagementListPhoneNumbersResponseJSON          `json:"-"`
}

func (*VerificationManagementListPhoneNumbersResponse) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementListPhoneNumbersResponse) UnmarshalJSON(data []byte) (err error)

type VerificationManagementListPhoneNumbersResponsePhoneNumber added in v0.9.0

type VerificationManagementListPhoneNumbersResponsePhoneNumber struct {
	// The date and time when the phone number was added to the list.
	CreatedAt time.Time `json:"created_at,required" format:"date-time"`
	// An E.164 formatted phone number.
	PhoneNumber string                                                        `json:"phone_number,required" format:"phone_number"`
	JSON        verificationManagementListPhoneNumbersResponsePhoneNumberJSON `json:"-"`
}

func (*VerificationManagementListPhoneNumbersResponsePhoneNumber) UnmarshalJSON added in v0.9.0

type VerificationManagementListSenderIDsResponse added in v0.9.0

type VerificationManagementListSenderIDsResponse struct {
	SenderIDs []VerificationManagementListSenderIDsResponseSenderID `json:"sender_ids"`
	JSON      verificationManagementListSenderIDsResponseJSON       `json:"-"`
}

A list of Sender ID.

func (*VerificationManagementListSenderIDsResponse) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementListSenderIDsResponse) UnmarshalJSON(data []byte) (err error)

type VerificationManagementListSenderIDsResponseSenderID added in v0.9.0

type VerificationManagementListSenderIDsResponseSenderID struct {
	// Value that will be presented as Sender ID
	SenderID string `json:"sender_id"`
	// It indicates the status of the Sender ID. Possible values are:
	//
	// - `approved` - The Sender ID is approved.
	// - `pending` - The Sender ID is pending.
	// - `rejected` - The Sender ID is rejected.
	Status VerificationManagementListSenderIDsResponseSenderIDsStatus `json:"status"`
	JSON   verificationManagementListSenderIDsResponseSenderIDJSON    `json:"-"`
}

func (*VerificationManagementListSenderIDsResponseSenderID) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementListSenderIDsResponseSenderID) UnmarshalJSON(data []byte) (err error)

type VerificationManagementListSenderIDsResponseSenderIDsStatus added in v0.9.0

type VerificationManagementListSenderIDsResponseSenderIDsStatus string

It indicates the status of the Sender ID. Possible values are:

- `approved` - The Sender ID is approved. - `pending` - The Sender ID is pending. - `rejected` - The Sender ID is rejected.

const (
	VerificationManagementListSenderIDsResponseSenderIDsStatusApproved VerificationManagementListSenderIDsResponseSenderIDsStatus = "approved"
	VerificationManagementListSenderIDsResponseSenderIDsStatusPending  VerificationManagementListSenderIDsResponseSenderIDsStatus = "pending"
	VerificationManagementListSenderIDsResponseSenderIDsStatusRejected VerificationManagementListSenderIDsResponseSenderIDsStatus = "rejected"
)

func (VerificationManagementListSenderIDsResponseSenderIDsStatus) IsKnown added in v0.9.0

type VerificationManagementService added in v0.9.0

type VerificationManagementService struct {
	Options []option.RequestOption
}

VerificationManagementService contains methods and other services that help with interacting with the Prelude 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 NewVerificationManagementService method instead.

func NewVerificationManagementService added in v0.9.0

func NewVerificationManagementService(opts ...option.RequestOption) (r *VerificationManagementService)

NewVerificationManagementService 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 (*VerificationManagementService) DeletePhoneNumber added in v0.9.0

Remove a phone number from the allow or block list.

This operation is idempotent - re-deleting the same phone number will not result in errors. If the phone number does not exist in the specified list, the operation will succeed without making any changes.

In order to get access to this endpoint, contact our support team.

func (*VerificationManagementService) ListPhoneNumbers added in v0.9.0

Retrieve the list of phone numbers in the allow or block list.

In order to get access to this endpoint, contact our support team.

func (*VerificationManagementService) ListSenderIDs added in v0.9.0

Retrieve sender IDs list.

In order to get access to this endpoint, contact our support team.

func (*VerificationManagementService) SetPhoneNumber added in v0.9.0

Add a phone number to the allow or block list.

This operation is idempotent - re-adding the same phone number will not result in duplicate entries or errors. If the phone number already exists in the specified list, the operation will succeed without making any changes.

In order to get access to this endpoint, contact our support team.

func (*VerificationManagementService) SubmitSenderID added in v0.9.0

This endpoint allows you to submit a new sender ID for verification purposes.

In order to get access to this endpoint, contact our support team.

type VerificationManagementSetPhoneNumberParams added in v0.9.0

type VerificationManagementSetPhoneNumberParams struct {
	// An E.164 formatted phone number to add to the list.
	PhoneNumber param.Field[string] `json:"phone_number,required" format:"phone_number"`
}

func (VerificationManagementSetPhoneNumberParams) MarshalJSON added in v0.9.0

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

type VerificationManagementSetPhoneNumberParamsAction added in v0.9.0

type VerificationManagementSetPhoneNumberParamsAction string
const (
	VerificationManagementSetPhoneNumberParamsActionAllow VerificationManagementSetPhoneNumberParamsAction = "allow"
	VerificationManagementSetPhoneNumberParamsActionBlock VerificationManagementSetPhoneNumberParamsAction = "block"
)

func (VerificationManagementSetPhoneNumberParamsAction) IsKnown added in v0.9.0

type VerificationManagementSetPhoneNumberResponse added in v0.9.0

type VerificationManagementSetPhoneNumberResponse struct {
	// The E.164 formatted phone number that was added to the list.
	PhoneNumber string                                           `json:"phone_number,required" format:"phone_number"`
	JSON        verificationManagementSetPhoneNumberResponseJSON `json:"-"`
}

func (*VerificationManagementSetPhoneNumberResponse) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementSetPhoneNumberResponse) UnmarshalJSON(data []byte) (err error)

type VerificationManagementSubmitSenderIDParams added in v0.9.0

type VerificationManagementSubmitSenderIDParams struct {
	// The sender ID to add.
	SenderID param.Field[string] `json:"sender_id,required"`
}

func (VerificationManagementSubmitSenderIDParams) MarshalJSON added in v0.9.0

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

type VerificationManagementSubmitSenderIDResponse added in v0.9.0

type VerificationManagementSubmitSenderIDResponse struct {
	// The sender ID that was added.
	SenderID string `json:"sender_id,required"`
	// It indicates the status of the sender ID. Possible values are:
	//
	// - `approved` - The sender ID is approved.
	// - `pending` - The sender ID is pending.
	// - `rejected` - The sender ID is rejected.
	Status VerificationManagementSubmitSenderIDResponseStatus `json:"status,required"`
	// The reason why the sender ID was rejected.
	Reason string                                           `json:"reason"`
	JSON   verificationManagementSubmitSenderIDResponseJSON `json:"-"`
}

func (*VerificationManagementSubmitSenderIDResponse) UnmarshalJSON added in v0.9.0

func (r *VerificationManagementSubmitSenderIDResponse) UnmarshalJSON(data []byte) (err error)

type VerificationManagementSubmitSenderIDResponseStatus added in v0.9.0

type VerificationManagementSubmitSenderIDResponseStatus string

It indicates the status of the sender ID. Possible values are:

- `approved` - The sender ID is approved. - `pending` - The sender ID is pending. - `rejected` - The sender ID is rejected.

const (
	VerificationManagementSubmitSenderIDResponseStatusApproved VerificationManagementSubmitSenderIDResponseStatus = "approved"
	VerificationManagementSubmitSenderIDResponseStatusPending  VerificationManagementSubmitSenderIDResponseStatus = "pending"
	VerificationManagementSubmitSenderIDResponseStatusRejected VerificationManagementSubmitSenderIDResponseStatus = "rejected"
)

func (VerificationManagementSubmitSenderIDResponseStatus) IsKnown added in v0.9.0

type VerificationNewParams

type VerificationNewParams struct {
	// The verification target. Either a phone number or an email address. To use the
	// email verification feature contact us to discuss your use case.
	Target param.Field[VerificationNewParamsTarget] `json:"target,required"`
	// The identifier of the dispatch that came from the front-end SDK.
	DispatchID param.Field[string] `json:"dispatch_id"`
	// The metadata for this verification. This object will be returned with every
	// response or webhook sent that refers to this verification.
	Metadata param.Field[VerificationNewParamsMetadata] `json:"metadata"`
	// Verification options
	Options param.Field[VerificationNewParamsOptions] `json:"options"`
	// The signals used for anti-fraud. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	Signals param.Field[VerificationNewParamsSignals] `json:"signals"`
}

func (VerificationNewParams) MarshalJSON

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

type VerificationNewParamsMetadata

type VerificationNewParamsMetadata struct {
	// A user-defined identifier to correlate this verification with. It is returned in
	// the response and any webhook events that refer to this verification.
	CorrelationID param.Field[string] `json:"correlation_id"`
}

The metadata for this verification. This object will be returned with every response or webhook sent that refers to this verification.

func (VerificationNewParamsMetadata) MarshalJSON

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

type VerificationNewParamsOptions

type VerificationNewParamsOptions struct {
	// This allows you to automatically retrieve and fill the OTP code on mobile apps.
	// Currently only Android devices are supported.
	AppRealm param.Field[VerificationNewParamsOptionsAppRealm] `json:"app_realm"`
	// The URL where webhooks will be sent when verification events occur, including
	// verification creation, attempt creation, and delivery status changes. For more
	// details, refer to [Webhook](/verify/v2/documentation/webhook).
	CallbackURL param.Field[string] `json:"callback_url"`
	// The size of the code generated. It should be between 4 and 8. Defaults to the
	// code size specified from the Dashboard.
	CodeSize param.Field[int64] `json:"code_size"`
	// The custom code to use for OTP verification. To use the custom code feature,
	// contact us to enable it for your account. For more details, refer to
	// [Custom Code](/verify/v2/documentation/custom-codes).
	CustomCode param.Field[string] `json:"custom_code"`
	// The integration that triggered the verification.
	Integration param.Field[VerificationNewParamsOptionsIntegration] `json:"integration"`
	// A BCP-47 formatted locale string with the language the text message will be sent
	// to. If there's no locale set, the language will be determined by the country
	// code of the phone number. If the language specified doesn't exist, it defaults
	// to US English.
	Locale param.Field[string] `json:"locale"`
	// The method used for verifying this phone number. The 'voice' option provides an
	// accessible alternative for visually impaired users by delivering the
	// verification code through a phone call rather than a text message. It also
	// allows verification of landline numbers that cannot receive SMS messages. The
	// 'message' option explicitly requests message delivery (SMS, WhatsApp ...) and
	// skips silent verification, useful for scenarios requiring direct user
	// interaction.
	Method param.Field[VerificationNewParamsOptionsMethod] `json:"method"`
	// The preferred channel to be used in priority for verification.
	PreferredChannel param.Field[VerificationNewParamsOptionsPreferredChannel] `json:"preferred_channel"`
	// The Sender ID to use for this message. The Sender ID needs to be enabled by
	// Prelude.
	SenderID param.Field[string] `json:"sender_id"`
	// The identifier of a verification template. It applies use case-specific
	// settings, such as the message content or certain verification parameters.
	TemplateID param.Field[string] `json:"template_id"`
	// The variables to be replaced in the template.
	Variables param.Field[map[string]string] `json:"variables"`
}

Verification options

func (VerificationNewParamsOptions) MarshalJSON

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

type VerificationNewParamsOptionsAppRealm

type VerificationNewParamsOptionsAppRealm struct {
	// The platform the SMS will be sent to. We are currently only supporting
	// "android".
	Platform param.Field[VerificationNewParamsOptionsAppRealmPlatform] `json:"platform,required"`
	// The Android SMS Retriever API hash code that identifies your app. For more
	// information, see
	// [Google documentation](https://developers.google.com/identity/sms-retriever/verify#computing_your_apps_hash_string).
	Value param.Field[string] `json:"value,required"`
}

This allows you to automatically retrieve and fill the OTP code on mobile apps. Currently only Android devices are supported.

func (VerificationNewParamsOptionsAppRealm) MarshalJSON

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

type VerificationNewParamsOptionsAppRealmPlatform

type VerificationNewParamsOptionsAppRealmPlatform string

The platform the SMS will be sent to. We are currently only supporting "android".

const (
	VerificationNewParamsOptionsAppRealmPlatformAndroid VerificationNewParamsOptionsAppRealmPlatform = "android"
)

func (VerificationNewParamsOptionsAppRealmPlatform) IsKnown

type VerificationNewParamsOptionsIntegration added in v0.8.0

type VerificationNewParamsOptionsIntegration string

The integration that triggered the verification.

const (
	VerificationNewParamsOptionsIntegrationAuth0    VerificationNewParamsOptionsIntegration = "auth0"
	VerificationNewParamsOptionsIntegrationSupabase VerificationNewParamsOptionsIntegration = "supabase"
)

func (VerificationNewParamsOptionsIntegration) IsKnown added in v0.8.0

type VerificationNewParamsOptionsMethod added in v0.4.0

type VerificationNewParamsOptionsMethod string

The method used for verifying this phone number. The 'voice' option provides an accessible alternative for visually impaired users by delivering the verification code through a phone call rather than a text message. It also allows verification of landline numbers that cannot receive SMS messages. The 'message' option explicitly requests message delivery (SMS, WhatsApp ...) and skips silent verification, useful for scenarios requiring direct user interaction.

const (
	VerificationNewParamsOptionsMethodAuto    VerificationNewParamsOptionsMethod = "auto"
	VerificationNewParamsOptionsMethodVoice   VerificationNewParamsOptionsMethod = "voice"
	VerificationNewParamsOptionsMethodMessage VerificationNewParamsOptionsMethod = "message"
)

func (VerificationNewParamsOptionsMethod) IsKnown added in v0.4.0

type VerificationNewParamsOptionsPreferredChannel added in v0.4.0

type VerificationNewParamsOptionsPreferredChannel string

The preferred channel to be used in priority for verification.

const (
	VerificationNewParamsOptionsPreferredChannelSMS      VerificationNewParamsOptionsPreferredChannel = "sms"
	VerificationNewParamsOptionsPreferredChannelRcs      VerificationNewParamsOptionsPreferredChannel = "rcs"
	VerificationNewParamsOptionsPreferredChannelWhatsapp VerificationNewParamsOptionsPreferredChannel = "whatsapp"
	VerificationNewParamsOptionsPreferredChannelViber    VerificationNewParamsOptionsPreferredChannel = "viber"
	VerificationNewParamsOptionsPreferredChannelZalo     VerificationNewParamsOptionsPreferredChannel = "zalo"
	VerificationNewParamsOptionsPreferredChannelTelegram VerificationNewParamsOptionsPreferredChannel = "telegram"
)

func (VerificationNewParamsOptionsPreferredChannel) IsKnown added in v0.4.0

type VerificationNewParamsSignals

type VerificationNewParamsSignals struct {
	// The version of your application.
	AppVersion param.Field[string] `json:"app_version"`
	// The unique identifier for the user's device. For Android, this corresponds to
	// the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
	DeviceID param.Field[string] `json:"device_id"`
	// The model of the user's device.
	DeviceModel param.Field[string] `json:"device_model"`
	// The type of the user's device.
	DevicePlatform param.Field[VerificationNewParamsSignalsDevicePlatform] `json:"device_platform"`
	// The IP address of the user's device.
	IP param.Field[string] `json:"ip" format:"ipv4"`
	// This signal should provide a higher level of trust, indicating that the user is
	// genuine. Contact us to discuss your use case. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	IsTrustedUser param.Field[bool] `json:"is_trusted_user"`
	// The JA4 fingerprint observed for the connection. Prelude will infer it
	// automatically when requests go through our client SDK (which uses Prelude's
	// edge), but you can also provide it explicitly if you terminate TLS yourself.
	Ja4Fingerprint param.Field[string] `json:"ja4_fingerprint"`
	// The version of the user's device operating system.
	OsVersion param.Field[string] `json:"os_version"`
	// The user agent of the user's device. If the individual fields (os_version,
	// device_platform, device_model) are provided, we will prioritize those values
	// instead of parsing them from the user agent string.
	UserAgent param.Field[string] `json:"user_agent"`
}

The signals used for anti-fraud. For more details, refer to [Signals](/verify/v2/documentation/prevent-fraud#signals).

func (VerificationNewParamsSignals) MarshalJSON

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

type VerificationNewParamsSignalsDevicePlatform

type VerificationNewParamsSignalsDevicePlatform string

The type of the user's device.

const (
	VerificationNewParamsSignalsDevicePlatformAndroid VerificationNewParamsSignalsDevicePlatform = "android"
	VerificationNewParamsSignalsDevicePlatformIos     VerificationNewParamsSignalsDevicePlatform = "ios"
	VerificationNewParamsSignalsDevicePlatformIpados  VerificationNewParamsSignalsDevicePlatform = "ipados"
	VerificationNewParamsSignalsDevicePlatformTvos    VerificationNewParamsSignalsDevicePlatform = "tvos"
	VerificationNewParamsSignalsDevicePlatformWeb     VerificationNewParamsSignalsDevicePlatform = "web"
)

func (VerificationNewParamsSignalsDevicePlatform) IsKnown

type VerificationNewParamsTarget

type VerificationNewParamsTarget struct {
	// The type of the target. Either "phone_number" or "email_address".
	Type param.Field[VerificationNewParamsTargetType] `json:"type,required"`
	// An E.164 formatted phone number or an email address.
	Value param.Field[string] `json:"value,required"`
}

The verification target. Either a phone number or an email address. To use the email verification feature contact us to discuss your use case.

func (VerificationNewParamsTarget) MarshalJSON

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

type VerificationNewParamsTargetType

type VerificationNewParamsTargetType string

The type of the target. Either "phone_number" or "email_address".

const (
	VerificationNewParamsTargetTypePhoneNumber  VerificationNewParamsTargetType = "phone_number"
	VerificationNewParamsTargetTypeEmailAddress VerificationNewParamsTargetType = "email_address"
)

func (VerificationNewParamsTargetType) IsKnown

type VerificationNewResponse

type VerificationNewResponse struct {
	// The verification identifier.
	ID string `json:"id,required"`
	// The method used for verifying this phone number.
	Method VerificationNewResponseMethod `json:"method,required"`
	// The status of the verification.
	Status VerificationNewResponseStatus `json:"status,required"`
	// The ordered sequence of channels to be used for verification
	Channels []VerificationNewResponseChannel `json:"channels"`
	// The metadata for this verification.
	Metadata VerificationNewResponseMetadata `json:"metadata"`
	// The reason why the verification was blocked. Only present when status is
	// "blocked".
	//
	//   - `expired_signature` - The signature of the SDK signals is expired. They should
	//     be sent within the hour following their collection.
	//   - `in_block_list` - The phone number is part of the configured block list.
	//   - `invalid_phone_line` - The phone number is not a valid line number (e.g.
	//     landline).
	//   - `invalid_phone_number` - The phone number is not a valid phone number (e.g.
	//     unallocated range).
	//   - `invalid_signature` - The signature of the SDK signals is invalid.
	//   - `repeated_attempts` - The phone number has made too many verification
	//     attempts.
	//   - `suspicious` - The verification attempt was deemed suspicious by the
	//     anti-fraud system.
	Reason    VerificationNewResponseReason `json:"reason"`
	RequestID string                        `json:"request_id"`
	// The silent verification specific properties.
	Silent VerificationNewResponseSilent `json:"silent"`
	JSON   verificationNewResponseJSON   `json:"-"`
}

func (*VerificationNewResponse) UnmarshalJSON

func (r *VerificationNewResponse) UnmarshalJSON(data []byte) (err error)

type VerificationNewResponseChannel added in v0.7.0

type VerificationNewResponseChannel string
const (
	VerificationNewResponseChannelRcs      VerificationNewResponseChannel = "rcs"
	VerificationNewResponseChannelSilent   VerificationNewResponseChannel = "silent"
	VerificationNewResponseChannelSMS      VerificationNewResponseChannel = "sms"
	VerificationNewResponseChannelTelegram VerificationNewResponseChannel = "telegram"
	VerificationNewResponseChannelViber    VerificationNewResponseChannel = "viber"
	VerificationNewResponseChannelVoice    VerificationNewResponseChannel = "voice"
	VerificationNewResponseChannelWhatsapp VerificationNewResponseChannel = "whatsapp"
	VerificationNewResponseChannelZalo     VerificationNewResponseChannel = "zalo"
)

func (VerificationNewResponseChannel) IsKnown added in v0.7.0

type VerificationNewResponseMetadata

type VerificationNewResponseMetadata struct {
	// A user-defined identifier to correlate this verification with. It is returned in
	// the response and any webhook events that refer to this verification.
	CorrelationID string                              `json:"correlation_id"`
	JSON          verificationNewResponseMetadataJSON `json:"-"`
}

The metadata for this verification.

func (*VerificationNewResponseMetadata) UnmarshalJSON

func (r *VerificationNewResponseMetadata) UnmarshalJSON(data []byte) (err error)

type VerificationNewResponseMethod

type VerificationNewResponseMethod string

The method used for verifying this phone number.

const (
	VerificationNewResponseMethodEmail   VerificationNewResponseMethod = "email"
	VerificationNewResponseMethodMessage VerificationNewResponseMethod = "message"
	VerificationNewResponseMethodSilent  VerificationNewResponseMethod = "silent"
	VerificationNewResponseMethodVoice   VerificationNewResponseMethod = "voice"
)

func (VerificationNewResponseMethod) IsKnown

func (r VerificationNewResponseMethod) IsKnown() bool

type VerificationNewResponseReason added in v0.5.0

type VerificationNewResponseReason string

The reason why the verification was blocked. Only present when status is "blocked".

  • `expired_signature` - The signature of the SDK signals is expired. They should be sent within the hour following their collection.
  • `in_block_list` - The phone number is part of the configured block list.
  • `invalid_phone_line` - The phone number is not a valid line number (e.g. landline).
  • `invalid_phone_number` - The phone number is not a valid phone number (e.g. unallocated range).
  • `invalid_signature` - The signature of the SDK signals is invalid.
  • `repeated_attempts` - The phone number has made too many verification attempts.
  • `suspicious` - The verification attempt was deemed suspicious by the anti-fraud system.
const (
	VerificationNewResponseReasonExpiredSignature   VerificationNewResponseReason = "expired_signature"
	VerificationNewResponseReasonInBlockList        VerificationNewResponseReason = "in_block_list"
	VerificationNewResponseReasonInvalidPhoneLine   VerificationNewResponseReason = "invalid_phone_line"
	VerificationNewResponseReasonInvalidPhoneNumber VerificationNewResponseReason = "invalid_phone_number"
	VerificationNewResponseReasonInvalidSignature   VerificationNewResponseReason = "invalid_signature"
	VerificationNewResponseReasonRepeatedAttempts   VerificationNewResponseReason = "repeated_attempts"
	VerificationNewResponseReasonSuspicious         VerificationNewResponseReason = "suspicious"
)

func (VerificationNewResponseReason) IsKnown added in v0.5.0

func (r VerificationNewResponseReason) IsKnown() bool

type VerificationNewResponseSilent added in v0.5.0

type VerificationNewResponseSilent struct {
	// The URL to start the silent verification towards.
	RequestURL string                            `json:"request_url,required"`
	JSON       verificationNewResponseSilentJSON `json:"-"`
}

The silent verification specific properties.

func (*VerificationNewResponseSilent) UnmarshalJSON added in v0.5.0

func (r *VerificationNewResponseSilent) UnmarshalJSON(data []byte) (err error)

type VerificationNewResponseStatus

type VerificationNewResponseStatus string

The status of the verification.

const (
	VerificationNewResponseStatusSuccess VerificationNewResponseStatus = "success"
	VerificationNewResponseStatusRetry   VerificationNewResponseStatus = "retry"
	VerificationNewResponseStatusBlocked VerificationNewResponseStatus = "blocked"
)

func (VerificationNewResponseStatus) IsKnown

func (r VerificationNewResponseStatus) IsKnown() bool

type VerificationService

type VerificationService struct {
	Options []option.RequestOption
}

VerificationService contains methods and other services that help with interacting with the Prelude 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 NewVerificationService method instead.

func NewVerificationService

func NewVerificationService(opts ...option.RequestOption) (r *VerificationService)

NewVerificationService 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 (*VerificationService) Check

Check the validity of a verification code.

func (*VerificationService) New

Create a new verification for a specific phone number. If another non-expired verification exists (the request is performed within the verification window), this endpoint will perform a retry instead.

type WatchPredictParams

type WatchPredictParams struct {
	// The prediction target. Only supports phone numbers for now.
	Target param.Field[WatchPredictParamsTarget] `json:"target,required"`
	// The identifier of the dispatch that came from the front-end SDK.
	DispatchID param.Field[string] `json:"dispatch_id"`
	// The metadata for this prediction.
	Metadata param.Field[WatchPredictParamsMetadata] `json:"metadata"`
	// The signals used for anti-fraud. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	Signals param.Field[WatchPredictParamsSignals] `json:"signals"`
}

func (WatchPredictParams) MarshalJSON

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

type WatchPredictParamsMetadata added in v0.3.0

type WatchPredictParamsMetadata struct {
	// A user-defined identifier to correlate this prediction with. It is returned in
	// the response and any webhook events that refer to this prediction.
	CorrelationID param.Field[string] `json:"correlation_id"`
}

The metadata for this prediction.

func (WatchPredictParamsMetadata) MarshalJSON added in v0.3.0

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

type WatchPredictParamsSignals

type WatchPredictParamsSignals struct {
	// The version of your application.
	AppVersion param.Field[string] `json:"app_version"`
	// The unique identifier for the user's device. For Android, this corresponds to
	// the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
	DeviceID param.Field[string] `json:"device_id"`
	// The model of the user's device.
	DeviceModel param.Field[string] `json:"device_model"`
	// The type of the user's device.
	DevicePlatform param.Field[WatchPredictParamsSignalsDevicePlatform] `json:"device_platform"`
	// The IP address of the user's device.
	IP param.Field[string] `json:"ip" format:"ipv4"`
	// This signal should provide a higher level of trust, indicating that the user is
	// genuine. Contact us to discuss your use case. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	IsTrustedUser param.Field[bool] `json:"is_trusted_user"`
	// The JA4 fingerprint observed for the connection. Prelude will infer it
	// automatically when requests go through our client SDK (which uses Prelude's
	// edge), but you can also provide it explicitly if you terminate TLS yourself.
	Ja4Fingerprint param.Field[string] `json:"ja4_fingerprint"`
	// The version of the user's device operating system.
	OsVersion param.Field[string] `json:"os_version"`
	// The user agent of the user's device. If the individual fields (os_version,
	// device_platform, device_model) are provided, we will prioritize those values
	// instead of parsing them from the user agent string.
	UserAgent param.Field[string] `json:"user_agent"`
}

The signals used for anti-fraud. For more details, refer to [Signals](/verify/v2/documentation/prevent-fraud#signals).

func (WatchPredictParamsSignals) MarshalJSON

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

type WatchPredictParamsSignalsDevicePlatform added in v0.3.0

type WatchPredictParamsSignalsDevicePlatform string

The type of the user's device.

const (
	WatchPredictParamsSignalsDevicePlatformAndroid WatchPredictParamsSignalsDevicePlatform = "android"
	WatchPredictParamsSignalsDevicePlatformIos     WatchPredictParamsSignalsDevicePlatform = "ios"
	WatchPredictParamsSignalsDevicePlatformIpados  WatchPredictParamsSignalsDevicePlatform = "ipados"
	WatchPredictParamsSignalsDevicePlatformTvos    WatchPredictParamsSignalsDevicePlatform = "tvos"
	WatchPredictParamsSignalsDevicePlatformWeb     WatchPredictParamsSignalsDevicePlatform = "web"
)

func (WatchPredictParamsSignalsDevicePlatform) IsKnown added in v0.3.0

type WatchPredictParamsTarget

type WatchPredictParamsTarget struct {
	// The type of the target. Either "phone_number" or "email_address".
	Type param.Field[WatchPredictParamsTargetType] `json:"type,required"`
	// An E.164 formatted phone number or an email address.
	Value param.Field[string] `json:"value,required"`
}

The prediction target. Only supports phone numbers for now.

func (WatchPredictParamsTarget) MarshalJSON

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

type WatchPredictParamsTargetType

type WatchPredictParamsTargetType string

The type of the target. Either "phone_number" or "email_address".

const (
	WatchPredictParamsTargetTypePhoneNumber  WatchPredictParamsTargetType = "phone_number"
	WatchPredictParamsTargetTypeEmailAddress WatchPredictParamsTargetType = "email_address"
)

func (WatchPredictParamsTargetType) IsKnown

func (r WatchPredictParamsTargetType) IsKnown() bool

type WatchPredictResponse

type WatchPredictResponse struct {
	// The prediction identifier.
	ID string `json:"id,required"`
	// The prediction outcome.
	Prediction WatchPredictResponsePrediction `json:"prediction,required"`
	// A string that identifies this specific request. Report it back to us to help us
	// diagnose your issues.
	RequestID string                   `json:"request_id,required"`
	JSON      watchPredictResponseJSON `json:"-"`
}

func (*WatchPredictResponse) UnmarshalJSON

func (r *WatchPredictResponse) UnmarshalJSON(data []byte) (err error)

type WatchPredictResponsePrediction

type WatchPredictResponsePrediction string

The prediction outcome.

const (
	WatchPredictResponsePredictionLegitimate WatchPredictResponsePrediction = "legitimate"
	WatchPredictResponsePredictionSuspicious WatchPredictResponsePrediction = "suspicious"
)

func (WatchPredictResponsePrediction) IsKnown

type WatchSendEventsParams added in v0.3.0

type WatchSendEventsParams struct {
	// A list of events to dispatch.
	Events param.Field[[]WatchSendEventsParamsEvent] `json:"events,required"`
}

func (WatchSendEventsParams) MarshalJSON added in v0.3.0

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

type WatchSendEventsParamsEvent added in v0.3.0

type WatchSendEventsParamsEvent struct {
	// A confidence level you want to assign to the event.
	Confidence param.Field[WatchSendEventsParamsEventsConfidence] `json:"confidence,required"`
	// A label to describe what the event refers to.
	Label param.Field[string] `json:"label,required"`
	// The event target. Only supports phone numbers for now.
	Target param.Field[WatchSendEventsParamsEventsTarget] `json:"target,required"`
}

func (WatchSendEventsParamsEvent) MarshalJSON added in v0.3.0

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

type WatchSendEventsParamsEventsConfidence added in v0.3.0

type WatchSendEventsParamsEventsConfidence string

A confidence level you want to assign to the event.

const (
	WatchSendEventsParamsEventsConfidenceMaximum WatchSendEventsParamsEventsConfidence = "maximum"
	WatchSendEventsParamsEventsConfidenceHigh    WatchSendEventsParamsEventsConfidence = "high"
	WatchSendEventsParamsEventsConfidenceNeutral WatchSendEventsParamsEventsConfidence = "neutral"
	WatchSendEventsParamsEventsConfidenceLow     WatchSendEventsParamsEventsConfidence = "low"
	WatchSendEventsParamsEventsConfidenceMinimum WatchSendEventsParamsEventsConfidence = "minimum"
)

func (WatchSendEventsParamsEventsConfidence) IsKnown added in v0.3.0

type WatchSendEventsParamsEventsTarget added in v0.3.0

type WatchSendEventsParamsEventsTarget struct {
	// The type of the target. Either "phone_number" or "email_address".
	Type param.Field[WatchSendEventsParamsEventsTargetType] `json:"type,required"`
	// An E.164 formatted phone number or an email address.
	Value param.Field[string] `json:"value,required"`
}

The event target. Only supports phone numbers for now.

func (WatchSendEventsParamsEventsTarget) MarshalJSON added in v0.3.0

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

type WatchSendEventsParamsEventsTargetType added in v0.3.0

type WatchSendEventsParamsEventsTargetType string

The type of the target. Either "phone_number" or "email_address".

const (
	WatchSendEventsParamsEventsTargetTypePhoneNumber  WatchSendEventsParamsEventsTargetType = "phone_number"
	WatchSendEventsParamsEventsTargetTypeEmailAddress WatchSendEventsParamsEventsTargetType = "email_address"
)

func (WatchSendEventsParamsEventsTargetType) IsKnown added in v0.3.0

type WatchSendEventsResponse added in v0.3.0

type WatchSendEventsResponse struct {
	// A string that identifies this specific request. Report it back to us to help us
	// diagnose your issues.
	RequestID string `json:"request_id,required"`
	// The status of the events dispatch.
	Status WatchSendEventsResponseStatus `json:"status,required"`
	JSON   watchSendEventsResponseJSON   `json:"-"`
}

func (*WatchSendEventsResponse) UnmarshalJSON added in v0.3.0

func (r *WatchSendEventsResponse) UnmarshalJSON(data []byte) (err error)

type WatchSendEventsResponseStatus added in v0.3.0

type WatchSendEventsResponseStatus string

The status of the events dispatch.

const (
	WatchSendEventsResponseStatusSuccess WatchSendEventsResponseStatus = "success"
)

func (WatchSendEventsResponseStatus) IsKnown added in v0.3.0

func (r WatchSendEventsResponseStatus) IsKnown() bool

type WatchSendFeedbacksParams added in v0.3.0

type WatchSendFeedbacksParams struct {
	// A list of feedbacks to send.
	Feedbacks param.Field[[]WatchSendFeedbacksParamsFeedback] `json:"feedbacks,required"`
}

func (WatchSendFeedbacksParams) MarshalJSON added in v0.3.0

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

type WatchSendFeedbacksParamsFeedback added in v0.3.0

type WatchSendFeedbacksParamsFeedback struct {
	// The feedback target. Only supports phone numbers for now.
	Target param.Field[WatchSendFeedbacksParamsFeedbacksTarget] `json:"target,required"`
	// The type of feedback.
	Type param.Field[WatchSendFeedbacksParamsFeedbacksType] `json:"type,required"`
	// The identifier of the dispatch that came from the front-end SDK.
	DispatchID param.Field[string] `json:"dispatch_id"`
	// The metadata for this feedback.
	Metadata param.Field[WatchSendFeedbacksParamsFeedbacksMetadata] `json:"metadata"`
	// The signals used for anti-fraud. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	Signals param.Field[WatchSendFeedbacksParamsFeedbacksSignals] `json:"signals"`
}

func (WatchSendFeedbacksParamsFeedback) MarshalJSON added in v0.3.0

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

type WatchSendFeedbacksParamsFeedbacksMetadata added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksMetadata struct {
	// A user-defined identifier to correlate this feedback with. It is returned in the
	// response and any webhook events that refer to this feedback.
	CorrelationID param.Field[string] `json:"correlation_id"`
}

The metadata for this feedback.

func (WatchSendFeedbacksParamsFeedbacksMetadata) MarshalJSON added in v0.3.0

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

type WatchSendFeedbacksParamsFeedbacksSignals added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksSignals struct {
	// The version of your application.
	AppVersion param.Field[string] `json:"app_version"`
	// The unique identifier for the user's device. For Android, this corresponds to
	// the `ANDROID_ID` and for iOS, this corresponds to the `identifierForVendor`.
	DeviceID param.Field[string] `json:"device_id"`
	// The model of the user's device.
	DeviceModel param.Field[string] `json:"device_model"`
	// The type of the user's device.
	DevicePlatform param.Field[WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform] `json:"device_platform"`
	// The IP address of the user's device.
	IP param.Field[string] `json:"ip" format:"ipv4"`
	// This signal should provide a higher level of trust, indicating that the user is
	// genuine. Contact us to discuss your use case. For more details, refer to
	// [Signals](/verify/v2/documentation/prevent-fraud#signals).
	IsTrustedUser param.Field[bool] `json:"is_trusted_user"`
	// The JA4 fingerprint observed for the connection. Prelude will infer it
	// automatically when requests go through our client SDK (which uses Prelude's
	// edge), but you can also provide it explicitly if you terminate TLS yourself.
	Ja4Fingerprint param.Field[string] `json:"ja4_fingerprint"`
	// The version of the user's device operating system.
	OsVersion param.Field[string] `json:"os_version"`
	// The user agent of the user's device. If the individual fields (os_version,
	// device_platform, device_model) are provided, we will prioritize those values
	// instead of parsing them from the user agent string.
	UserAgent param.Field[string] `json:"user_agent"`
}

The signals used for anti-fraud. For more details, refer to [Signals](/verify/v2/documentation/prevent-fraud#signals).

func (WatchSendFeedbacksParamsFeedbacksSignals) MarshalJSON added in v0.3.0

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

type WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform string

The type of the user's device.

const (
	WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatformAndroid WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform = "android"
	WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatformIos     WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform = "ios"
	WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatformIpados  WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform = "ipados"
	WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatformTvos    WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform = "tvos"
	WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatformWeb     WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform = "web"
)

func (WatchSendFeedbacksParamsFeedbacksSignalsDevicePlatform) IsKnown added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksTarget added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksTarget struct {
	// The type of the target. Either "phone_number" or "email_address".
	Type param.Field[WatchSendFeedbacksParamsFeedbacksTargetType] `json:"type,required"`
	// An E.164 formatted phone number or an email address.
	Value param.Field[string] `json:"value,required"`
}

The feedback target. Only supports phone numbers for now.

func (WatchSendFeedbacksParamsFeedbacksTarget) MarshalJSON added in v0.3.0

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

type WatchSendFeedbacksParamsFeedbacksTargetType added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksTargetType string

The type of the target. Either "phone_number" or "email_address".

const (
	WatchSendFeedbacksParamsFeedbacksTargetTypePhoneNumber  WatchSendFeedbacksParamsFeedbacksTargetType = "phone_number"
	WatchSendFeedbacksParamsFeedbacksTargetTypeEmailAddress WatchSendFeedbacksParamsFeedbacksTargetType = "email_address"
)

func (WatchSendFeedbacksParamsFeedbacksTargetType) IsKnown added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksType added in v0.3.0

type WatchSendFeedbacksParamsFeedbacksType string

The type of feedback.

const (
	WatchSendFeedbacksParamsFeedbacksTypeVerificationStarted   WatchSendFeedbacksParamsFeedbacksType = "verification.started"
	WatchSendFeedbacksParamsFeedbacksTypeVerificationCompleted WatchSendFeedbacksParamsFeedbacksType = "verification.completed"
)

func (WatchSendFeedbacksParamsFeedbacksType) IsKnown added in v0.3.0

type WatchSendFeedbacksResponse added in v0.3.0

type WatchSendFeedbacksResponse struct {
	// A string that identifies this specific request. Report it back to us to help us
	// diagnose your issues.
	RequestID string `json:"request_id,required"`
	// The status of the feedbacks sending.
	Status WatchSendFeedbacksResponseStatus `json:"status,required"`
	JSON   watchSendFeedbacksResponseJSON   `json:"-"`
}

func (*WatchSendFeedbacksResponse) UnmarshalJSON added in v0.3.0

func (r *WatchSendFeedbacksResponse) UnmarshalJSON(data []byte) (err error)

type WatchSendFeedbacksResponseStatus added in v0.3.0

type WatchSendFeedbacksResponseStatus string

The status of the feedbacks sending.

const (
	WatchSendFeedbacksResponseStatusSuccess WatchSendFeedbacksResponseStatus = "success"
)

func (WatchSendFeedbacksResponseStatus) IsKnown added in v0.3.0

type WatchService

type WatchService struct {
	Options []option.RequestOption
}

WatchService contains methods and other services that help with interacting with the Prelude 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 NewWatchService method instead.

func NewWatchService

func NewWatchService(opts ...option.RequestOption) (r *WatchService)

NewWatchService 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 (*WatchService) Predict

func (r *WatchService) Predict(ctx context.Context, body WatchPredictParams, opts ...option.RequestOption) (res *WatchPredictResponse, err error)

Predict the outcome of a verification based on Prelude’s anti-fraud system.

func (*WatchService) SendEvents added in v0.3.0

Send real-time event data from end-user interactions within your application. Events will be analyzed for proactive fraud prevention and risk scoring.

func (*WatchService) SendFeedbacks added in v0.3.0

Send feedback regarding your end-users verification funnel. Events will be analyzed for proactive fraud prevention and risk scoring.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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