/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { agentConnectorsActivateAgentConnector } from "../funcs/agentConnectorsActivateAgentConnector.js"; import { agentConnectorsCreateAgentConnector } from "../funcs/agentConnectorsCreateAgentConnector.js"; import { agentConnectorsDeleteAgentConnector } from "../funcs/agentConnectorsDeleteAgentConnector.js"; import { agentConnectorsGetAgentConnector } from "../funcs/agentConnectorsGetAgentConnector.js"; import { agentConnectorsListAgentConnectors } from "../funcs/agentConnectorsListAgentConnectors.js"; import { agentConnectorsSetupWhatsAppAppWebhook } from "../funcs/agentConnectorsSetupWhatsAppAppWebhook.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class AgentConnectors extends ClientSDK { /** * List connectors for an agent * * @remarks * Lists messaging-channel connectors configured for the agent. Connector credentials are never returned. */ async listAgentConnectors( request: operations.ListAgentConnectorsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsListAgentConnectors( this, request, options, )); } /** * Create a connector * * @remarks * Connects the agent to a Telegram bot or WhatsApp Business phone number, validates the provider credentials, and registers the agent's webhook. WhatsApp connector support is beta. Text, photos, and gateway-supported documents can invoke the agent; inbound media additionally requires write:files. Managed outbound files require read:files, and generated images require both file scopes so their transient provider URLs can be materialized before delivery. The optional write:feedback scope enables native thumbs reaction synchronization to gateway response feedback. These conditional scopes are deliberately not part of x-required-scopes because text-only connectors do not need them. An API key with every listed scope is required; its identity tuple and current scopes are stored as a non-widening ceiling, then revalidated with mk-authentication before every connector run; session and delegated end-user contexts are rejected. The required access policy controls which provider users or chats may invoke the agent. */ async createAgentConnector( request: operations.CreateAgentConnectorRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsCreateAgentConnector( this, request, options, )); } /** * Set up a WhatsApp app webhook (Beta) * * @remarks * Beta. Returns the app-level callback URL and verification token that must be saved in Meta before the first WhatsApp phone connector is created. The caller must be allowed to manage the agent. The stable verification token is returned only in this no-store response and is not a Meta access token. */ async setupWhatsAppAppWebhook( request: operations.SetupWhatsAppAppWebhookRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsSetupWhatsAppAppWebhook( this, request, options, )); } /** * Retrieve a connector * * @remarks * Retrieves connector configuration and status without exposing credentials. */ async getAgentConnector( request: operations.GetAgentConnectorRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsGetAgentConnector( this, request, options, )); } /** * Delete a connector * * @remarks * Unregisters the connector-specific provider webhook and deletes the stored connector credentials. Telegram pending updates are dropped; WhatsApp deletion clears only the phone-number callback and does not unsubscribe other numbers in the business account. */ async deleteAgentConnector( request: operations.DeleteAgentConnectorRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsDeleteAgentConnector( this, request, options, )); } /** * Activate a connector * * @remarks * Revalidates the stored provider credentials and registers the provider webhook. Use this to retry a connector left in an error state. API-key authentication with every listed scope is required; session authentication is rejected, and the key must belong to the connector's original user or service-account principal so existing conversations keep the same owner. */ async activateAgentConnector( request: operations.ActivateAgentConnectorRequest, options?: RequestOptions, ): Promise { return unwrapAsync(agentConnectorsActivateAgentConnector( this, request, options, )); } }