> ## 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.

# Buscar Canais por Texto

> Buscar canais através de texto (nome ou descrição)

## Descrição

Este endpoint permite buscar canais no WhatsApp usando texto livre. A busca pode ser filtrada por categorias e suporta paginação para navegar pelos resultados.

## Parâmetros de URL

<ParamField path="session" type="string" required>
  ID único da sessão WhatsApp autenticada
</ParamField>

## Corpo da Requisição

<ParamField body="text" type="string" required>
  Texto para buscar nos canais (nome ou descrição)
</ParamField>

<ParamField body="categories" type="array">
  Array de categorias para filtrar a busca (opcional)
</ParamField>

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

  <Expandable title="Propriedades de paginação">
    <ParamField body="limit" type="number" default="10">
      Número máximo de resultados por página (padrão: 10)
    </ParamField>

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

## Resposta

<ResponseField name="channels" type="array">
  Array de canais encontrados
</ResponseField>

<ResponseField name="nextCursor" type="string">
  Cursor para a próxima página de resultados
</ResponseField>

<ResponseExample>
  ```json Requisição theme={null}
  {
    "text": "tecnologia",
    "categories": ["tech", "news"],
    "page": {
      "limit": 10,
      "startCursor": ""
    }
  }
  ```

  ```json Resposta de Sucesso theme={null}
  {
    "channels": [
      {
        "id": "123456789@newsletter",
        "name": "Tech News Brasil",
        "description": "Notícias sobre tecnologia",
        "followersCount": 5420
      },
      {
        "id": "987654321@newsletter",
        "name": "Inovação e Tecnologia",
        "description": "Tendências tecnológicas",
        "followersCount": 3210
      }
    ],
    "nextCursor": "abc123xyz"
  }
  ```
</ResponseExample>

## Códigos de Status

* `200` - Busca realizada com sucesso
* `400` - Parâmetros inválidos ou texto de busca faltando
* `401` - Não autorizado
* `500` - Erro interno do servidor

## Exemplo de Uso

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wappfy.com.br/api/my-session/channels/search/by-text \
    -H "Content-Type: application/json" \
    -d '{
      "text": "tecnologia",
      "categories": ["tech"],
      "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-text`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      text: 'tecnologia',
      categories: ['tech'],
      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-text',
    json={
      'text': 'tecnologia',
      'categories': ['tech'],
      'page': {
        'limit': 10
      }
    }
  )
  data = response.json()
  print(data['channels'])
  ```
</CodeGroup>


## OpenAPI

````yaml viewer.json post /api/{session}/channels/search/by-text
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Servidor Customizável
    variables:
      host:
        default: api.wappfy.com.br
        description: 'URL do servidor (ex: api.wappfy.com.br ou seu-servidor.com)'
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: >-
      Controlar sessões do WhatsApp (contas) (Control WhatsApp sessions
      (accounts))
  - name: 🔑 Auth
    description: Autenticação
  - name: 🆔 Profile
    description: Informações do seu perfil
  - name: 🖼️ Screenshot
    description: Obter captura de tela do WhatsApp e mostrar código QR
  - name: 📤 Chatting
    description: Métodos de conversação
  - name: 📢 Channels
    description: Métodos de canais (newsletters) (Channels (newsletters) methods)
  - name: 🟢 Status
    description: Métodos de status (aka stories) (Status (aka stories) methods)
  - name: 💬 Chats
    description: Métodos de conversas
  - name: 👤 Contacts
    description: >-
      Métodos de contatos. Use número de telefone (sem +) ou número de telefone
      e `@c.us` no final como `contactId`. Ex: `12312312310` OU
      `12312312310@c.us` (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: Métodos de grupos (Groups methods).<br>
  - name: ✅ Presence
    description: Informações de presença
  - name: 📅 Events
    description: Mensagem de Evento
  - name: 🏷️ Labels
    description: Etiquetas - disponível apenas para contas WhatsApp Business
  - name: 🔍 Observability
    description: Outros métodos
  - name: 🗄️ Storage
    description: Métodos de armazenamento
externalDocs:
  description: Wappfy - WhatsApp HTTP API
  url: https://wappfy.com.br/
paths:
  /api/{session}/channels/search/by-text:
    post:
      tags:
        - 📢 Channels
      summary: Pesquisar canais (por texto) (Search for channels (by text))
      description: O parâmetro {session} deve ser o instanceName da sessão.
      operationId: ChannelsController_searchByText
      parameters:
        - name: session
          required: true
          in: path
          description: Nome da sessão (instanceName)
          example: my-session
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChannelSearchByText'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChannelListResult'
      security:
        - api_key: []
components:
  schemas:
    ChannelSearchByText:
      type: object
      properties:
        text:
          type: string
          default: Donald Trump
        categories:
          default: []
          type: array
          items:
            type: string
        limit:
          type: number
          default: 50
        startCursor:
          type: string
          default: ''
      required:
        - text
        - 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: Sua chave de API do Wappfy (obtenha em dash.wappfy.com.br)

````