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.
For more information, please visit https://www.freeclimb.com/support/.
PHP 7.3 and later. Should also work with PHP 8.0 but has not been tested.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://https://github.com/freeclimbapi/php-sdk.git"
}
],
"require": {
"freeclimbapi/php-sdk": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/FreeClimbAPI/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: fc
$config = FreeClimb\Api\Configuration::getDefaultConfiguration()
->setUsername('YOUR_ACCOUNT_ID')
->setPassword('YOUR_API_KEY');
$apiInstance = new FreeClimb\Api\Api\DefaultApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$buy_incoming_number_request = new \FreeClimb\Api\Model\BuyIncomingNumberRequest(); // \FreeClimb\Api\Model\BuyIncomingNumberRequest | Incoming Number transaction details
try {
$result = $apiInstance->buyAPhoneNumber($buy_incoming_number_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DefaultApi->buyAPhoneNumber: ', $e->getMessage(), PHP_EOL;
}
The PerclScript class provides a convenient wrapper to handle PerCL generation in your responses. Simply execute json_encode
with an instance of the PerclScript
class and you will have PerclCommands
serialized and formatted the way you need.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$say = new \FreeClimb\Api\Model\Say();
$sms = new \FreeClimb\Api\Model\Sms();
$script = new \FreeClimb\Api\Model\PerclScript();
$say->setText("hello world");
$sms->setFrom("from number");
$sms->setTo("to number");
$sms->setText("hello world SMS");
$script->setCommands(array($say, $sms));
json_encode($script);
/**
* [
* {
* "Say": {
* "text": "hello world"
* }
* },
* {
* "Sms": {
* "from": "from number",
* "to": "to number",
* "text": "hello world SMS"
* }
* }
* ]
*/
?>
All URIs are relative to https://www.freeclimb.com/apiserver
Class | Method | HTTP request | Description |
---|---|---|---|
DefaultApi | buyAPhoneNumber | POST /Accounts/{accountId}/IncomingPhoneNumbers | Buy a Phone Number |
DefaultApi | createAConference | POST /Accounts/{accountId}/Conferences | Create a Conference |
DefaultApi | createAQueue | POST /Accounts/{accountId}/Queues | Create a Queue |
DefaultApi | createAnApplication | POST /Accounts/{accountId}/Applications | Create an application |
DefaultApi | deleteARecording | DELETE /Accounts/{accountId}/Recordings/{recordingId} | Delete a Recording |
DefaultApi | deleteAnApplication | DELETE /Accounts/{accountId}/Applications/{applicationId} | Delete an application |
DefaultApi | deleteAnIncomingNumber | DELETE /Accounts/{accountId}/IncomingPhoneNumbers/{phoneNumberId} | Delete an Incoming Number |
DefaultApi | dequeueAMember | POST /Accounts/{accountId}/Queues/{queueId}/Members/{callId} | Dequeue a Member |
DefaultApi | dequeueHeadMember | POST /Accounts/{accountId}/Queues/{queueId}/Members/Front | Dequeue Head Member |
DefaultApi | downloadARecordingFile | GET /Accounts/{accountId}/Recordings/{recordingId}/Download | Download a Recording File |
DefaultApi | filterLogs | POST /Accounts/{accountId}/Logs | Filter Logs |
DefaultApi | getACall | GET /Accounts/{accountId}/Calls/{callId} | Get a Call |
DefaultApi | getAConference | GET /Accounts/{accountId}/Conferences/{conferenceId} | Get a Conference |
DefaultApi | getAMember | GET /Accounts/{accountId}/Queues/{queueId}/Members/{callId} | Get a Member |
DefaultApi | getAParticipant | GET /Accounts/{accountId}/Conferences/{conferenceId}/Participants/{callId} | Get a Participant |
DefaultApi | getAQueue | GET /Accounts/{accountId}/Queues/{queueId} | Get a Queue |
DefaultApi | getARecording | GET /Accounts/{accountId}/Recordings/{recordingId} | Get a Recording |
DefaultApi | getAnAccount | GET /Accounts/{accountId} | Get an Account |
DefaultApi | getAnApplication | GET /Accounts/{accountId}/Applications/{applicationId} | Get an Application |
DefaultApi | getAnIncomingNumber | GET /Accounts/{accountId}/IncomingPhoneNumbers/{phoneNumberId} | Get an Incoming Number |
DefaultApi | getAnSmsMessage | GET /Accounts/{accountId}/Messages/{messageId} | Get an SMS Message |
DefaultApi | getHeadMember | GET /Accounts/{accountId}/Queues/{queueId}/Members/Front | Get Head Member |
DefaultApi | getTenDLCSmsBrand | GET /Accounts/{accountId}/Messages/10DLC/Brands/{brandId} | Get a 10DLC SMS Brand |
DefaultApi | getTenDLCSmsBrands | GET /Accounts/{accountId}/Messages/10DLC/Brands | Get list of SMS 10DLC Brands |
DefaultApi | getTenDLCSmsCampaign | GET /Accounts/{accountId}/Messages/10DLC/Campaigns/{campaignId} | Get a 10DLC SMS Campaign |
DefaultApi | getTenDLCSmsCampaigns | GET /Accounts/{accountId}/Messages/10DLC/Campaigns | Get list of SMS 10DLC Campaigns |
DefaultApi | getTenDLCSmsPartnerCampaign | GET /Accounts/{accountId}/Messages/10DLC/PartnerCampaigns/{campaignId} | Get a 10DLC SMS Partner Campaign |
DefaultApi | getTenDLCSmsPartnerCampaigns | GET /Accounts/{accountId}/Messages/10DLC/PartnerCampaigns | Get list of SMS 10DLC Partner Campaigns |
DefaultApi | listActiveQueues | GET /Accounts/{accountId}/Queues | List Active Queues |
DefaultApi | listAllAccountLogs | GET /Accounts/{accountId}/Logs | List All Account Logs |
DefaultApi | listApplications | GET /Accounts/{accountId}/Applications | List applications |
DefaultApi | listAvailableNumbers | GET /AvailablePhoneNumbers | List available numbers |
DefaultApi | listCallLogs | GET /Accounts/{accountId}/Calls/{callId}/Logs | List Call Logs |
DefaultApi | listCallRecordings | GET /Accounts/{accountId}/Calls/{callId}/Recordings | List Call Recordings |
DefaultApi | listCalls | GET /Accounts/{accountId}/Calls | List Calls |
DefaultApi | listConferences | GET /Accounts/{accountId}/Conferences | List Conferences |
DefaultApi | listIncomingNumbers | GET /Accounts/{accountId}/IncomingPhoneNumbers | List Incoming Numbers |
DefaultApi | listMembers | GET /Accounts/{accountId}/Queues/{queueId}/Members | List Members |
DefaultApi | listParticipants | GET /Accounts/{accountId}/Conferences/{conferenceId}/Participants | List Participants |
DefaultApi | listRecordings | GET /Accounts/{accountId}/Recordings | List Recordings |
DefaultApi | listSmsMessages | GET /Accounts/{accountId}/Messages | List SMS Messages |
DefaultApi | makeACall | POST /Accounts/{accountId}/Calls | Make a Call |
DefaultApi | removeAParticipant | DELETE /Accounts/{accountId}/Conferences/{conferenceId}/Participants/{callId} | Remove a Participant |
DefaultApi | sendAnSmsMessage | POST /Accounts/{accountId}/Messages | Send an SMS Message |
DefaultApi | streamARecordingFile | GET /Accounts/{accountId}/Recordings/{recordingId}/Stream | Stream a Recording File |
DefaultApi | updateAConference | POST /Accounts/{accountId}/Conferences/{conferenceId} | Update a Conference |
DefaultApi | updateALiveCall | POST /Accounts/{accountId}/Calls/{callId} | Update a Live Call |
DefaultApi | updateAParticipant | POST /Accounts/{accountId}/Conferences/{conferenceId}/Participants/{callId} | Update a Participant |
DefaultApi | updateAQueue | POST /Accounts/{accountId}/Queues/{queueId} | Update a Queue |
DefaultApi | updateAnAccount | POST /Accounts/{accountId} | Manage an account |
DefaultApi | updateAnApplication | POST /Accounts/{accountId}/Applications/{applicationId} | Update an application |
DefaultApi | updateAnIncomingNumber | POST /Accounts/{accountId}/IncomingPhoneNumbers/{phoneNumberId} | Update an Incoming Number |
- AccountRequest
- AccountResult
- AccountResultAllOf
- AccountStatus
- AccountType
- AddToConference
- AddToConferenceAllOf
- AnsweredBy
- ApplicationList
- ApplicationListAllOf
- ApplicationRequest
- ApplicationResult
- ApplicationResultAllOf
- AvailableNumber
- AvailableNumberList
- AvailableNumberListAllOf
- BuyIncomingNumberRequest
- CallDirection
- CallList
- CallListAllOf
- CallResult
- CallResultAllOf
- CallStatus
- Capabilities
- ConferenceList
- ConferenceListAllOf
- ConferenceParticipantList
- ConferenceParticipantListAllOf
- ConferenceParticipantResult
- ConferenceParticipantResultAllOf
- ConferenceResult
- ConferenceResultAllOf
- ConferenceStatus
- CreateConference
- CreateConferenceAllOf
- CreateConferenceRequest
- Dequeue
- Enqueue
- EnqueueAllOf
- FilterLogsRequest
- GetDigits
- GetDigitsAllOf
- GetSpeech
- GetSpeechAllOf
- GetSpeechReason
- GrammarFileBuiltIn
- GrammarType
- Hangup
- HangupAllOf
- IfMachine
- IncomingNumberList
- IncomingNumberListAllOf
- IncomingNumberRequest
- IncomingNumberResult
- IncomingNumberResultAllOf
- Language
- LogLevel
- LogList
- LogListAllOf
- LogResult
- MachineType
- MakeCallRequest
- MessageDirection
- MessageRequest
- MessageRequestAllOf
- MessageResult
- MessageResultAllOf
- MessageStatus
- MessagesList
- MessagesListAllOf
- MutableResourceModel
- OutDial
- OutDialAllOf
- PaginationModel
- Park
- ParkAllOf
- Pause
- PauseAllOf
- PerclCommand
- PerclScript
- Play
- PlayAllOf
- PlayBeep
- PlayEarlyMedia
- PlayEarlyMediaAllOf
- QueueList
- QueueListAllOf
- QueueMember
- QueueMemberList
- QueueMemberListAllOf
- QueueRequest
- QueueResult
- QueueResultAllOf
- QueueResultStatus
- RecordUtterance
- RecordUtteranceAllOf
- RecordUtteranceTermReason
- RecordingList
- RecordingListAllOf
- RecordingResult
- RecordingResultAllOf
- Redirect
- RedirectAllOf
- Reject
- RejectAllOf
- RemoveFromConference
- RemoveFromConferenceAllOf
- RequestType
- SMSTenDLCBrand
- SMSTenDLCBrandsListResult
- SMSTenDLCBrandsListResultAllOf
- SMSTenDLCCampaign
- SMSTenDLCCampaignsListResult
- SMSTenDLCCampaignsListResultAllOf
- SMSTenDLCPartnerCampaign
- SMSTenDLCPartnerCampaignBrand
- SMSTenDLCPartnerCampaignsListResult
- SMSTenDLCPartnerCampaignsListResultAllOf
- Say
- SayAllOf
- SendDigits
- SendDigitsAllOf
- SetListen
- SetListenAllOf
- SetTalk
- SetTalkAllOf
- Sms
- SmsAllOf
- StartRecordCall
- TerminateConference
- TerminateConferenceAllOf
- TranscribeUtterance
- TranscribeUtteranceRecord
- Unpark
- UpdateCallRequest
- UpdateCallRequestStatus
- UpdateConferenceParticipantRequest
- UpdateConferenceRequest
- UpdateConferenceRequestStatus
- Type: HTTP basic authentication
To run the tests, use:
composer install
vendor/bin/phpunit
-
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 int
Example code down below
<?php namespace FreeClimb\Example; use FreeClimb\Api\Util\RequestVerifier; class Example { public function verifyRequestSignatureExample() { $tolerance = 5 * 60; $requestHeader = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"; $requestBody = "{\"accountId\":\"AC1334ffb694cd8d969f51cddf5f7c9b478546d50c\",\"callId\":\"CAccb0b00506553cda09b51c5477f672a49e0b2213\",\"callStatus\":\"ringing\",\"conferenceId\":null,\"direction\":\"inbound\",\"from\":\"+13121000109\",\"parentCallId\":null,\"queueId\":null,\"requestType\":\"inboundCall\",\"to\":\"+13121000096\"}"; $signingSecret = "sigsec_ead6d3b6904196c60835d039e91b3341c77a7794"; RequestVerifier::verifyRequestSignature($requestBody, $requestHeader, $signingSecret, $tolerance); } }
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.0.0
- Package version:
4.3.4
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen