bookin/broscript

BroScript php api sdk

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

This package is not auto-updated.

Last update: 2022-10-01 09:19:31 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.

Parameter Description
userKey User Key
scriptKey Script Key

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:

Parameter Tags Description
chatId Optional chat id

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:

Parameter Tags Description
chatId Optional Chat id
contact Optional Collection Object with information about concat
external Optional Collection Object with information about external
stopIsNull Optional DefaultValue Stop is null
repeatIsNull Optional DefaultValue Stop is null

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