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

# Crear integración

> Crea una nueva integración con tu panel de atención externo

<Warning>
  El `signingSecret` solo se muestra en la respuesta de creación. Guárdelo de forma segura.
</Warning>

## Descripción

Crea una nueva integración entre Jelou y tu panel de atención externo. Al completarse, Jelou generará un `signingSecret` único asociado al proyecto.

## Endpoint

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

## Parámetros de ruta

<ParamField path="projectId" type="string" required>
  Identificador único del proyecto de Jelou al que se asociará la integración.
</ParamField>

## Parámetros del cuerpo

<ParamField body="webhookUrl" type="string" required>
  URL del endpoint en tu sistema que recibirá los eventos enviados por Jelou. Debe ser una URL pública accesible por HTTPS.

  Ejemplo: `https://mi-sistema.com/webhook/jelou`
</ParamField>

## Autenticación

Todas las peticiones deben incluir el encabezado `x-api-key` con la API key del proyecto de Jelou.

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

## Ejemplo de solicitud

El siguiente ejemplo crea una integración para el proyecto `PROJECT_ID`, configurando el webhook.

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

## Respuestas

| Código | Estado                | Descripción                                                                                            |
| ------ | --------------------- | ------------------------------------------------------------------------------------------------------ |
| 200    | OK                    | Integración creada exitosamente. Incluye el `signingSecret`.                                           |
| 422    | Unprocessable Entity  | Los campos enviados en el request contienen valores inválidos o no cumplen las validaciones esperadas. |
| 401    | Unauthorized          | Credenciales de autenticación inválidas o faltantes.                                                   |
| 500    | Internal Server Error | Error interno del servidor.                                                                            |

## Ejemplo de respuesta

```json theme={null}
{
  "message": [
    "Integration created successfully"
  ],
  "statusMessage": "success",
  "status": 1,
  "data": {
    "id": "INTEGRATION_ID",
    "brainId": "PROJECT_ID",
    "webhookUrl": "https://mi-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

````