Skip to content

HasChatMethods ​

php
trait Zairakai\LaravelTwitch\Services\Concerns\HasChatMethods

Twitch Chat API methods.

Requires user access token with appropriate chat scopes.

Source: src/Services/Concerns/HasChatMethods.php

Methods ​

clearChat() ​

php
public function clearChat(string $broadcasterId, string $moderatorId): void

Clear all messages in a broadcaster's chat.

deleteMessage() ​

php
public function deleteMessage(string $broadcasterId, string $moderatorId, string $messageId = null): void

Delete a specific chat message or clear the entire chat.

ParameterDescription
$messageIdSpecific message to delete; null clears all chat

getChannelBadges() ​

php
public function getChannelBadges(string $broadcasterId): DataCollection

Get the broadcaster's custom chat badges.

Returns DataCollection<int, Badge>

getChannelEmotes() ​

php
public function getChannelEmotes(string $broadcasterId): DataCollection

Get all emotes for a broadcaster's channel.

Returns DataCollection<int, Emote>

getChatSettings() ​

php
public function getChatSettings(string $broadcasterId, string $moderatorId = null): ChatSettings

Get current chat settings for a broadcaster's channel.

getChatters() ​

php
public function getChatters(string $broadcasterId, string $moderatorId, int $first = 100, string $after = null): PaginatedResult

Get the list of users currently in the broadcaster's chat.

Returns PaginatedResult<Chatter>

getEmoteSets() ​

php
public function getEmoteSets(string|array $emoteSetIds): DataCollection

Get emote information for one or more specified emote sets.

ParameterDescription
$emoteSetIdsOne or more emote set IDs

Returns DataCollection<int, Emote>

getGlobalBadges() ​

php
public function getGlobalBadges(): DataCollection

Get Twitch's global chat badges.

Returns DataCollection<int, Badge>

getGlobalEmotes() ​

php
public function getGlobalEmotes(): DataCollection

Get all global Twitch emotes.

Returns DataCollection<int, Emote>

getPinnedMessage() ​

php
public function getPinnedMessage(string $broadcasterId, string $moderatorId): PinnedChatMessage

Get the broadcaster's currently mod-pinned chat message, if any.

getSharedChatSession() ​

php
public function getSharedChatSession(string $broadcasterId): SharedChatSession

Get the active shared chat session for a channel.

getUserChatColor() ​

php
public function getUserChatColor(string|array $userIds): DataCollection

Get the color used for the user's name in chat.

ParameterDescription
$userIdsOne or more user IDs (max 100)

Returns DataCollection<int, ChatColor>

getUserEmotes() ​

php
public function getUserEmotes(string $userId, string $broadcasterId = null, string $after = null): PaginatedResult

Get emotes available to the user across all channels they follow/subscribe to.

Returns PaginatedResult<Emote>

pinMessage() ​

php
public function pinMessage(string $broadcasterId, string $moderatorId, string $messageId, int $durationSeconds = null): void

Pins a chat message to the top of the broadcaster's chat room. Only one mod-pinned message can be active per channel - pinning a new one automatically replaces any existing pin.

ParameterDescription
$durationSecondsHow long to pin for, 30-1800 seconds. Omit to pin until the stream ends.

sendAnnouncement() ​

php
public function sendAnnouncement(string $broadcasterId, string $moderatorId, string $message, string $color = 'PRIMARY'): void

Send a colored announcement to the broadcaster's chat.

ParameterDescription
$colorBLUE, GREEN, ORANGE, PURPLE, or PRIMARY

sendMessage() ​

php
public function sendMessage(string $broadcasterId, string $senderId, string $message, string $replyParentMessageId = null, bool $pin = null): SentMessage

Send a message to a broadcaster's chat.

ParameterDescription
$replyParentMessageIdID of message to reply to
$pinSend and pin in one call - requires moderator:manage:chat_messages, sender must be the broadcaster or a moderator, always pins for 20 minutes (not configurable via this endpoint). Added 2026-05-15 alongside the open-beta pin/unpin endpoints (Pin Chat Message, Get/Update Pinned Chat Message, Unpin Chat Message) - those four are NOT implemented here, Twitch's own reference page never rendered their exact request/response shape even via three independent lookup attempts, and no third-party Twitch API client had them either as of 2026-08-27. Confirmed only via the changelog entry and Twitch's own dev forum, both of which describe the parameter but not the pin/unpin bodies - deliberately not guessing an unverified shape.

sendShoutout() ​

php
public function sendShoutout(string $fromBroadcasterId, string $toBroadcasterId, string $moderatorId): void

Send a shoutout to another broadcaster.

unpinMessage() ​

php
public function unpinMessage(string $broadcasterId, string $moderatorId, string $messageId): void

Unpins a pinned chat message before its timer/stream-end would have.

updateChatSettings() ​

php
public function updateChatSettings(string $broadcasterId, string $moderatorId, UpdateChatSettingsRequest $updateChatSettingsRequest): ChatSettings

Update chat settings for a broadcaster's channel.

updatePinnedMessage() ​

php
public function updatePinnedMessage(string $broadcasterId, string $moderatorId, string $messageId, int $durationSeconds = null): void

Updates the duration of an already-pinned chat message, starting from now.

ParameterDescription
$durationSecondsNew duration, 30-1800 seconds. Omit to pin until the stream ends.

updateUserChatColor() ​

php
public function updateUserChatColor(string $userId, string $color): void

Update the color used for the user's name in chat.

ParameterDescription
$colorNamed color (blue, blue_violet, cadet_blue, chocolate, coral, dodger_blue, firebrick, golden_rod, green, hot_pink, orange_red, red, sea_green, spring_green, yellow_green) or hex (#RRGGBB for Turbo/Prime)

Documentation of 4.1.4 , built from a03e949 on 4.1.4 by pipeline #2949087255 on 2026-10-11.