Create or start a chat
Create a single/group chat (mode='create') or start a direct chat from merged user data (mode='start').
Parameters
Account to create or start the chat on.
Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'.
Optional first message content if the platform requires it to create the chat.
Operation mode. Defaults to 'create' when omitted.
Required when mode='create'. User IDs to include in the new chat.
Optional title for group chats when mode='create'; ignored for single chats on most platforms.
Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title.
Required when mode='start'. Merged user-like contact payload used to resolve the best identifier.
Returns
Create or start a chat
<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
$client = new Client();
$chat = $client->chats->create(
accountID: 'accountID',
allowInvite: true,
messageText: 'messageText',
mode: 'create',
participantIDs: ['string'],
title: 'title',
type: 'single',
user: [
'id' => 'id',
'email' => 'email',
'fullName' => 'fullName',
'phoneNumber' => 'phoneNumber',
'username' => 'username',
],
);
var_dump($chat);{
"chatID": "!NCdzlIaMjZUmvmvyHU:beeper.com",
"status": "existing"
}Returns Examples
{
"chatID": "!NCdzlIaMjZUmvmvyHU:beeper.com",
"status": "existing"
}