# Query Conversations

{% hint style="danger" %}
**Requires&#x20;*****`READ_SMS`*****&#x20;permission.**
{% endhint %}

Add the following permission in your `AndroidManifest.xml`

```markup
<uses-permission android:name="android.permission.READ_SMS"/>
```

## getConversations()

#### Returns Future\<List<[SmsConversation](/query-conversations.md#smsconversation)>>

| Parameters | Type                                                               | Description                                                             | Optional | Default Value |
| :--------: | ------------------------------------------------------------------ | ----------------------------------------------------------------------- | :------: | ------------- |
|   Filter   | [`ConversationFilter`](/query-conversations.md#conversationfilter) | Filters the result by given constraints. Works like `SQL WHERE` clause. |    ✔️    | `null`        |
|  sortOrder | List of [`OrderBy`](/query-sms.md#orderby)                         | Sorts the result prioritized by order of declaration.                   |    ✔️    | `null`        |

```dart
List<SmsConversation> conversations = await telephony.getConversations(
        filter: SmsFilter.where(ConversationColumn.THREAD_ID)
                 .equals("12")
                 .and(ConversationColumn.SNIPPET)
                 .like("starwars"),
        sortOrder: [OrderBy(ConversationColumn.THREAD_ID, sort: Sort.ASC)]
        );
```

#### All parameters are optional.

```dart
List<SmsConversation> conversations = await telephony.getConversations();
```

## SmsConversation

| Property           | Type     |
| ------------------ | -------- |
| **`snippet`**      | `String` |
| **`threadId`**     | `int`    |
| **`messageCount`** | `int`    |

## ConversationColumn

| Values          |
| --------------- |
| **`SNIPPET`**   |
| **`THREAD_ID`** |
| **`MSG_COUNT`** |

## ConversationFilter

Works exactly like [`SmsFilter`](/query-sms.md#smsfilter) but works with [`ConversationColumn`](/query-conversations.md#conversationcolumn) instead of [`SmsColumn`](/query-sms.md#smscolumn)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://telephony.shounakmulay.dev/query-conversations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
