# Participants

## Add a participant to a chat

`client.Chats.Participants.Add(ctx, chatID, body) (*ChatParticipantAddResponse, error)`

**post** `/v3/chats/{chatId}/participants`

Add a new participant to an existing group chat.

**Requirements:**

- Group chats only (3+ existing participants)
- New participant must support the same messaging service as the group
- Cross-service additions not allowed (e.g., can't add RCS-only user to iMessage group)
- For cross-service scenarios, create a new chat instead

### Parameters

- `chatID string`

- `body ChatParticipantAddParams`

  - `Handle param.Field[string]`

    Phone number (E.164 format) or email address of the participant to add

### Returns

- `type ChatParticipantAddResponse struct{…}`

  - `Message string`

  - `Status string`

  - `TraceID string`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Chats.Participants.Add(
    context.TODO(),
    "550e8400-e29b-41d4-a716-446655440000",
    linqgo.ChatParticipantAddParams{
      Handle: "+12052499136",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.TraceID)
}
```

#### Response

```json
{
  "message": "Participant addition queued",
  "status": "accepted",
  "trace_id": "trace_id"
}
```

## Remove a participant from a chat

`client.Chats.Participants.Remove(ctx, chatID, body) (*ChatParticipantRemoveResponse, error)`

**delete** `/v3/chats/{chatId}/participants`

Remove a participant from an existing group chat.

**Requirements:**

- Group chats only
- Must have 3+ participants after removal

### Parameters

- `chatID string`

- `body ChatParticipantRemoveParams`

  - `Handle param.Field[string]`

    Phone number (E.164 format) or email address of the participant to remove

### Returns

- `type ChatParticipantRemoveResponse struct{…}`

  - `Message string`

  - `Status string`

  - `TraceID string`

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/linq-team/linq-go"
  "github.com/linq-team/linq-go/option"
)

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  participant, err := client.Chats.Participants.Remove(
    context.TODO(),
    "550e8400-e29b-41d4-a716-446655440000",
    linqgo.ChatParticipantRemoveParams{
      Handle: "+12052499136",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", participant.TraceID)
}
```

#### Response

```json
{
  "message": "Participant removal queued",
  "status": "accepted",
  "trace_id": "trace_id"
}
```
