# Channels


## Description

The **Channels** module allows external applications to manage communication platforms. This includes managing connected platforms, and disconnected them when no longer needed

---

## Entity Model

### ExternalConnectedPlatform


```graphql
type ExternalConnectedPlatform {
   _id: ID
   name: String
   status: Boolean
   channelId: String
   channelType: String
   senderEmailAddress: String
}

```
| Field                | Type      | Description                               |
| -------------------- | --------- | ----------------------------------------- |
| `_id`                | `ID`      | Unique identifier of the platform.        |
| `name`               | `String`  | Name of the connected platform.           |
| `status`             | `Boolean` | Whether the platform is currently active. |
| `channelId`          | `String`  | ID of the channel.                        |
| `channelType`        | `String`  | Type of channel (WhatsApp, Email, etc.).  |
| `senderEmailAddress` | `String`  | Sender’s email address (if applicable).   |

---


## Queries


### Get All Connected Platform List

Use this query to get all connected platform list.

```graphql
type Query {
   externalGetAllConnectedPlatformList
   : ExternalAllConnectedPlatformsResponse!
}

```

**Input**:

```graphql
No arguments given
```

**Response**:

```graphql
type ExternalAllConnectedPlatformsResponse {
   success: Boolean
   data: [ExternalConnectedPlatform]
   code: String
   message: String
}
```


---

## Example Usage


### Query Example — Get All Connected Platform List

<Tabs>
  <Tab title="Bash (cURL)">
```bash
curl --location 'https://api.qpien.com/api/v1' \
--header 'Content-Type: application/json' \
--header 'Authorization: YOUR_ACCESS_TOKEN' \
--data '{
  "query": "query ExternalGetAllConnectedPlatformList { externalGetAllConnectedPlatformList { success data { _id name status channelId channelType senderEmailAddress appId } code message } }"
}'

```
      
  </Tab>
  <Tab title="Node.js">
```js
const query = `
  query {
    externalGetAllConnectedPlatformList {
      success
      code
      message
      data {
        _id
        name
        status
        channelId
        channelType
        senderEmailAddress
      }
    }
  }
`;

async function run() {
  const response = await fetch("https://api.qpien.com/api/v1", {
    method: "POST",
    headers: {
      "Authorization": "<ACCESS_TOKEN>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ query })
  });

  const data = await response.json();
  console.log(data);
}

run();
```
  </Tab>
</Tabs>

---






