phonic
Version:
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPhonic-Co%2Fphonic-node) [ • 13 kB
text/typescript
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
import * as core from "../../../../core/index.mjs";
import * as Phonic from "../../../index.mjs";
export declare namespace AgentsClient {
type Options = BaseClientOptions;
interface RequestOptions extends BaseRequestOptions {
}
}
export declare class AgentsClient {
protected readonly _options: NormalizedClientOptionsWithAuth<AgentsClient.Options>;
constructor(options?: AgentsClient.Options);
/**
* Returns all agents in a project.
*
* @param {Phonic.AgentsListRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.agents.list()
*/
list(request?: Phonic.AgentsListRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsListResponse>;
private __list;
/**
* Creates a new agent in a project.
*
* @param {Phonic.AgentsCreateRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.InternalServerError}
*
* @example
* await client.agents.create({
* project: "main",
* name: "support-agent",
* phone_number: "assign-automatically",
* timezone: "America/Los_Angeles",
* voice_id: "sabrina",
* audio_speed: 1,
* background_noise_level: 0,
* generate_welcome_message: false,
* is_welcome_message_interruptible: true,
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
* template_variables: {
* "customer_name": {
* default_value: "David"
* },
* "subject": {
* default_value: "Chess"
* }
* },
* tools: ["keypad_input"],
* generate_no_input_poke_text: false,
* no_input_poke_sec: 30,
* no_input_poke_text: "Are you still there?",
* default_language: "en",
* additional_languages: ["es"],
* multilingual_mode: "request",
* push_to_talk: false,
* boosted_keywords: ["Load ID", "dispatch"],
* pronunciation_dictionary: [{
* word: "Phuket",
* pronunciation: "Poo-ket"
* }],
* min_words_to_interrupt: 1,
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* })
*/
create(request: Phonic.AgentsCreateRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsCreateResponse>;
private __create;
/**
* Upserts an agent by name. If an agent with the same name already exists, it will be updated. Otherwise, it will be created.
*
* @param {Phonic.UpsertAgentRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.NotFoundError}
*
* @example
* await client.agents.upsert({
* project: "main",
* name: "support-agent",
* phone_number: "assign-automatically",
* timezone: "America/Los_Angeles",
* voice_id: "sabrina",
* audio_speed: 1,
* background_noise_level: 0,
* generate_welcome_message: false,
* is_welcome_message_interruptible: true,
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
* template_variables: {
* "customer_name": {
* default_value: "David"
* },
* "subject": {
* default_value: "Chess"
* }
* },
* tools: ["keypad_input"],
* generate_no_input_poke_text: false,
* no_input_poke_sec: 30,
* no_input_poke_text: "Are you still there?",
* default_language: "en",
* additional_languages: ["es"],
* multilingual_mode: "request",
* push_to_talk: false,
* boosted_keywords: ["Load ID", "dispatch"],
* pronunciation_dictionary: [{
* word: "Phuket",
* pronunciation: "Poo-ket"
* }],
* min_words_to_interrupt: 1,
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* })
*/
upsert(request: Phonic.UpsertAgentRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpsertResponse>;
private __upsert;
/**
* Returns an agent by name or ID.
*
* @param {string} nameOrId - The name or the ID of the agent to get.
* @param {Phonic.AgentsGetRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
*
* @example
* await client.agents.get("nameOrId", {
* project: "main"
* })
*/
get(nameOrId: string, request?: Phonic.AgentsGetRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsGetResponse>;
private __get;
/**
* Deletes an agent by name or ID.
*
* @param {string} nameOrId - The name or the ID of the agent to delete.
* @param {Phonic.AgentsDeleteRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
*
* @example
* await client.agents.delete("nameOrId", {
* project: "main"
* })
*/
delete(nameOrId: string, request?: Phonic.AgentsDeleteRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsDeleteResponse>;
private __delete;
/**
* Updates an agent by name or ID.
*
* @param {string} nameOrId - The name or the ID of the agent to update.
* @param {Phonic.UpdateAgentRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
*
* @example
* await client.agents.update("nameOrId", {
* project: "main",
* name: "updated-support-agent",
* phone_number: "assign-automatically",
* timezone: "America/Los_Angeles",
* voice_id: "sabrina",
* audio_speed: 1,
* background_noise_level: 0,
* generate_welcome_message: false,
* is_welcome_message_interruptible: true,
* welcome_message: "Hi {{customer_name}}. How can I help you today?",
* system_prompt: "You are an expert in {{subject}}. Be friendly, helpful and concise.",
* template_variables: {
* "customer_name": {
* default_value: "David"
* },
* "subject": {
* default_value: "Chess"
* }
* },
* tools: ["keypad_input"],
* generate_no_input_poke_text: false,
* no_input_poke_sec: 30,
* no_input_poke_text: "Are you still there?",
* default_language: "en",
* additional_languages: ["es"],
* multilingual_mode: "request",
* push_to_talk: false,
* boosted_keywords: ["Load ID", "dispatch"],
* pronunciation_dictionary: [{
* word: "Phuket",
* pronunciation: "Poo-ket"
* }],
* min_words_to_interrupt: 1,
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* })
*/
update(nameOrId: string, request?: Phonic.UpdateAgentRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdateResponse>;
private __update;
/**
* Adds a custom phone number to an agent. The user must configure their SIP trunk to point to Phonic's SIP server.
*
* @param {string} nameOrId - The name or the ID of the agent.
* @param {Phonic.AgentsAddCustomPhoneNumberRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.ConflictError}
*
* @example
* await client.agents.addCustomPhoneNumber("nameOrId", {
* project: "main",
* phone_number: "+15551234567",
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* })
*/
addCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsAddCustomPhoneNumberRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsAddCustomPhoneNumberResponse>;
private __addCustomPhoneNumber;
/**
* Deletes a custom phone number from an agent.
*
* @param {string} nameOrId - The name or the ID of the agent.
* @param {Phonic.AgentsDeleteCustomPhoneNumberRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.ConflictError}
*
* @example
* await client.agents.deleteCustomPhoneNumber("nameOrId", {
* project: "main",
* phone_number: "+15551234567"
* })
*/
deleteCustomPhoneNumber(nameOrId: string, request: Phonic.AgentsDeleteCustomPhoneNumberRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsDeleteCustomPhoneNumberResponse>;
private __deleteCustomPhoneNumber;
/**
* Updates a phone number on an agent.
*
* @param {string} nameOrId - The name or the ID of the agent.
* @param {Phonic.AgentsUpdatePhoneNumberRequest} request
* @param {AgentsClient.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Phonic.BadRequestError}
* @throws {@link Phonic.UnauthorizedError}
* @throws {@link Phonic.ForbiddenError}
* @throws {@link Phonic.NotFoundError}
* @throws {@link Phonic.ConflictError}
*
* @example
* await client.agents.updatePhoneNumber("nameOrId", {
* project: "main",
* phone_number: "+15551234567",
* configuration_endpoint: {
* url: "https://api.example.com/config",
* headers: {
* "Authorization": "Bearer token123"
* },
* timeout_ms: 7000
* }
* })
*/
updatePhoneNumber(nameOrId: string, request: Phonic.AgentsUpdatePhoneNumberRequest, requestOptions?: AgentsClient.RequestOptions): core.HttpResponsePromise<Phonic.AgentsUpdatePhoneNumberResponse>;
private __updatePhoneNumber;
}