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

# Timeout Webhook Request Body (Alternate Flow)

> This endpoint must be implemented on YOUR server (e.g., https://yourdomain.com/webhooks/on-timeout). Treble will call this webhook when a timeout occurs in the conversation (the user does not respond within the established time). You must configure the URL of this webhook in the Treble admin panel.

You can also configure the response webhook for the path that exits from a node in case of timeout, also known as alternate flow.

<img src="https://mintcdn.com/trebleai/og8nLWcDGdX1vO72/images/timeout-api-1.png?fit=max&auto=format&n=og8nLWcDGdX1vO72&q=85&s=8a81002020572ba265f9449e40d92576" alt="Configure timeout node webhook" width="2338" height="1348" data-path="images/timeout-api-1.png" />

If you do this, the HTTP request body that is sent to the endpoint configured in Treble will add the following field to the request body:

```json theme={null}
{
    "timeout_at": "2021-10-07 08:53:22.572123"
}
```

The response can also have new variables for the session that can be updated or created for later use in the session. That is, you can add them in the webhook response as part of the `user_session_keys`.


## OpenAPI

````yaml open-api-files/treble-api-en.json POST /webhooks/on-timeout
openapi: 3.0.1
info:
  title: Treble Poll API
  description: Documentation for the poll deployment endpoint in Treble
  version: 1.0.0
servers:
  - url: https://main.treble.ai
    description: Main Treble server
  - url: https://yourdomain.com
    description: >-
      Example server for implementing webhooks. This represents YOUR server
      where you must implement the endpoints that Treble will call.
security: []
tags:
  - name: Webhooks
    description: >-
      Endpoints that Treble will call on your server. These are not real
      endpoints that you can call, but a representation of the webhooks that
      Treble will invoke in your system.
paths:
  /webhooks/on-timeout:
    post:
      tags:
        - Webhooks
      summary: Webhook - When a timeout occurs in the conversation
      description: >-
        This endpoint must be implemented on YOUR server (e.g.,
        https://yourdomain.com/webhooks/on-timeout). Treble will call this
        webhook when a timeout occurs in the conversation (the user does not
        respond within the established time). You must configure the URL of this
        webhook in the Treble admin panel.
      requestBody:
        description: Information of the timeout event
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimeoutEvent'
            example:
              country_code: '+57'
              cellphone: '3161234567'
              session_id: abcsderfwer3252432423-1324325235
              conversation_id: 1234
              question:
                type: open
                text: Hello world
              timeout_at: '2021-10-07 08:53:22.572123'
              user_session_keys:
                - key: age
                  value: '18'
                  type: null
                - key: user_id
                  value: '12345'
                  type: null
      responses:
        '200':
          description: Response to update or add information to the session
          content:
            application/json:
              schema:
                type: object
                description: >-
                  JSON object with the new information that will be replaced or
                  added to the session for future use. The service must respond
                  in less than 10 seconds.
      servers:
        - url: https://yourdomain.com
          description: Your server where you must implement this webhook
components:
  schemas:
    TimeoutEvent:
      type: object
      required:
        - country_code
        - cellphone
        - session_id
        - conversation_id
        - question
        - timeout_at
        - user_session_keys
      description: >-
        Event that is triggered when a timeout occurs in the conversation (the
        user does not respond within the established time)
      properties:
        country_code:
          type: string
          description: Country code of the user
        cellphone:
          type: string
          description: User's phone number without the country code
        session_id:
          type: string
          description: ID of the user's session
        conversation_id:
          type: integer
          description: ID of the conversation
        question:
          $ref: '#/components/schemas/Question'
          description: Question that did not receive a response in time
        timeout_at:
          type: string
          format: date-time
          description: Date and time when the timeout occurred
        user_session_keys:
          type: array
          description: >-
            User session keys collected during the conversation or provided
            during the deployment
          items:
            $ref: '#/components/schemas/ExtendedUserSessionKey'
    Question:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          description: Type of question
          example: open
        text:
          type: string
          description: Text of the question
    ExtendedUserSessionKey:
      type: object
      required:
        - key
        - value
      properties:
        key:
          type: string
          description: Name of the variable
        value:
          type: string
          description: Value of the variable
        type:
          type: string
          nullable: true
          description: >-
            Type of the variable. Can be null or a specific type like
            'location'.

````