1. Go to this page and download the library: Download assistly/laravel-channel 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/ */
assistly / laravel-channel example snippets
final class OrgTenants implements TenantResolver
{
public function credentials(string $tenantId): ?AssistlyCredentials
{
// null is a normal state: most tenants never connect Assistly.
}
public function mode(string $tenantId, string $threadId): ChannelMode
{
// Off | Analyze | Reply. Resolved per thread, so one conversation can
// be silenced when an operator takes it over without changing anything
// else about the tenant.
}
}
final class SendViaGateway implements ReplyTransport
{
public function deliver(ChannelReply $reply): void
{
// Use the sending path you already have, with its quotas and retries.
// Throwing marks the queued job failed; swallowing the error would
// report an answer the customer never saw.
}
}
final class History implements ConversationSource
{
public function history(string $tenantId, string $threadId, int $limit): iterable
{
// Oldest first. The caller trims to what Assistly will actually read,
// so returning more than a few dozen is wasted work.
}
public function attachment(string $tenantId, string $externalMessageId): ?StreamInterface
{
// null means "not fetched yet", not "failed" — a host that mirrors
// media lazily is retried rather than sent a message without its file.
}
}