Skip to content

Maxpl/chatbase-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatbase client

Installation

The preferred way to install this extension is through composer.

Either run

composer require maxpl/chatbase-api

add custom repo:

"repositories": [ { "type": "vcs", "url": "[email protected]:Maxpl/chatbase-api.git" } ]


require package

"require": { "maxpl/chatbase-api": "*" }


First Step
----------

Create account or sign in https://chatbase.com

Add bot
----------

Add you bot and copy his key in config sections 

example:

```php
frontend/config/main.php

'components' => [
	'chatbase' => [
                'class'   => 'Maxpl\ChatbaseApi\ChatbaseClient',
		'api_key' => '0a3edfg345-d123-d56u-d34h-4564564560aa',
                'platform'=> 'telegram',
	]
],

Usage

//Send message from user
$chatbase = Yii::$app->chatbase->init()->send([
    'user_id' => $user_id,//required
    'command' => $command or $this->controller->id . '-' . $this->controller->action->id, //optional
    'message' => $message,//required
]);
//Send message from bot to user
$chatbase = Yii::$app->chatbase->init()->send([
    'type' => 'agent',
    'user_id' => $user_id,//required
    'message' => $message,//required
]);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages