1. Go to this page and download the library: Download shapin/talkjs library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shapin / talkjs example snippets
use Shapin\TalkJS\TalkJSClient;
use Symfony\Component\HttpClient\HttpClient;
$httpClient = HttpClient::create([
'base_uri' => 'https://api.talkjs.com/v1/'.self::APP_ID.'/',
'auth_bearer' => self::SECRET_KEY,
'headers' => [
'Content-Type' => 'application/json',
],
]);
$talkJSClient = new TalkJSClient($httpClient);
// Create or update a user
$client->users()->createOrUpdate('my_custom_id', [
'email' => '[email protected]',
]);
// Retrieve a user
$user = $client->users()->get('my_custom_id');
$custom = [
'foo' => 'bar'
];
// Find Messages
$client->conversations()->findMessages('my_conversation_id', $filters);
// Post a system message
$client->conversations()->postSystemMessage('my_conversation_id', 'message_text', $custom);
// Post a user message
$client->conversations()->postUserMessage('my_conversation_id', 'my_user_id', 'message_text', $custom);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.