2017 © Pedro Peláez
 

library carrot-api

PHP Wrapper for Carrot Quest API

image

veksa/carrot-api

PHP Wrapper for Carrot Quest API

  • Monday, September 5, 2016
  • by veksa
  • Repository
  • 1 Watchers
  • 1 Stars
  • 194 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

PHP Carrot Quest Api

Stable Version License Total Downloads Daily Downloads Build Status Code Climate Test Coverage, (*1)

An extended native php wrapper for Carrot Quest API without requirements. Supports all methods and types of responses., (*2)

Install

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require  veksa/carrot-api "~1.0"

or add, (*5)

"veksa/carrot-api": "~1.0"

to the require section of your composer.json file., (*6)

Usage

API Wrapper

``` php $carrot = new \Veksa\Carrot\Api('YOUR_APP_ID', 'YOUR_CARROT_API_TOKEN');, (*7)

### Methods

#### getActiveUsers
Get the users who are currently online on the status of "online".

----------

#### getCountLeads
Get count of users (leads). User if the lead is considered to be, if known contacts about it: name, email, phone, User ID, or it was at least one dialogue.

----------

#### getLeads
Get all users (leads). User if the lead is considered to be, if known contacts about it: name, email, phone, User ID, or it was at least one dialogue.

**filters** *array*: array of filters, examples: https://carrotquest.io/developers/filters/.

**prop** *string*: property for sort. Default: $last_seen

**order** *string*: sort order. Default: desc

**limit** *int*: limit show users. Default: 20

**offset** *int*: start from. Default: 0

----------

#### getConversations
Get all the dialogues of application.

**id** *int*: user ID.

**limit** *int*: limit show dialogues. Default: 20

**offset** *int*: start from. Default: 0

**closed** *bool|null*: true - open dialogues, false - closed dialogues, null - all dialogues

**assigned** *int|null*: Id of Admin that dialogues is assign, or null

**tags** *array*: array of tags

----------

#### getConversation
Get information about the specific dialog.

**id** *int*: dialogue ID. *Required options*

----------

#### getMessages
Get messages in a specific dialog.

**id** *int*: dialogue ID. *Required options*

**limit** *int*: limit show users. Default: 20

**offset** *int*: start from. Default: 0

----------

#### sendConversationMessage
Send messages to a specific dialog.

**id** *int*: dialogue ID. *Required options*

**message** *string*: text of message. *Required options*

**type** *string*: type of message. Default: note

**botName** *string*: name of bot. Default: Bot

**fromUser** *bool*: true - message from user

**fromAdmin** *int*: Id of Admin or default_admin to send message from admin

**randomId** *int*: random Id of message, for control delivery. Default: 0

**autoAssign** *int*: Id of Admin than auto assign to him

**autoAssignRandomId** *int*: random Id of message, for control assign delivery. Default: 0

----------

#### readMessages
Mark all messages as read in the dialogue (by the user on the site).

**id** *int*: dialogue ID. *Required options*

----------

#### setTyping
Set typing message in conversation.

**id** *int*: dialogue ID. *Required options*

**message** *string*: message.

**botName** *string*: set typing botName

**fromUser** *bool*: set typing from user

**fromAdmin** *int*: set typing from admin

----------

#### assignConversation
Assign a specific dialogue defined by the administrator (or removes the assignment).

**id** *int*: dialogue ID. *Required options*

**adminId** *int|null*: admin ID or null to remove assignment.

**fromAdminId** *int|null*: admin ID from assignment

**botName** *string*: bot name from assignment. Default: Bot

**randomId** *int*: number for control assignment

----------

#### addTag
Add tag to dialogue.

**id** *int*: dialogue ID. *Required options*

**tag** *string*: tag.

**fromAdminId** *int|null*: admin ID from assignment

**botName** *string*: bot name from assignment. Default: Bot

**randomId** *int*: number for control assignment

----------

#### deleteTag
Delete tag from dialogue.

**id** *int*: dialogue ID. *Required options*

**tag** *string*: tag.

**fromAdminId** *int|null*: admin ID from assignment

**botName** *string*: bot name from assignment. Default: Bot

**randomId** *int*: number for control assignment

----------

#### closeConversation
Close the conversation.

**id** *int*: dialogue ID. *Required options*

**fromAdminId** *int|null*: admin ID from assignment

**botName** *string*: bot name from assignment. Default: Bot

**randomId** *int*: number for control assignment

----------

#### getUser
Get user by ID.

**id** *int*: user ID. *Required options*

**isSystem** *bool*: system or local ID. Default is system

----------

#### setProps
Add or Update user props.

**id** *int*: user ID. *Required options*

**props** *array*: array of props. *Required options*

**isSystem** *bool*: is system ID?

----------

#### deleteProps
Delete user props.

**id** *int*: user ID. *Required options*

**props** *array*: array of props. *Required options*

**isSystem** *bool*: is system ID?

----------

#### setPresence
Set user status.

**id** *int*: user ID. *Required options*

**presence** *string*: user status. *Required options*

**sessionId** *string*: session ID *Required options*

----------

#### sendUserMessage
Send messages to a specific user.

**id** *int*: user ID. *Required options*

**message** *string*: text of message. *Required options*

**type** *string*: is note or message. Default: popup_chat

----------

#### startConversation
Start conversation with user.

**id** *int*: user ID. *Required options*

**message** *string*: text of message. *Required options*

----------

#### trackEvent
Tracking events, which is performed by the user.

**id** *int*: user ID. *Required options*

**eventName** *string*: name of event. *Required options*

**additionalParams** *array*: additional params

----------

#### getEvents
Receive events that the user makes a chronologically.

**id** *int*: user ID. *Required options*

**eventName** *string*: name of event to filter.

**limit** *int*: limit show users. Default: 20

**offset** *int*: start from. Default: 0

----------

## Change log

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Testing

``` bash
$ composer test

Contributing

Please see CONTRIBUTING for details., (*8)

Security

If you discover any security related issues, please email admin@devblog.pro instead of using the issue tracker., (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

05/09 2016

dev-master

9999999-dev https://github.com/veksa/carrot-api

PHP Wrapper for Carrot Quest API

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

php carrot-quest carrot carrot api

05/09 2016

v2.0.0

2.0.0.0 https://github.com/veksa/carrot-api

PHP Wrapper for Carrot Quest API

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

php carrot-quest carrot carrot api

05/09 2016

v1.1.0

1.1.0.0 https://github.com/veksa/carrot-api

PHP Wrapper for Carrot Quest API

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

php carrot-quest carrot carrot api

03/05 2016

v1.0.0

1.0.0.0 https://github.com/veksa/carrot-api

PHP Wrapper for Carrot Quest API

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

php carrot-quest carrot carrot api