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

# Criar integração

> Cria uma nova integração com seu painel de atendimento externo

<Warning>
  O `signingSecret` é exibido apenas na resposta de criação. Armazene-o com segurança.
</Warning>

## Descrição

Cria uma nova integração entre o Jelou e seu painel de atendimento externo. Ao concluir, o Jelou gerará um `signingSecret` único associado ao projeto.

## Endpoint

```
POST https://gateway.jelou.ai/platform/v1/external-support/{projectId}
```

## Parâmetros de rota

<ParamField path="projectId" type="string" required>
  Identificador único do projeto Jelou ao qual a integração será associada.
</ParamField>

## Parâmetros do corpo

<ParamField body="webhookUrl" type="string" required>
  URL do endpoint no seu sistema que receberá os eventos enviados pelo Jelou. Deve ser uma URL pública acessível via HTTPS.

  Exemplo: `https://meu-sistema.com/webhook/jelou`
</ParamField>

## Autenticação

Todas as requisições devem incluir o cabeçalho `x-api-key` com a API key do projeto Jelou.

```
x-api-key: API_KEY
```

## Exemplo de requisição

O exemplo a seguir cria uma integração para o projeto `PROJECT_ID`, configurando o webhook.

```bash cURL theme={null}
curl --request POST \
  --url https://gateway.jelou.ai/platform/v1/external-support/PROJECT_ID \
  --header 'x-api-key: API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "webhookUrl": "https://meu-sistema.com/webhook/jelou"
  }'
```

## Respostas

| Código | Status                | Descrição                                                                 |
| ------ | --------------------- | ------------------------------------------------------------------------- |
| 200    | OK                    | Integração criada com sucesso. Inclui o `signingSecret`.                  |
| 422    | Unprocessable Entity  | Os campos enviados contêm valores inválidos ou não passam nas validações. |
| 401    | Unauthorized          | Credenciais de autenticação inválidas ou ausentes.                        |
| 500    | Internal Server Error | Erro interno do servidor.                                                 |

## Exemplo de resposta

```json theme={null}
{
  "message": [
    "Integration created successfully"
  ],
  "statusMessage": "success",
  "status": 1,
  "data": {
    "id": "INTEGRATION_ID",
    "brainId": "PROJECT_ID",
    "webhookUrl": "https://meu-sistema.com/webhook/jelou",
    "authType": "no_auth",
    "signingSecret": "SIGNING_SECRET",
    "createdAt": "2026-01-15T10:30:00.000Z"
  }
}
```


## OpenAPI

````yaml POST /v1/external-support/{projectId}
openapi: 3.1.0
info:
  title: Jelou API
  description: >-
    API for the Jelou platform. Send messages, manage campaigns, handle
    conversations, users, databases, and widgets.
  version: 1.0.0
servers:
  - url: https://api.jelou.ai
    description: Production server
security:
  - basicAuth: []
tags:
  - name: Messages
    description: Send messages to users
  - name: Campaigns
    description: HSM campaigns and templates
  - name: Conversations
    description: Chat history and metrics
  - name: Users
    description: User state and cache management
  - name: Resources
    description: Media resource management
  - name: Datum
    description: Database CRUD operations
  - name: Widget
    description: Widget and room management
  - name: PMA Custom
    description: External support panel integration
paths:
  /v1/external-support/{projectId}:
    servers:
      - url: https://gateway.jelou.ai/platform
        description: External Support Panel API
    post:
      tags:
        - External Support Panel
      summary: Create Integration
      description: >-
        Create a new external support panel integration for a specific project.
        A unique signingSecret is generated to verify HMAC-SHA256 signatures.
      operationId: createExternalSupport
      parameters:
        - name: projectId
          in: path
          required: true
          description: Unique identifier of the Jelou project
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExternalSupportRequest'
      responses:
        '200':
          description: Integration created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalSupportResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
      security:
        - apiKey: []
components:
  schemas:
    CreateExternalSupportRequest:
      type: object
      required:
        - webhookUrl
      properties:
        webhookUrl:
          type: string
          format: uri
          description: Webhook URL where events will be sent
          example: https://my-system.com/webhook/jelou
        authType:
          type: string
          enum:
            - bearer
            - api_key
            - basic
            - no_auth
          default: no_auth
          description: Authentication type for invoking the webhook
        authorization:
          type: string
          description: Credentials for authenticating when invoking the webhook
          example: my-secret-token
    ExternalSupportResponse:
      type: object
      properties:
        id:
          type: string
          example: INTEGRATION_ID
        brainId:
          type: string
          example: BRAIN_ID
        webhookUrl:
          type: string
          example: https://my-system.com/webhook/jelou
        authType:
          type: string
          example: bearer
        signingSecret:
          type: string
          example: a1b2c3d4...signing_secret_hex
        createdAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        message:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
        statusMessage:
          type: string
        status:
          type: integer
        error:
          type: object
          properties:
            code:
              type: string
            key:
              type: string
            description:
              type: string
            developerMessages:
              type: object
            clientMessages:
              type: object
        validationError:
          type: object
  responses:
    Unauthorized:
      description: Unauthorized - Invalid authentication credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnprocessableEntity:
      description: Unprocessable entity - Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: Basic authentication using Base64 encoded clientId:clientSecret
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: API key del proyecto de Jelou

````