## Create `client.Chats.New(ctx, body) (*ChatNewResponse, error)` **post** `/v1/chats` Create a single/group chat (mode='create') or start a direct chat from merged user data (mode='start'). ### Parameters - `body ChatNewParams` - `AccountID param.Field[string]` Account to create or start the chat on. - `AllowInvite param.Field[bool]` Whether invite-based DM creation is allowed when required by the platform. Used for mode='start'. - `MessageText param.Field[string]` Optional first message content if the platform requires it to create the chat. - `Mode param.Field[ChatNewParamsMode]` Operation mode. Defaults to 'create' when omitted. - `const ChatNewParamsModeCreate ChatNewParamsMode = "create"` - `const ChatNewParamsModeStart ChatNewParamsMode = "start"` - `ParticipantIDs param.Field[[]string]` Required when mode='create'. User IDs to include in the new chat. - `Title param.Field[string]` Optional title for group chats when mode='create'; ignored for single chats on most platforms. - `Type param.Field[ChatNewParamsType]` Required when mode='create'. 'single' requires exactly one participantID; 'group' supports multiple participants and optional title. - `const ChatNewParamsTypeSingle ChatNewParamsType = "single"` - `const ChatNewParamsTypeGroup ChatNewParamsType = "group"` - `User param.Field[ChatNewParamsUser]` Required when mode='start'. Merged user-like contact payload used to resolve the best identifier. - `ID string` Known user ID when available. - `Email string` Email candidate. - `FullName string` Display name hint used for ranking only. - `PhoneNumber string` Phone number candidate (E.164 preferred). - `Username string` Username/handle candidate. ### Returns - `type ChatNewResponse struct{…}` - `ChatID string` Newly created chat ID. - `Status ChatNewResponseStatus` Only returned in start mode. 'existing' means an existing chat was reused; 'created' means a new chat was created. - `const ChatNewResponseStatusExisting ChatNewResponseStatus = "existing"` - `const ChatNewResponseStatusCreated ChatNewResponseStatus = "created"` ### Example ```go package main import ( "context" "fmt" "github.com/beeper/desktop-api-go" ) func main() { client := beeperdesktopapi.NewClient( ) chat, err := client.Chats.New(context.TODO(), beeperdesktopapi.ChatNewParams{ AccountID: "accountID", }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", chat.ChatID) } ```