# Set up or change the chat widget. A person's setting

`PUT /crm/chat` · Rivier · contacts

Set up or change the chat widget. A person's setting.

- Scope: contacts:admin
- Sdk: contacts.chat.save
- Cli: contacts chat save

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "inboxId": {
      "type": "string",
      "format": "uuid"
    },
    "title": {
      "type": "string",
      "maxLength": 80,
      "default": "Chat with us"
    },
    "agentName": {
      "type": "string",
      "maxLength": 60,
      "default": "Assistant"
    },
    "greeting": {
      "type": "string",
      "maxLength": 300,
      "default": "Hi. How can we help?"
    },
    "accent": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$",
      "default": "#1f4fd8"
    },
    "position": {
      "type": "string",
      "enum": [
        "right",
        "left"
      ],
      "default": "right"
    },
    "email": {
      "type": "string",
      "enum": [
        "ask",
        "required",
        "never"
      ],
      "default": "ask"
    },
    "disclosure": {
      "type": "string",
      "maxLength": 300,
      "default": "You are chatting with an AI assistant. A person can join at any time."
    },
    "hours": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "timezone": {
              "type": "string",
              "maxLength": 60
            },
            "days": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "day": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "open": {
                    "type": "string",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  },
                  "close": {
                    "type": "string",
                    "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
                  }
                },
                "required": [
                  "day",
                  "open",
                  "close"
                ],
                "additionalProperties": false
              },
              "maxItems": 14
            }
          },
          "required": [
            "timezone",
            "days"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "awayMessage": {
      "type": "string",
      "maxLength": 300,
      "default": "We are away right now. Leave a message and we will answer when we are back."
    },
    "handoff": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "label": {
          "type": "string",
          "maxLength": 40,
          "default": "Talk to a person"
        }
      },
      "additionalProperties": false,
      "default": {}
    },
    "csat": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        }
      },
      "additionalProperties": false,
      "default": {}
    },
    "transcript": {
      "type": "object",
      "properties": {
        "offer": {
          "type": "boolean",
          "default": true
        }
      },
      "additionalProperties": false,
      "default": {}
    },
    "notice": {
      "type": "string",
      "maxLength": 300,
      "default": "Your messages are saved so that we can answer you."
    },
    "privacyUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 300
    },
    "allowedOrigins": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 200
      },
      "maxItems": 20
    },
    "defaultLanguage": {
      "type": "string",
      "pattern": "^[a-z]{2}(-[A-Za-z]{2})?$",
      "default": "en"
    }
  },
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/crm/chat' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "inboxId": "string",
  "title": "Chat with us",
  "agentName": "Assistant",
  "greeting": "Hi. How can we help?",
  "accent": "#1f4fd8",
  "position": "right",
  "email": "ask",
  "disclosure": "You are chatting with an AI assistant. A person can join at any time."
}'
```
