npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fonoster/sdk

v0.17.1

Published

Web and Node.js SDK for Fonoster

Readme

sdk

Fonoster Version Downloads/week License

This package provides a set of utilities for working with Fonoster services. It is a polymorphic SDK that can be used in a browser or a Node.js environment.

Installation

$ npm install --save @fonoster/sdk

Or using yarn:

$ yarn add @fonoster/sdk

Or in the browser:

<script src="https://unpkg.com/@fonoster/sdk"></script>

Importing the library

For CommonJS projects:

const SDK = require("@fonoster/sdk");

For ES6 modules:

import * as SDK from "@fonoster/sdk";

Directly in the browser:

<script src="https://unpkg.com/@fonoster/sdk"></script>
<script>
   // You can now use the SDK
</script>

Example

Create a new SDK instance to interact with the Fonoster API. The SDK requires a client object to handle communication with the API.

Creating a client object

In Node.js:

const SDK = require("@fonoster/sdk");
const ACCESS_KEY_ID = "WO00000000000000000000000000000000";
const ENDPOINT = "api.fonoster.com";
const client = new SDK.Client({ accessKeyId: ACCESS_KEY_ID, endpoint: ENDPOINT });

When connecting to Fonoster's cloud services, you can omit the endpoint parameter.

In the browser:

const SDK = require("@fonoster/sdk");
const ACCESS_KEY_ID = "WO00000000000000000000000000000000";
const URL = "https://api.fonoster.com/v1beta2";
const client = new SDK.WebClient({ accessKeyId: ACCESS_KEY_ID, url: URL });

When connecting to Fonoster's cloud services, you can omit the url parameter.

Login in and make requests

const username = "[email protected]";
const password = "changeme";

async function main() {
  await client.login(username, password);
  const applications = new SDK.Applications(client);
  await applications.createApplication({
    name: "MyApp",
    type: "EXTERNAL",
    endpoint: "localhost:50061" // Your app's endpoint
 });
}

main().catch(console.error);

In addition to the login method, the SDK provides a loginWithApiKey and loginWithRefreshToken methods. The loginWithRefreshToken is helpful in browser environments where you want to keep the user logged in between sessions.

The SDK will automatically refresh the token when it expires.

APIs

Acls

Fonoster Acls, part of the Fonoster SIP Proxy subsystem, allows you to create, update, retrieve, and delete Access Control Lists (ACLs) rules for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Acls(client)

Constructs a new Acls object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const acls = new SDK.Acls(client);
    const response = await acls.createAcl(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "My ACL",
  allow: ["47.132.130.31"] // Allow only this IP
};

main(request);

acls.createAcl(request) ⇒ Promise.<BaseApiObject>

Creates a new Acl in the Workspace.

Kind: instance method of Acls
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Acl

| Param | Type | Description | | --- | --- | --- | | request | CreateAclRequest | The request object that contains the necessary information to create a new Acl | | request.name | string | The name of the Acl | | request.allow | Array.<string> | The list of IPs to allow |

Example

const acls = new SDK.Acls(client); // Existing client object

const request = {
  name: "My ACL",
  allow: ["47.132.130.31"] // Allow only this IP
};

