# Typing

## Start typing indicator

`client.Chats.Typing.Start(ctx, chatID) error`

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

Send a typing indicator to show that someone is typing in the chat.

## Behavior & Limitations

Typing indicators are best-effort signals with the following limitations:

- **Active conversations only:** The recipient must have sent or received a message
  in this chat within the **last 5 minutes**. If the chat is inactive, the request is
  still accepted (`204`) but the indicator will not reach the recipient's device.

- **No delivery guarantee:** Even for active chats, a `204` response only indicates
  the request was accepted for processing.

- **Group chats not supported:** Attempting to start a typing indicator in a group chat
  will return a `403` error.

### Parameters

- `chatID string`

### Example

```go
package main

import (
  "context"

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

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Chats.Typing.Start(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")
  if err != nil {
    panic(err.Error())
  }
}
```

#### Response

```json
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format",
    "doc_url": "https://docs.linqapp.com/error/codes/1xxx/1002/"
  },
  "success": false
}
```

## Stop typing indicator

`client.Chats.Typing.Stop(ctx, chatID) error`

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

Stop the typing indicator for the chat.

Typing indicators are automatically stopped when a message is sent, so calling
this endpoint after sending a message is unnecessary.

See the `POST` endpoint above for behavior details and limitations.

**Note:** Group chats are not supported and will return a `403` error.

### Parameters

- `chatID string`

### Example

```go
package main

import (
  "context"

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

func main() {
  client := linqgo.NewClient(
    option.WithAPIKey("My API Key"),
  )
  err := client.Chats.Typing.Stop(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")
  if err != nil {
    panic(err.Error())
  }
}
```

#### Response

```json
{
  "error": {
    "status": 400,
    "code": 1002,
    "message": "Phone number must be in E.164 format",
    "doc_url": "https://docs.linqapp.com/error/codes/1xxx/1002/"
  },
  "success": false
}
```
