# TimelinesAI

> Send WhatsApp messages and read chats, messages, accounts, and calls.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/timelinesai

## Actions

### Get chat

Get chat.

**Inputs**

- Chat (`chat_id`, number, required): an id of the chat as appears in TimelinesAI (can be found in the URL of the chat page, or in the payload of outbound webhook). _Supports sending messages to a group._

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "chat_sync": true,
      "chat_url": "example",
      "chatgpt_autoresponse_enabled": true,
      "closed": true,
      "created_timestamp": "example",
      "id": 1,
      "is_group": true,
      "jid": "example",
      "labels": [
        "example"
      ],
      "last_message": {},
      "last_message_timestamp": "example",
      "last_message_uid": "example",
      "name": "example",
      "phone": "example",
      "read": true,
      "responsible_email": "example",
      "responsible_name": "example",
      "whatsapp_account_id": "example"
    },
    "status": "ok"
  }
}
```

### Get current teammate

Get current teammate.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "created_at": "example",
      "display_name": "example",
      "email": "example",
      "invitation_status": "example",
      "role": "example",
      "status": "example",
      "team": "example",
      "user_id": 1,
      "whatsapp_accounts": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### Get message

Get message.

**Inputs**

- Message uid (`message_uid`, text, required): a UID of a message, that is unique for TimelinesAI workspace. Can be used to lookup a message or its sending status.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "attachment_filename": "example",
      "attachment_url": "example",
      "chat_id": 1,
      "from_me": true,
      "has_attachment": true,
      "message_type": "example",
      "origin": "example",
      "reactions": {},
      "received_timestamp": "example",
      "recipient_name": "example",
      "recipient_phone": "example",
      "sender_name": "example",
      "sender_phone": "example",
      "status": "example",
      "text": "example",
      "text_is_transcript": true,
      "timestamp": "example",
      "uid": "example"
    },
    "status": "ok"
  }
}
```

### Get message status history

Get message status history.

**Inputs**

- Message uid (`message_uid`, text, required): a UID of a message, that is unique for TimelinesAI workspace. Can be used to lookup a message or its sending status.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "failure_reason": {},
        "status": "example",
        "timestamp": "example"
      }
    ],
    "status": "ok"
  }
}
```

### Get workspace information

Get workspace information.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "ai_credits": {},
      "ai_credits_non_recurring": {},
      "api_calls_quota": {},
      "display_name": "example",
      "messaging_quota": {},
      "non_recurring_quota": {},
      "plan": "example",
      "seats": {},
      "workspace_id": "example"
    },
    "status": "ok"
  }
}
```

### List calls

List calls.

**Inputs**

- Chat ID (`chat_id`, number): filter calls in the specified chat (the chat id from `CallInfo`)
- Whatsapp account ID (`whatsapp_account_id`, text): filters calls on one of the specified WhatsApp accounts (in wid format, comma-separated)
- Direction (`direction`, text): filter incoming or outgoing calls. One of: `incoming`, `outgoing`.
- Started after (`started_after`, date and time): filter calls that started after this timestamp, can be specified with started_before
- Started before (`started_before`, date and time): filter calls that started before this timestamp, can be specified with started_after
- Recording status (`recording_status`, text): filter calls by recording status (comma-separated values from `CallRecordingStatus`; `none` matches calls with no recording)
- Transcript status (`transcript_status`, text): filter calls by transcript status (comma-separated values from `CallTranscriptStatus`; `none` matches calls with no transcript)
- Page (`page`, number): specify the page of results (each page contains up to 50 items), starting with 1. Check "has more page" response value to see if more pages are available.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "calls": [
        {}
      ],
      "has_more_pages": true
    },
    "status": "ok"
  }
}
```

### List chat labels

List chat labels.

**Inputs**

- Chat (`chat_id`, number, required): an id of the chat as appears in TimelinesAI (can be found in the URL of the chat page, or in the payload of outbound webhook). _Supports sending messages to a group._

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "labels": [
        "example"
      ]
    },
    "status": "ok"
  }
}
```

### List chat messages

List chat messages.

**Inputs**

- Chat (`chat_id`, number, required): an id of the chat as appears in TimelinesAI (can be found in the URL of the chat page, or in the payload of outbound webhook). _Supports sending messages to a group._
- From me (`from_me`, true/false): specify true to filter messages sent from my WhatsApp account (from any session), false to filter messages received from other WhatsApp users.
- After (`after`, date and time): can specify date or datetime in ISO format to filter out messages created AFTER the specified date (inclusive)
- Before (`before`, date and time): can specify date or datetime in ISO format to filter out messages created BEFORE the specified date (inclusive)
- After message (`after_message`, text): can specify message uid to filter out messages created after the specified message (excluding the specified message itself)
- Before message (`before_message`, text): can specify message uid to filter out messages created before the specified message (excluding the specified message itself)
- Sorting order (`sorting_order`, text): order messages by timestamp, according to possible values: asc, desc. One of: `asc`, `desc`.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "has_more_pages": true,
      "messages": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### List chats

List chats.

**Inputs**

