Giter Club home page Giter Club logo

engagevoice-sdk-wrapper-php's Introduction

Engage Voice SDK Wrapper for PHP.


Overview

Engage Voice SDK Wrapper for PHP is a utility class, which helps you easily integrate your PHP project with RingCentral Engage Voice Services. The SDK allows you to authenticate a user in two different modes, the ENGAGE mode and the LEGACY mode. In the ENGAGE mode, you must h


Install the Engage Voice SDK Wrapper

$ composer require pacovu/engagevoice-sdk-wrapper:dev-master

API References

Constructor

RestClient($clientId, $clientSecret)

Description:

  • Creates and initializes an EngageVoice SDK wrapper object. If the $clientId and $clientSecret parameters are provided, the SDK will be set to the ENGAGE mode and you can login with a RingCentral MVP user login credentials. If the $clientId and $clientSecret parameters are omitted, the SDK will be set to the LEGACY mode and you can login the legacy server using the username and password.

Parameters:

  • $clientId: set the clientId of a RingCentral app to enable login with RingCentral MVP user credentials.
  • $clientSecret: set the clientSecret of a RingCentral app to enable login with RingCentral MVP user credentials.

Example code for ENGAGE mode:

require('vendor/autoload.php');

$ev = new EngageVoiceSDKWrapper\RestClient(RINGCENTRAL_CLIENT_ID, RINGCENTRAL_CLIENT_SECRET)

Example code for LEGACY mode:

require('vendor/autoload.php');

$ev = new EngageVoiceSDKWrapper\RestClient()

Function login login($options, function ($response) )

Description:

  • Login using a user's credential. If the SDK mode is "Engage", the username and password must be the valid username and password of a RingCentral Office user.

Parameters:

  • $options: An array of login credentials. For the "Engage" mode, set the jwt token. For the "Legacy" mode, set the username and password.

Response:

Example code:

// Login with RingCentral Office user credentials.
require('vendor/autoload.php');

$ev = new EngageVoiceSDKWrapper\RestClient(RC_CLIENT_ID, RC_CLIENT_SECRET);
RC_JWT= "personal-jwt-token";
$ev->login([ 'jwt' => RC_JWT ], function($response){
  // call the get or post function
  ...
});

// Login with Legacy user credentials
$ev = new EngageVoiceSDKWrapper\RestClient();

USERNAME= "your-username";
PASSWORD= "your-password";

$ev->login([ 'username' => USERNAME, 'password' => PASSWORD ]) {
  // call get or post function
  ...
});

Function get

get($endpoint, $params, "callback");

Description:

  • Send an HTTP GET request to Engage Voice server.

Parameters:

  • $endpoint: Engage Voice API endpoint.
  • $params: a JSON object containing key/value pair parameters to be sent to an Engage Voice API, where the keys are the query parameters of the API.
  • "callback": the name of a callback function. If specified, response is returned via the callback function.

Response: API response in JSON object

Example code:

# Read account info.

$endpoint = "admin/accounts";
try{
    $resp = $ev->get($endpoint);
    print ($resp);
}catch (Exception $e) {
    print $e->getMessage();
}

Function post

post($endpoint, $params, "callback");

Description:

  • Sends an HTTP POST request to Engage Voice server.

Parameters:

  • $endpoint: Engage Voice API
  • $params: a JSON object containing key/value pair parameters to be sent to an Engage Voice API, where the keys are the body parameters of the API.
  • "callback": the name of a callback function. If specified, response is returned via the callback function.

Response: API response in JSON object

Example code:

# Search for campaign leads.

$endpoint = "admin/accounts/~/campaignLeads/leadSearch";
$params = array ( 'firstName' => "Larry" );
try{
    $resp = $ev->post($endpoint, $params);
    print ($resp);
}catch (Exception $e) {
    print $e->getMessage();
}

License

Licensed under the MIT License.

engagevoice-sdk-wrapper-php's People

Contributors

pacovu avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.