@freeclimb/sdk
TypeScript icon, indicating that this package has built-in type declarations

3.5.4 • Public • Published

@freeclimb/sdk

@freeclimb/sdk - the NodeJS client package for the FreeClimb API

FreeClimb is a cloud-based application programming interface (API) that puts the power of the Vail platform in your hands. FreeClimb simplifies the process of creating applications that can use a full range of telephony features without requiring specialized or on-site telephony equipment. Using the FreeClimb REST API to write applications is easy! You have the option to use the language of your choice or hit the API directly. Your application can execute a command by issuing a RESTful request to the FreeClimb API. The base URL to send HTTP requests to the FreeClimb REST API is: /apiserver. FreeClimb authenticates and processes your request.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version:
  • Build package: org.openapitools.codegen.languages.TypeScriptClientCodegen For more information, please visit https://www.freeclimb.com/support/

Installing

npm install @freeclimb/sdk@3.5.4
or 
yarn add @freeclimb/sdk@3.5.4

Getting Started

import freeclimb from '@freeclimb/sdk';

const configuration = freeclimb.createConfiguration({
  accountId: 'YOUR_ACCOUND_ID',
  apiKey: 'YOUR_API_KEY'
});
const apiInstance = new freeclimb.DefaultApi(configuration);

apiInstance.listApplications().then(applications => console.log('got applications', applications))

Detailed SDK documentation

For more details on how to use the individual methods on the sdk - go here

Using PerCL

The Performance Command Language (PerCL) defines a set of instructions, written in JSON format, that express telephony actions to be performed in response to an event on the FreeClimb platform. FreeClimb communicates with the application server when events associated with the application occur, so the webserver can instruct FreeClimb how to handle such events using PerCL scripts. PerCL commands are a part of the model schema and can be serialized into JSON like so:

import { Say, Play, GetDigits, PerclScript } from '@freeclimb/sdk'

const say = new Say({ text: 'Hello, World' })
const play = new Play({ file: "Example File" })
const getDigits = new GetDigits({ actionUrl: "Example Action URL", prompts: [say, play] })
const perclScript = new PerclScript({ commands: [getDigits] })

console.log(perclScript.toJSON())

Documentation for verifying request signature

  • To verify the request signature, we will need to use the verifyRequestSignature method within the Request Verifier class

    RequestVerifier.verifyRequestSignature(requestBody, requestHeader, signingSecret, tolerance)

    This is a method that you can call directly from the request verifier class, it will throw exceptions depending on whether all parts of the request signature is valid otherwise it will throw a specific error message depending on which request signature part is causing issues

    This method requires a requestBody of type string, a requestHeader of type string, a signingSecret of type string, and a tolerance value of type number

    Example code down below

    import { RequestVerifier } from "./utils/RequestVerifier";
    
    export function RequestVerifierExample() {
      const tolerance: number = 5 * 60;
    
      const requestBody: string = '{"accountId":"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c","callId":"CAccb0b00506553cda09b51c5477f672a49e0b2213","callStatus":"ringing","conferenceId":null,"direction":"inbound","from":"+13121000109","parentCallId":null,"queueId":null,"requestType":"inboundCall","to":"+13121000096"}';
    
      const signingSecret: string = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7793";
    
      const requestHeader: string = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8";
      
      RequestVerifier.verifyRequestSignature(
        requestBody,
        requestHeader,
        signingSecret,
        tolerance
      );
    }

Package Sidebar

Install

npm i @freeclimb/sdk

Weekly Downloads

107

Version

3.5.4

License

MIT

Unpacked Size

2.32 MB

Total Files

639

Last publish

Collaborators

  • fsanfilipp
  • freeclimb-team