bookin/broscript

BroScript php api sdk

dev-master 2016-09-21 20:37 UTC

This package is not auto-updated.

Last update: 2024-12-21 21:52:37 UTC


README

The following section explains how to use the BroScript library in a new project.

How to Test

Unit tests in this SDK can be run using PHPUnit.

  1. First install the dependencies using composer including the require-dev dependencies.
  2. Run vendor\bin\phpunit --verbose from commandline to execute tests. If you have installed PHPUnit globally, run tests using phpunit --verbose instead.

You can change the PHPUnit test configuration in the phpunit.xml file.

Initialization

Authentication and Initialization

In order to setup authentication and initialization of the API client, you need the following information.

API client can be initialized as following.

// Configuration parameters and credentials
$userKey = "userKey"; // User Key
$scriptKey = "scriptKey"; // Script Key

//The singleton instance of the ``` APIController ``` class can be accessed from the API Client.
$client = BroScriptClient::getInstance($userKey, $scriptKey);

Class Reference

List of Controllers

Method: cleanHistory

TODO: Add a method description

function cleanHistory($chatId = NULL)

Parameters:

Example Usage:

$chatId = 'chat_id';

$result = $client->cleanHistory($chatId);

Method: templates

Get array with templates

function templates()

Example Usage:

$result = $client->templates();

Method: answers

Get answer

function answers(
        $chatId = NULL,
        $contact = NULL,
        $external = NULL,
        $stopIsNull = false,
        $repeatIsNull = false)

Parameters:

Example Usage:

$chatId = 'chat_id';
$contact = array('contact');
$external = array('external');
$stopIsNull = false;
$repeatIsNull = false;

$result = $client->answers($chatId, $contact, $external, $stopIsNull, $repeatIsNull);

Back to List of Controllers