# createConversationParticipant

```graphql
mutation CreateConversationParticipant($conversationId: ID!, $input: CreateConversationParticipantInput!) {
  createConversationParticipant(conversationId: $conversationId, input: $input) {
    id
    conversationId
    participantId
    participantType
    userId
    agentId
    displayName
    agentKind
    avatarUrl
    role
    lastReadMessageId
    notificationPreference
    joinedAt
  }
}
```

Add a user to a conversation as member or viewer to share a thread; the operation needs the admin relation.

## Arguments

| Name             | Type                                | Required | Description                 |
| ---------------- | ----------------------------------- | -------- | --------------------------- |
| `conversationId` | ID!                                 | Yes      |                             |
| `input`          | CreateConversationParticipantInput! | Yes      |                             |
| `input.userId`   | ID!                                 | Yes      | User to add.                |
| `input.role`     | String                              |          | member (default) or viewer. |

## Variables

```json
{
  "conversationId": "string",
  "input": {
    "userId": "string"
  }
}
```

## Responses

| Status | Description                                                         |
| ------ | ------------------------------------------------------------------- |
| 200    | The ConversationParticipant! in data.createConversationParticipant. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CreateConversationParticipant($conversationId: ID!, $input: CreateConversationParticipantInput!) {\n  createConversationParticipant(conversationId: $conversationId, input: $input) {\n    id\n    conversationId\n    participantId\n    participantType\n    userId\n    agentId\n    displayName\n    agentKind\n    avatarUrl\n    role\n    lastReadMessageId\n    notificationPreference\n    joinedAt\n  }\n}",
  "variables": {
    "conversationId": "string",
    "input": {
      "userId": "string"
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createConversationParticipant": {
      "id": "string",
      "conversationId": "string",
      "participantId": "string",
      "participantType": "string",
      "userId": "string",
      "agentId": "string",
      "displayName": "string",
      "agentKind": "string",
      "avatarUrl": "https://example.com",
      "role": "string",
      "lastReadMessageId": "string",
      "notificationPreference": "string",
      "joinedAt": "string"
    }
  }
}
```