acls
  .createAcl(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

acls.getAcl(ref) ⇒ Promise.<Acl>

Retrieves an existing Acl in the Workspace.

Kind: instance method of Acls
Returns: Promise.<Acl> - - The response object that contains the Acl information

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Acl to retrieve |

Example

const acls = new SDK.Acls(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

acls
  .getAcl(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

acls.updateAcl(request) ⇒ Promise.<BaseApiObject>

Updates an existing Acl in the Workspace.

Kind: instance method of Acls
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Acl

| Param | Type | Description | | --- | --- | --- | | request | UpdateAclRequest | The request object that contains the necessary information to update an existing Acl | | request.ref | string | The reference of the Acl to update | | request.name | string | The name of the Acl | | request.allow | Array.<string> | The list of IPs to allow |

Example

const acls = new SDK.Acls(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  name: "My ACL",
  allow: ["47.132.130.31"] // Allow only this IP
};

acls
  .updateAcl(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

acls.listAcls(request) ⇒ Promise.<ListAclsResponse>

Retrieves a list of Acls from a Workspace.

Kind: instance method of Acls
Returns: Promise.<ListAclsResponse> - - The response object that contains the list of Acls

| Param | Type | Description | | --- | --- | --- | | request | ListAclsRequest | The request object that contains the necessary information to retrieve a list of Acls | | request.pageSize | number | The number of Acls to retrieve | | request.pageToken | string | The token to retrieve the next page of Acls |

Example

const acls = new SDK.Acls(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

acls
  .listAcls(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

acls.deleteAcl(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Acl from Fonoster. Note that this operation is irreversible.

Kind: instance method of Acls
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Acl

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Acl to delete |

Example

const acls = new SDK.Acls(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

acls
  .deleteAcl(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Agents

Fonoster Agents, part of the Fonoster SIP Proxy subsystem, allows you to create, update, retrieve, and delete SIP Agents for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Agents(client)

Constructs a new Agents object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const agents = new SDK.Agents(client);
    const response = await agents.createAgent(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "John Doe",
  username: "1001",
  privacy: "PRIVATE",
  enabled: true,
  maxContacts: 3
  domainRef: "00000000-0000-0000-0000-000000000000"
};

main(request);

agents.createAgent(request) ⇒ Promise.<BaseApiObject>

Creates a new Agent in the Workspace.

Kind: instance method of Agents
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Agent

| Param | Type | Description | | --- | --- | --- | | request | CreateAgentRequest | The request object that contains the necessary information to create a new Agent | | request.name | string | The name of the Agent | | request.username | string | The username of the Agent | | request.privacy | Privacy | The privacy of the Agent | | request.enabled | boolean | The status of the Agent | | request.maxContacts | number | The maximum number of contacts the Agent can have | | request.domainRef | string | The reference of the Domain to associate the Agent |

Example

const agents = new SDK.Agents(client); // Existing client object

const request = {
  name: "John Doe",
  username: "1001",
  privacy: "PRIVATE",
  enabled: true,
  maxContacts: 3
  domainRef: "00000000-0000-0000-0000-000000000000"
};

agents
  .createAgent(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

agents.getAgent(ref) ⇒ Promise.<Acl>

Retrieves an existing Agent in the Workspace.

Kind: instance method of Agents
Returns: Promise.<Acl> - - The response object that contains the Agent information

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Agent to retrieve |

Example

const agents = new SDK.Agents(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

agents
  .getAgent(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

agents.updateAgent(request) ⇒ Promise.<BaseApiObject>

Updates an existing Agent in the Workspace.

Kind: instance method of Agents
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Agent

| Param | Type | Description | | --- | --- | --- | | request | UpdateAgentRequest | The request object that contains the necessary information to update an existing Agent | | request.ref | string | The reference of the Agent to update | | request.name | string | The name of the Agent | | request.privacy | Privacy | The privacy of the Agent | | request.enabled | boolean | The status of the Agent | | request.maxContacts | number | The maximum number of contacts the Agent can have | | request.domainRef | string | The reference of the Domain to associate the Agent |

Example

const agents = new SDK.Agents(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  name: "John Doe",
  privacy: "PRIVATE",
  enabled: true,
  maxContacts: 3
  domainRef: "00000000-0000-0000-0000-000000000000"
};

agents
  .updateAgent(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

agents.listAgents(request) ⇒ Promise.<ListAgentsResponse>

Retrieves a list of Agents from a Workspace.

Kind: instance method of Agents
Returns: Promise.<ListAgentsResponse> - - The response object that contains the list of Agents

| Param | Type | Description | | --- | --- | --- | | request | ListAgentsRequest | The request object that contains the necessary information to retrieve a list of Agents | | request.pageSize | number | The number of Agents to retrieve | | request.pageToken | string | The token to retrieve the next page of Agents |

Example

const agents = new SDK.Agents(client); // Existing client object

const request = {
 pageSize: 10,
 pageToken: "00000000-0000-0000-0000-000000000000"
};

agents
  .listAgents(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

agents.deleteAgent(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Agent from Fonoster. Note that this operation is irreversible.

Kind: instance method of Agents
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Agent

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Agent to delete |

Example

const agents = new SDK.Agents(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

agents
  .deleteAgent(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

ApiKeys

Fonoster ApiKeys, part of the Fonoster Identity subsystem, allows you to create, update, retrieve, and delete ApiKeys for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new ApiKeys(client)

Constructs a new ApiKeys object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const apiKeys = new SDK.ApiKeys(client);
    const response = await apiKeys.createApiKey(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  role: "WORKSPACE_ADMIN"
};

main(request);

apiKeys.createApiKey(request) ⇒ Promise.<CreateApiKeyResponse>

Creates a new ApiKey for a Workspace.

Kind: instance method of ApiKeys
Returns: Promise.<CreateApiKeyResponse> - - The response object that contains the reference to the created ApiKey

| Param | Type | Description | | --- | --- | --- | | request | CreateApiKeyRequest | The request object that contains the necessary information to create a new ApiKey | | request.role | Role | The role of the ApiKey |

Example

const apiKeys = new SDK.ApiKeys(client); // Existing client object

const request = {
  role: "WORKSPACE_ADMIN"
};

apiKeys
  .createApiKey(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

apiKeys.regenerateApiKey(ref) ⇒ Promise.<CreateApiKeyResponse>

Regenerates an existing ApiKey for a Workspace. Note that this operation is irreversible.

Kind: instance method of ApiKeys
Returns: Promise.<CreateApiKeyResponse> - - The response object that contains the reference to the regenerated ApiKey

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the ApiKey to regenerate |

Example

const apiKeys = new SDK.ApiKeys(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

apiKeys
  .regenerateApiKey(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

apiKeys.listApiKeys(request) ⇒ Promise.<ListApiKeysResponse>

Retrieves a list of ApiKeys from a Workspace.

Kind: instance method of ApiKeys
Returns: Promise.<ListApiKeysResponse> - - The response object that contains the list of ApiKeys

| Param | Type | Description | | --- | --- | --- | | request | ListApiKeysRequest | The request object that contains the necessary information to retrieve a list of ApiKeys | | request.pageSize | number | The number of ApiKeys to retrieve | | request.pageToken | string | The token to retrieve the next page of ApiKeys |

Example

const apiKeys = new SDK.ApiKeys(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

apiKeys
  .listApiKeys(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

apiKeys.deleteApiKey(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing ApiKey from Fonoster. Note that this operation is irreversible.

Kind: instance method of ApiKeys
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted ApiKey

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the ApiKey to delete |

Example

const apiKeys = new SDK.ApiKeys(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

apiKeys
  .deleteApiKey(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Applications

Fonoster Applications, part of the Fonoster Voice Subsystem, allow you to create, update, retrieve, and delete Voice Applications. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Applications(client)

Constructs a new Applications object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const apps = new SDK.Applications(client);
    const response = await apps.createApplication(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "My application",
  type: "EXTERNAL",
  endpoint: "welcome.demo.fonoster.local", // Built-in demo application
  speechToText: {
    productRef: "stt.deepgram",
    config: {
      model: "nova-2",
      languageCode: "en-US"
    }
  },
  textToSpeech: {
    productRef: "tts.elevenlabs",
    config: {
      voice: "lrTWbMInQjSJ9q5ywFKP"
    }
  }
};

main(request);

applications.createApplication(request) ⇒ Promise.<CreateAppResponse>

Creates a new Application in Fonoster. The only required fields are the name and type of the application.

Kind: instance method of Applications
Returns: Promise.<CreateAppResponse> - - The response object that contains the reference to the newly created application

| Param | Type | Description | | --- | --- | --- | | request | CreateApplicationRequest | The request object that contains the necessary information to create a new application | | request.name | string | The name of the application | | request.type | ApplicationType | The type of application (e.g., EXTERNAL) | | request.endpoint | string | The endpoint where the application is hosted | | request.speechToText | SpeechToText | The speech-to-text configuration | | request.speechToText.productRef | string | The product reference of the speech-to-text engine (e.g., stt.deepgram) | | request.speechToText.config | object | The configuration object for the speech-to-text engine (e.g., { model: "nova-2", languageCode: "en-US" }) | | request.textToSpeech | TextToSpeech | The text-to-speech configuration | | request.textToSpeech.productRef | string | The product reference of the text-to-speech engine (e.g., tts.elevenlabs) | | request.textToSpeech.config | object | The configuration object for the text-to-speech engine (e.g., { voice: "lrTWbMInQjSJ9q5ywFKP" }) | | request.intelligence | Intelligence | The intelligence configuration | | request.intelligence.productRef | string | The product reference of the intelligence engine (e.g., llm.groq) | | request.intelligence.config | object | The configuration object for the intelligence engine |

Example

const apps = new SDK.Applications(client); // Existing client object

const request = {
  name: "My application",
  type: "EXTERNAL",
  endpoint: "welcome.demo.fonoster.local", // Built-in demo application
  speechToText: {
    productRef: "stt.deepgram",
    config: {
      languageCode: "en-US"
    }
  },
  textToSpeech: {
    productRef: "tts.elevenlabs",
    config: {
      voice: "lrTWbMInQjSJ9q5ywFKP"
    }
  }
};

apps
  .createApplication(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

applications.getApplication(ref) ⇒ Promise.<Application>

Retrieves an existing Application in the Workspace.

Kind: instance method of Applications
Returns: Promise.<Application> - - The response object that contains the Application information

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Application to retrieve |

Example

const apps = new SDK.Applications(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

apps
  .getApplication(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

applications.updateApplication(request) ⇒ Promise.<BaseApiObject>

Updates an existing application in Fonoster.

Kind: instance method of Applications
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated application

| Param | Type | Description | | --- | --- | --- | | request | UpdateApplicationRequest | The request object that contains the necessary information to update an application | | request.ref | string | The reference of the application to update | | request.name | string | The name of the application | | request.endpoint | string | The endpoint where the application is hosted | | request.speechToText | SpeechToText | The speech-to-text configuration | | request.speechToText.productRef | string | The product reference of the speech-to-text engine (e.g., stt.deepgram) | | request.speechToText.config | object | The configuration object for the speech-to-text engine (e.g., { model: "nova-2", languageCode: "en-US" }) | | request.textToSpeech | TextToSpeech | The text-to-speech configuration | | request.textToSpeech.productRef | string | The product reference of the text-to-speech engine (e.g., tts.elevenlabs) | | request.textToSpeech.config | object | The configuration object for the text-to-speech engine (e.g., { voice: "lrTWbMInQjSJ9q5ywFKP" }) | | request.intelligence | Intelligence | The intelligence configuration | | request.intelligence.productRef | string | The product reference of the intelligence engine (e.g., llm.groq) | | request.intelligence.config | object | The configuration object for the intelligence engine |

Example

const apps = new SDK.Applications(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  name: "My application",
  endpoint: "welcome.demo.fonoster.local", // Built-in demo application
};

apps
  .updateApplication(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

applications.listApplications(request) ⇒ Promise.<ListApplicationsResponse>

Retrieves a list of Applications from Fonoster.

Kind: instance method of Applications
Returns: Promise.<ListApplicationsResponse> - - The response object that contains the list of Applications

| Param | Type | Description | | --- | --- | --- | | request | ListApplicationsRequest | The request object that contains the necessary information to retrieve a list of Applications | | request.pageSize | number | The number of Applications to retrieve | | request.pageToken | string | The token to retrieve the next page of Applications |

Example

const apps = new SDK.Applications(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

apps
  .listApplications(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

applications.deleteApplication(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Application from Fonoster. Note that this operation is irreversible.

Kind: instance method of Applications
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted application

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Application to delete |

Example

const apps = new SDK.Applications(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

apps
  .deleteApplication(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

applications.evaluateIntelligence(request) ⇒ Promise.<ScenarioEvaluationReport>

Evaluates the intelligence of an application.

Kind: instance method of Applications
Returns: Promise.<ScenarioEvaluationReport> - - The response object that contains the evaluation report

| Param | Type | Description | | --- | --- | --- | | request | EvaluateIntelligenceRequest | The request object that contains the necessary information to evaluate the intelligence of an application | | request.intelligence.productRef | string | The product reference of the intelligence engine (e.g., llm.groq) | | request.intelligence.config | object | The configuration object for the intelligence engine |

Example

const apps = new SDK.Applications(client); // Existing client object

const request = {
  intelligence: {
    productRef: "llm.groq",
    config: {
      conversationSettings: {
        firstMessage: "Hello, how can I help you today?",
        systemPrompt: "You are a helpful assistant.",
        systemErrorMessage: "I'm sorry, I didn't catch that. Can you say that again?",
        goodbyeMessage: "Thank you for calling. Have a great day!",
        languageModel: {
          provider: "openai",
          model: "gpt-4o"
        },
        testCases: {
          evalsLanguageModel: {
            provider: "openai",
            model: "gpt-4o"
          },
          scenarios: [
            {
              ref: "Scenario 1",
              description: "Scenario 1 description",
              telephonyContext: {
                callDirection: "FROM_PSTN",
                ingressNumber: "1234567890",
                callerNumber: "1234567890"
              },
              conversation: [
                {
                  userInput: "Hello, how can I help you today?",
                  expected: {
                    text: {
                      type: "EXACT",
                      response: "Hello, how can I help you today?"
                    }
                  }
                }
              ]
            }
          ]
        }
      }
    }
  }
};

apps
  .evaluateIntelligence(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Calls

Fonoster Calls, part of the Fonoster Media subsystem, allows you to create, list, and track calls in your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Calls(client)

Constructs a new Calls object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const calls = new SDK.Calls(client);
    const response = await calls.createCall(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  from: "+18287854037",
  to: "+17853178070",
  appRef: "00000000-0000-0000-0000-000000000000"
};

main(request);

calls.createCall(request) ⇒ Object

Creates a new Call in the Workspace.

Kind: instance method of Calls
Returns: Object - - The response object that contains the Call reference and a stream of status updates
See: DialStatus

| Param | Type | Description | | --- | --- | --- | | request | CreateCallRequest | The request object that contains the necessary information to create a new Call | | request.from | string | The number that originated the call | | request.to | string | The number that received the call | | request.appRef | string | The reference of the App that will handle the call | | request.timeout | number | The time in seconds to wait for the call to be answered. Default is 60 seconds | | request.metadata | Record.<string, string> | Optional metadata to be sent to the App. For Autopilot applications, this is added to the context of the conversation. |

Example

const calls = new SDK.Calls(client); // Existing client object

const request = {
  from: "+18287854037",
  to: "+17853178070",
  appRef: "00000000-0000-0000-0000-000000000000",
  timeout: 30,
  metadata: {
    "name": "John Doe",
    "preferredLanguage": "en-US"
  }
};

const response = await calls.createCall(request);
const { ref, statusStream } = response;

console.log(ref); // Call reference

for await (const status of statusStream) {
 console.log(status); // Streamed status
}

calls.getCall(ref) ⇒ Promise.<CallDetailRecord>

Retrieves an existing Call in the Workspace.

Kind: instance method of Calls
Returns: Promise.<CallDetailRecord> - - The response object that contains the Call detail

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Call to retrieve |

Example

const calls = new SDK.Calls(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

calls
  .getCall(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

calls.listCalls(request) ⇒ Promise.<ListCallsResponse>

Retrieves a list of Calls from a Workspace.

Kind: instance method of Calls
Returns: Promise.<ListCallsResponse> - - The response object that contains the list of Calls

| Param | Type | Description | | --- | --- | --- | | request | ListCallsRequest | The request object that contains the necessary information to retrieve a list of Calls | | request.pageSize | number | The number of Calls to retrieve | | request.pageToken | string | The token to retrieve the next page of Calls |

Example

const calls = new SDK.Calls(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

calls
  .listCalls(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Credentials

Fonoster Credentials, part of the Fonoster SIP Proxy subsystem, allows you to create, update, retrieve, and delete SIP Credentials for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Credentials(client)

Constructs a new Credentials object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const credentials = new SDK.Credentials(client);
    const response = await apiKeys.createCredentials(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "My Credentials",
  username: "myusername",
  password: "mysecret"
};

main(request);

credentials.createCredentials(request) ⇒ Promise.<BaseApiObject>

Creates a new set of Credentials in the Workspace.

Kind: instance method of Credentials
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Credentials

| Param | Type | Description | | --- | --- | --- | | request | CreateCredentialsRequest | The request object that contains the necessary information to create a new set of Credentials | | request.name | string | The name of the Credentials | | request.username | string | The username of the Credentials | | request.password | string | The password of the Credentials |

Example

const credentials = new SDK.Credentials(client); // Existing client object

const request = {
  name: "My Credentials",
  username: "myusername",
  password: "mysecret"
};

credentials
  .createCredentials(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

credentials.getCredentials(ref) ⇒ Promise.<Acl>

Retrieves an existing set of Credentials in the Workspace.

Kind: instance method of Credentials
Returns: Promise.<Acl> - - The response object that contains the Credentials

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Credentials to retrieve |

Example

const credentials = new SDK.Credentials(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

credentials
  .getCredentials(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

credentials.updateCredentials(request) ⇒ Promise.<BaseApiObject>

Updates an existing set of Credentials in the Workspace.

Kind: instance method of Credentials
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Credentials

| Param | Type | Description | | --- | --- | --- | | request | UpdateCredentialsRequest | The request object that contains the necessary information to update an existing set of Credentials | | request.ref | string | The reference of the Credentials to update | | request.name | string | The name of the Credentials | | request.password | string | The password of the Credentials |

Example

const credentials = new SDK.Credentials(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  name: "My Credentials",
  password: "mysecret"
};

credentials
   .updateCredentials(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

credentials.listCredentials(request) ⇒ Promise.<ListCredentialsResponse>

Retrieves a list of Credentials from a Workspace.

Kind: instance method of Credentials
Returns: Promise.<ListCredentialsResponse> - - The response object that contains the list of Credentials

| Param | Type | Description | | --- | --- | --- | | request | ListCredentialsRequest | The request object that contains the necessary information to retrieve a list of Credentials | | request.pageSize | number | The number of Credentials to retrieve | | request.pageToken | string | The token to retrieve the next page of Credentials |

Example

const credentials = new SDK.Credentials(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

credentials
  .listCredentials(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

credentials.deleteCredentials(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing set of Credentials from Fonoster. Note that this operation is irreversible.

Kind: instance method of Credentials
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Credentials

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Credentials to delete |

Example

const credentials = new SDK.Credentials(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

credentials
  .deleteCredentials(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Domains

Fonoster Domains, part of the Fonoster SIP Proxy subsystem, allows you to create, update, retrieve, and delete SIP Domain for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Domains(client)

Constructs a new Domains object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const domains = new SDK.Domains(client);
    const response = await domains.createDomain(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "My Domain",
  domainUri: "sip.project.fonoster.io"
};

main(request);

domains.createDomain(request) ⇒ Promise.<BaseApiObject>

Creates a new Domain in the Workspace.

Kind: instance method of Domains
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Domain

| Param | Type | Description | | --- | --- | --- | | request | CreateDomainRequest | The request object that contains the necessary information to create a new Domain | | request.name | string | The name of the Domain | | request.domainUri | string | The URI of the Domain | | request.accessControlListRef | AccessControlListRef | The reference to the Access Control List (ACL) to associate with the Domain | | request.egressPolicy | Array.<EgressPolicy> | The egress policy of the Domain | | request.egressPolicy[].rule | string | A regular expression that defines which calls to send to the PSTN | | request.egressPolicy[].numberRef | string | The Number that will be used to send the call to the PSTN |

Example

const domains = new SDK.Domains(client); // Existing client object

const request = {
  name: "My Domain",
  domainUri: "sip.project.fonoster.io"
};

domains
  .createDomain(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

domains.getDomain(ref) ⇒ Promise.<Acl>

Retrieves an existing Domain in the Workspace.

Kind: instance method of Domains
Returns: Promise.<Acl> - - The response object that contains the Domain

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Domain to retrieve |

Example

const domains = new SDK.Domains(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

domains
  .getDomain(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

domains.updateDomain(request) ⇒ Promise.<BaseApiObject>

Updates an existing Domain in the Workspace.

Kind: instance method of Domains
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Domain

| Param | Type | Description | | --- | --- | --- | | request | UpdateDomainRequest | The request object that contains the necessary information to update an existing Domain | | request.ref | string | The reference of the Domain to update | | request.name | string | The name of the Domain | | request.domainUri | string | The URI of the Domain | | request.accessControlListRef | AccessControlListRef | The reference to the Access Control List (ACL) to associate with the Domain | | request.egressPolicy | Array.<EgressPolicy> | The egress policy of the Domain | | request.egressPolicy[].rule | string | A regular expression that defines which calls to send to the PSTN | | request.egressPolicy[].numberRef | string | The Number that will be used to send the call to the PSTN |

Example

const domains = new SDK.Domains(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  accessControlListRef: "00000000-0000-0000-0000-000000000001"
};

domains
  .updateDomain(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

domains.listDomains(request) ⇒ Promise.<ListDomainsResponse>

Retrieves a list of Domains from a Workspace.

Kind: instance method of Domains
Returns: Promise.<ListDomainsResponse> - - The response object that contains the list of Domains

| Param | Type | Description | | --- | --- | --- | | request | ListDomainsRequest | The request object that contains the necessary information to retrieve a list of Domains | | request.pageSize | number | The number of Domains to retrieve | | request.pageToken | string | The token to retrieve the next page of Domains |

Example

const domains = new SDK.Domains(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

domains
  .listDomains(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

domains.deleteDomain(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Domain from Fonoster. Note that this operation is irreversible.

Kind: instance method of Domains
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Domain

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Domain to delete |

Example

const domains = new SDK.Domains(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

domains
  .deleteDomain(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Numbers

Fonoster Numbers, part of the Fonoster SIP Proxy subsystem, allows you to create, update, retrieve, and delete SIP Number for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Numbers(client)

Constructs a new Numbers object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const numbers = new SDK.Numbers(client);
    const response = await numbers.createNumber(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "My Number",
  telUrl: "tel:+17853178070",
  city: "Asheville",
  country: "United States",
  countryIsoCode: "US"
};

main(request);

numbers.createNumber(request) ⇒ Promise.<BaseApiObject>

Creates a new Number in the Workspace.

Kind: instance method of Numbers
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Number

| Param | Type | Description | | --- | --- | --- | | request | CreateNumberRequest | The request object that contains the necessary information to create a new Number | | request.name | string | The name of the Number | | request.telUrl | string | The telUrl of the Number | | request.city | string | The city of the Number | | request.country | string | The country of the Number | | request.countryIsoCode | string | The countryIsoCode of the Number |

Example

const numbers = new SDK.Numbers(client); // Existing client object

const request = {
  name: "My Number",
  telUrl: "tel:+17853178070",
  city: "Asheville",
  country: "United States",
  countryIsoCode: "US"
};

numbers
  .createNumber(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

numbers.getNumber(ref) ⇒ Promise.<Acl>

Retrieves an existing Number in the Workspace.

Kind: instance method of Numbers
Returns: Promise.<Acl> - - The response object that contains the Number

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Number to retrieve |

Example

const numbers = new SDK.Numbers(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

numbers
  .getNumber(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

numbers.updateNumber(request) ⇒ Promise.<BaseApiObject>

Updates an existing Number in the Workspace.

Kind: instance method of Numbers
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Number

| Param | Type | Description | | --- | --- | --- | | request | UpdateNumberRequest | The request object that contains the necessary information to update an existing Number | | request.ref | string | The reference of the Number to update | | request.name | string | The name of the Number |

Example

const numbers = new SDK.Numbers(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  name: "My Number"
};

numbers
  .updateNumber(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

numbers.listNumbers(request) ⇒ Promise.<ListNumbersResponse>

Retrieves a list of Numbers from a Workspace.

Kind: instance method of Numbers
Returns: Promise.<ListNumbersResponse> - - The response object that contains the list of Numbers

| Param | Type | Description | | --- | --- | --- | | request | ListNumbersRequest | The request object that contains the necessary information to retrieve a list of Numbers | | request.pageSize | number | The number of Numbers to retrieve | | request.pageToken | string | The token to retrieve the next page of Numbers |

Example

const numbers = new SDK.Numbers(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

numbers
  .listNumbers(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

numbers.deleteNumber(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Number from Fonoster. Note that this operation is irreversible.

Kind: instance method of Numbers
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Number

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Number to delete |

Example

const numbers = new SDK.Numbers(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

numbers
  .deleteNumber(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Secrets

Fonoster Secrets, part of the Fonoster Core, allows you to create, update, retrieve, and delete Secrets for your deployment. Note that an active Fonoster deployment is required.

Kind: global class
See

  • AbstractClient
  • FonosterClient

new Secrets(client)

Constructs a new Secrets object.

| Param | Type | Description | | --- | --- | --- | | client | FonosterClient | Client object with underlying implementations to make requests to Fonoster's API |

Example

const SDK = require("@fonoster/sdk");

async function main(request) {
  const apiKey = "your-api-key";
  const apiSecret = "your-api-secret"
  const accessKeyId = "WO00000000000000000000000000000000";

  try {
    const client = SDK.Client({ accessKeyId });
    await client.loginWithApiKey(apiKey, apiSecret);

    const secrets = new SDK.Secrets(client);
    const response = await secrets.creteSecret(request);

    console.log(response); // successful response
  } catch (e) {
    console.error(e); // an error occurred
  }
}

const request = {
  name: "FRIENDLY_NAME",
  secret: "mysecret"
};

main(request);

secrets.createSecret(request) ⇒ Promise.<BaseApiObject>

Creates a new Secret in the Workspace.

Kind: instance method of Secrets
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the created Secret

| Param | Type | Description | | --- | --- | --- | | request | CreateSecretRequest | The request object that contains the necessary information to create a new Secret | | request.name | string | The name of the Secret | | request.secret | string | The secret of the Secret |

Example

const secrets = new SDK.Secrets(client); // Existing client object

const request = {
  name: "FRIENDLY_NAME",
  secret: "mysecret"
};

secrets
  .createSecret(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

secrets.getSecret(ref) ⇒ Promise.<Acl>

Retrieves an existing Secret in the Workspace.

Kind: instance method of Secrets
Returns: Promise.<Acl> - - The response object that contains the Secret

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Secret to retrieve |

Example

const secrets = new SDK.Secrets(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

secrets
  .getSecret(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

secrets.updateSecret(request) ⇒ Promise.<BaseApiObject>

Updates an existing Secret in the Workspace.

Kind: instance method of Secrets
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the updated Secret

| Param | Type | Description | | --- | --- | --- | | request | UpdateSecretRequest | The request object that contains the necessary information to update an existing Secret | | request.ref | string | The reference of the Secret to update | | request.name | string | The name of the Secret | | request.secret | string | The secret of the Secret |

Example

const secrets = new SDK.Secrets(client); // Existing client object

const request = {
  ref: "00000000-0000-0000-0000-000000000000",
  secret: "mysecret"
};

secrets
  .updateSecret(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

secrets.listSecrets(request) ⇒ Promise.<ListSecretsResponse>

Retrieves a list of Secrets from a Workspace.

Kind: instance method of Secrets
Returns: Promise.<ListSecretsResponse> - - The response object that contains the list of Secrets

| Param | Type | Description | | --- | --- | --- | | request | ListSecretsRequest | The request object that contains the necessary information to retrieve a list of Secrets | | request.pageSize | number | The secret of Secrets to retrieve | | request.pageToken | string | The token to retrieve the next page of Secrets |

Example

const secrets = new SDK.Secrets(client); // Existing client object

const request = {
  pageSize: 10,
  pageToken: "00000000-0000-0000-0000-000000000000"
};

secrets
  .listSecrets(request)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

secrets.deleteSecret(ref) ⇒ Promise.<BaseApiObject>

Deletes an existing Secret from Fonoster. Note that this operation is irreversible.

Kind: instance method of Secrets
Returns: Promise.<BaseApiObject> - - The response object that contains the reference to the deleted Secret

| Param | Type | Description | | --- | --- | --- | | ref | string | The reference of the Secret to delete |

Example

const secrets = new SDK.Secrets(client); // Existing client object

const ref = "00000000-0000-0000-0000-000000000000";

secrets
  .deleteSecret(ref)
  .then(console.log) // successful response
  .catch(console.error); // an error occurred

Trunks

Fonoster