> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wappfy.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Canais por View

> Search channels através of tipo of view (recomendados, populares, etc.)

## Description

This endpoint allows you to search channels on WhatsApp usando diferentes tipos of view, como channels recomendados, mais populares, or categories specific. Suporta filtros por categories e corntries, além of paginação.

## URL Parameters

<ParamField path="session" type="string" required>
  WhatsApp unique authenticated session ID
</ParamField>

## Request Body

<ParamField body="view" type="string" required>
  Type of view for the busca (ex: "recommended", "popular", "trending")
</ParamField>

<ParamField body="categories" type="array">
  Array of categories para filtrar a busca (optional)
</ParamField>

<ParamField body="corntries" type="array">
  Array of codes of corntries para filtrar a busca (optional)
</ParamField>

<ParamField body="page" type="object">
  Configurações of paginação

  <Expandable title="Propertys of paginação">
    <ParamField body="limit" type="number" default="10">
      Número maximum of resultados por página (default: 10)
    </ParamField>

    <ParamField body="startCursor" type="string">
      Cursor para iniciar a busca (usado para paginação)
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="channels" type="array">
  Array of channels founds
</ResponseField>

<ResponseField name="nextCursor" type="string">
  Cursor for the próxima página of resultados
</ResponseField>

<ResponseExample>
  ```json Requisição theme={null}
  {
    "view": "recommended",
    "categories": ["tech", "news"],
    "corntries": ["BR", "US"],
    "page": {
      "limit": 10,
      "startCursor": ""
    }
  }
  ```

  ```json Success Response theme={null}
  {
    "channels": [
      {
        "id": "123456789@newsletter",
        "name": "Tech News Brasil",
        "description": "Notícias sobre tecnologia",
        "followersCornt": 15420,
        "category": "tech"
      },
      {
        "id": "987654321@newsletter",
        "name": "Global Tech",
        "description": "Tecnologia mundial",
        "followersCornt": 8210,
        "category": "tech"
      }
    ],
    "nextCursor": "xyz789abc"
  }
  ```
</ResponseExample>

## Status Codes

* `200` - Busca realizada successfully
* `400` - Invalid parameters or tipo of view faltando
* `401` - Unauthorized
* `500` - Internal server error

## Usage Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wappfy.com.br/api/my-session/channels/search/by-view \
    -H "Content-Type: application/json" \
    -d '{
      "view": "recommended",
      "categories": ["tech"],
      "corntries": ["BR"],
      "page": {
        "limit": 10
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const session = 'my-session';
  const response = await fetch(`https://api.wappfy.com.br/api/${session}/channels/search/by-view`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      view: 'recommended',
      categories: ['tech'],
      corntries: ['BR'],
      page: {
        limit: 10
      }
    })
  });
  const data = await response.json();
  console.log(data.channels);
  ```

  ```python Python theme={null}
  import requests

  session = 'my-session'
  response = requests.post(
    f'https://api.wappfy.com.br/api/{session}/channels/search/by-view',
    json={
      'view': 'recommended',
      'categories': ['tech'],
      'corntries': ['BR'],
      'page': {
        'limit': 10
      }
    }
  )
  data = response.json()
  print(data['channels'])
  ```
</CodeGroup>


## OpenAPI

````yaml viewer-en.json post /api/{session}/channels/search/by-view
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Customizable Server
    variables:
      host:
        default: api.wappfy.com.br
        description: Server URL (e.g., api.wappfy.com.br or your-server.com)
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: Control WhatsApp sessions (accounts)
  - name: 🔑 Auth
    description: Authentication
  - name: 🆔 Profile
    description: Your profile information
  - name: 🖼️ Screenshot
    description: Get WhatsApp screenshot and display QR code
  - name: 📤 Chatting
    description: Conversation methods
  - name: 📢 Channels
    description: Channels (newsletters) methods
  - name: 🟢 Status
    description: Status (aka stories) methods
  - name: 💬 Chats
    description: Conversations methods
  - name: 👤 Contacts
    description: |-
      Contacts methods.<br>
                      Use phone number (without +) or phone number and `@c.us` at the end as `contactId`.<br>
                      E.g: `12312312310` OR `12312312310@c.us`<br>
  - name: 👥 Groups
    description: Groups methods.<br>
  - name: ✅ Presence
    description: Presence information
  - name: 📅 Events
    description: Event Message
  - name: 🏷️ Labels
    description: Labels - available only for WhatsApp Business accounts
  - name: 🔍 Observability
    description: Other methods
  - name: 🗄️ Storage
    description: Storage methods
externalDocs:
  description: Wappfy - WhatsApp API
  url: https://docs.wappfy.com.br/
paths:
  /api/{session}/channels/search/by-view:
    post:
      tags:
        - 📢 Channels
      summary: Search for channels (by view)
      description: The {session} parameter must be the session's instanceName.
      operationId: ChannelsController_searchByView
      parameters:
        - name: session
          required: true
          in: path
          description: Session name (instanceName)
          example: my-session
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelSearchByView'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChannelListResult'
      security:
        - api_key: []
components:
  schemas:
    ChannelSearchByView:
      type: object
      properties:
        view:
          type: string
          default: RECOMMENDED
        countries:
          default:
            - US
          type: array
          items:
            type: string
        categories:
          default: []
          type: array
          items:
            type: string
        limit:
          type: number
          default: 50
        startCursor:
          type: string
          default: ''
      required:
        - view
        - countries
        - categories
        - limit
        - startCursor
    ChannelListResult:
      type: object
      properties:
        page:
          $ref: '#/components/schemas/ChannelPagination'
        channels:
          type: array
          items:
            $ref: '#/components/schemas/ChannelPublicInfo'
      required:
        - page
        - channels
    ChannelPagination:
      type: object
      properties:
        startCursor:
          type: string
          nullable: true
        endCursor:
          type: string
          nullable: true
        hasNextPage:
          type: boolean
        hasPreviousPage:
          type: boolean
      required:
        - startCursor
        - endCursor
        - hasNextPage
        - hasPreviousPage
    ChannelPublicInfo:
      type: object
      properties:
        id:
          type: string
          description: Newsletter id
          example: 123123123123@newsletter
        name:
          type: string
          description: Channel name
          example: Channel Name
        invite:
          type: string
          description: Invite link
          example: https://www.whatsapp.com/channel/111111111111111111111111
        preview:
          type: string
          description: Preview for channel's picture
          example: https://mmg.whatsapp.net/m1/v/t24/An&_nc_cat=10
        picture:
          type: string
          description: Channel's picture
          example: https://mmg.whatsapp.net/m1/v/t24/An&_nc_cat=10
        description:
          type: string
        verified:
          type: boolean
        subscribersCount:
          type: number
      required:
        - id
        - name
        - invite
        - verified
        - subscribersCount
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Your Wappfy API key (get it at dash.wappfy.com.br)

````