- Label (`label`, text): filters chats having at least one of specified labels (comma-separated)
- Whatsapp account ID (`whatsapp_account_id`, text): filters chats belonging to one of the specified WhatsApp accounts (in wid format, comma-separated)
- Group (`group`, true/false): filters chats that are either group chats (true) or direct chats (false)
- Name (`name`, text): filter chats that contain any of specified strings (case-insensitive, comma-separated). Note: a string containing a whitespace will be matched as exact substring without being split to words.
- Phone (`phone`, text): Filter direct (non-group) chats by a single phone number. Phone is sanitized in the same way as for sending messages. If sanitized value starts with '+', the match is exact. Otherwise, leading zeroes are removed and the number is matched as a substring of the stored phone. Group chats are always excluded when this parameter is used.
- Read (`read`, true/false): filter chats that are either read (true) or unread (false)
- Closed (`closed`, true/false): filter chats that are either closed (true) or open (false)
- Page (`page`, number): specify the page of results (each page contains up to `page_size` items), starting with 1. Check \"has more page" response value to see if more pages are available.
- Page size (`page_size`, number): Number of items per page. Defaults to 50. Minimum 1. Maximum 100. From 1 to 100.
- Created after (`created_after`, date and time): filter chats that were created after this timestamp, can be specified with created_before
- Created before (`created_before`, date and time): filter chats that were created before this timestamp, can be specified with created_after
- Last message after (`last_message_after`, date and time): filter chats whose most recent message (including internal notes) is at or after this timestamp, can be specified with last_message_before. Include the timezone offset; a value without one is read in the server timezone. Chats without messages are excluded when this parameter is set.
- Last message before (`last_message_before`, date and time): filter chats whose most recent message (including internal notes) is at or before this timestamp, can be specified with last_message_after. Include the timezone offset; a value without one is read in the server timezone. Chats without messages are excluded when this parameter is set.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "chats": [
        {}
      ],
      "has_more_pages": true
    },
    "status": "ok"
  }
}
```

### List files

List files.

**Inputs**

- Filename (`filename`, text): a filename or any part of it (for example, extension), case insensitive . Leave empty to get unfiltered list of all uploaded files.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "filename": "example",
        "mimetype": "example",
        "size": 1,
        "uid": "example",
        "uploaded_at": "example",
        "uploaded_by_email": "example"
      }
    ],
    "status": "ok"
  }
}
```

### List teammates

List teammates.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "teammates": [
        {}
      ],
      "teams": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### List templates

List templates.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "templates": [
        {}
      ],
      "templates_count": 1
    },
    "status": "ok"
  }
}
```

### List webhooks

List webhooks.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": [
      {
        "enabled": true,
        "errors_counter": 1,
        "event_type": "message:new",
        "id": 1,
        "url": "example"
      }
    ],
    "status": "ok"
  }
}
```

### List WhatsApp accounts

List WhatsApp accounts.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "whatsapp_accounts": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### List WhatsApp Business accounts

List WhatsApp Business accounts.

**Inputs**: None.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "waba_accounts": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### List WhatsApp Business chats

List WhatsApp Business chats.

**Inputs**

- Waba account ID (`waba_account_id`, text): filters WABA chats belonging to one of the specified WABA accounts (comma-separated internal account ids). For member-scoped tokens, the result is intersected with the member-visible chat set; an invisible account id contributes no chats except chats where the member is responsible.
- Closed (`closed`, true/false): filter chats that are either closed (true) or open (false)
- Page (`page`, number): specify the page of results (each page contains up to `page_size` items), starting with 1. Check "has more page" response value to see if more pages are available.
- Page size (`page_size`, number): Number of items per page. Defaults to 50. Minimum 1. Maximum 100. From 1 to 100.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "chats": [
        {}
      ],
      "has_more_pages": true
    },
    "status": "ok"
  }
}
```

### List WhatsApp Business templates

List WhatsApp Business templates.

**Inputs**

- Page (`page`, number): specify the page of results (each page contains up to 50 items), starting with 1. Check "has more page" response value to see if more pages are available.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "has_more_pages": true,
      "templates": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### Search messages

Search messages.

**Inputs**

- Text (`text`, text, required): words to search for. Any characters are accepted; punctuation such as `&`, `|`, `!`, quotes, `:` and `+` is not an error
- Before message (`before_message`, text): uid of the last message of the previous page, to get the next page (excluding the specified message itself). Omit it or leave it blank for the first page

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "has_more_pages": true,
      "messages": [
        {}
      ]
    },
    "status": "ok"
  }
}
```

### Send message to chat

Send text to an existing WhatsApp chat.

**Inputs**

- Chat (`chat_id`, number, required): Choose a WhatsApp chat.
- Text (`text`, text, required): Enter the message text.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "message_uid": "example"
    },
    "status": "ok"
  }
}
```

### Send WhatsApp message

Send text to a phone number using a connected WhatsApp account.

**Inputs**

- Phone (`phone`, text, required): Use the recipient’s full international phone number.
- Text (`text`, text, required): Enter the message text.
- Sender phone (`sender_phone`, text): Use the sender’s international phone number if you have multiple WhatsApp accounts.

**Outputs**

- `data` (object): The response from TimelinesAI.

**Example output**

```json
{
  "data": {
    "data": {
      "message_uid": "example"
    },
    "status": "ok"
  }
}
```
