Skip to main content

Libraries and SDKs

SignalWire has clients in a number of different languages that make using the SignalWire Compatibility API possible with your existing application. They are also built to make migrating from other service providers to SignalWire quick and easy.

The Compatibility SDK has two primary namespaces:

  • REST Client namespace: SignalWire maintains SDKs in popular languages for the Compatibility REST Client. These SDKs streamline the process of requests to the REST API endpoints from within your application.
  • cXML namespace: The cXML namespace of the Compatibility SDK does not directly make API calls. Instead, these SDKs or libraries work as simple XML builders that enable you to easily generate cXML within your language of choice. This XML is generated in a single string which SignalWire's servers parse. Learn more by reading our guide to the cXML Specification.

Installing the SDK and Initializing the Client

Installing the SDK

Install the package using NPM:

npm install @signalwire/compatibility-api

Initializing the Client

In order to use the NodeJS client, you must get your Space URL, Project ID, and API Token from your SignalWire Dashboard and initialize the client:

const { RestClient } = require("@signalwire/compatibility-api");

const client = RestClient(
"your-project",
"your-token",
{ signalwireSpaceUrl: "example.signalwire.com" }
);

// You can then use client to make calls, send messages, and more.

Using Environment Variables

Alternatively, you can use an environment variable to pass the Space URL:

  SIGNALWIRE_SPACE_URL=example.signalwire.com

With this approach, signalwireSpaceUrl will be pulled from the .env file instead of having to be passed as an argument:

  const { RestClient } = require("@signalwire/compatibility-api");

const client = RestClient(
"your-project",
"your-token"
);

Migrating from Twilio

You can easily migrate from Twilio with minimal changes.

To get started, you will need to replace the Twilio client with the SignalWire client and update the from number to a valid SignalWire number.

Make sure to change the "From" number!

When migrating to SignalWire, make sure to replace the from numbers with a valid SignalWire number.

// Replace these lines:
const twilio = require('twilio')
const response = new twilio.twiml.VoiceResponse()

// With:
const { RestClient } = require('@signalwire/compatibility-api')
const response = new RestClient.LaML.VoiceResponse()

// Now use response like you did before!
response.say('Hey, welcome to SignalWire!')
THE API FORMERLY KNOWN AS LĀML

The Compatibility API and cXML were previously known as "LāML". laml still appears in endpoint URLs, and the cXML namespace of the REST Client is still titled LaML. Don't worry, it's all cXML!