Download the PHP package danlopez00/chatbase-api without Composer
On this page you can find all versions of the php package danlopez00/chatbase-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danlopez00/chatbase-api
More information about danlopez00/chatbase-api
Files in danlopez00/chatbase-api
Package chatbase-api
Short Description PHP SDK Wrapper for the Chatbase API (unofficial)
License MIT
Informations about the package chatbase-api
Chatbase API for PHP and Laravel
Chatbase is a Chatbot analytics service by Google.
This is the unofficial Chatbase API for PHP. It focuses heavily on the Laravel Framework however it will work in any standalone project with usage of Composer.
Installation
This package can be installed through Composer.
Framework Agnostic Usage
Laravel Usage
In Laravel >5.5 the package will auto register the service provider. In Laravel 5.4 you must install this service provider.
In Laravel >5.5 the package will auto register the facades. In Laravel 5.4 you must install the facade manually.
You can publish the config file of this package with this command:
The following config file will be published in config/chatbase.php
Only the Generic Messaging API is setup at present
IoC container
The IoC container will automatically resolve the GenericMessage
dependencies for you. You can grab an instance of GenericMessage
from the IoC container in a number of ways.
Alternatively you may use the Chatbase
facade directly
Fields (keys) that can be set using the with()
method. (Passed as an array)
field | type | required | description |
---|---|---|---|
user_id | string | Y | the ID of the end-user |
message | string | N | the raw message body regardless of type for example a typed-in or a tapped button or tapped image |
intent | string | N | set for user messages only; if not set usage metrics will not be shown per intent; do not set if it is a generic catch all intent, like default fallback, so that clusters of similar messages can be reported |
version | string | N | set for user and bot messages; used to track versions of your code or to track A/B tests |
custom_session_id | string | N | set for user and bot messages; used to define your own custom sessions for Session Flow report and daily session metrics |
Usage
All methods take the same parameters in the following order -
Send a user message to Chatbase
Example Response -
Send a user message to Chatbase for a different platform
Example Response -
Send a user message to Chatbase while logging a version
Example Response -
Send a user message to Chatbase with intent
Example Response -
Send failed user message not handled by the bot
Example Response -
Send a bot message sent back to the user
Response -
Working with multiple bots
Sometime you may wish to push your bot activity to different chatbase accounts. Perhaps you have multiple bots running in the one application. You can easily set the API KEY
for each bot on each method call.
Example Response -
*Please Note: Invalid fields sent to Chatbase may result in a successful entry however, you will receive a 400 error and a WrongDataSet
exception will be thrown. This is common when you set fields like intent
for bot messages.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Steven Richardson
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of chatbase-api with dependencies
guzzlehttp/guzzle Version ^6.3
illuminate/contracts Version ~5.4.0|~5.5.0|~5.6.0
illuminate/support Version ~5.4.0|~5.5.0|~5.6.0
nesbot/carbon Version ^1.22