Send a chat message with Thinwrap (PHP)

Post a chat message via the Thinwrap unified Chat facade in PHP — same call shape for Slack, Discord, Microsoft Teams, and every other supported chat provider.

1. Install

composer require thinwrap/notifications

2. Send the call

use Thinwrap\Notifications\Chat;
use Thinwrap\Notifications\Enum\NotificationProviderId;
use Thinwrap\Notifications\Providers\Slack\SlackConfig;
use Thinwrap\Notifications\DTO\Chat\ChatSendInput;

// Slack incoming-webhooks: the URL itself is both auth and channel routing.
$chat = new Chat(
    NotificationProviderId::Slack,
    new SlackConfig(webhookUrl: getenv('SLACK_WEBHOOK_URL')),
);

// `to` is null for webhook-routed providers (Slack, Discord, MS Teams,
// Mattermost, Google Chat) — the webhook URL already targets a channel.
$result = $chat->send(new ChatSendInput(
    to: null,
    body: 'Deploy finished — production is live.',
));

echo $result->status, ' ', $result->providerMessageId ?? '(no id)', PHP_EOL;

Same code works for all supported providers — just change the provider ID.