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

# Test the Webhook Integration

> This endpoint sends sample data to test whether the [configured webhook URL](https://docs.rocket.chat/docs/webhooks) is functioning correctly. Permission required: `view-livechat-webhooks`.

The data you can expect on your webhook for this test follows this format:
```
{
  "type": "LivechatSession",
  "_id": "fasd6f5a4sd6f8a4sdf",
  "label": "title",
  "topic": "asiodojf",
  "createdAt": "2024-09-18T12:22:02.975Z",
  "lastMessageAt": "2024-09-18T12:22:02.975Z",
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ],
  "customFields": {
    "productId": "123456"
  },
  "visitor": {
    "_id": "",
    "name": "visitor name",
    "username": "visitor-username",
    "department": "department",
    "email": "email@address.com",
    "phone": "192873192873",
    "ip": "123.456.7.89",
    "browser": "Chrome",
    "os": "Linux",
    "customFields": {
      "customerId": "123456"
    }
  },
  "agent": {
    "_id": "asdf89as6df8",
    "username": "agent.username",
    "name": "Agent Name",
    "email": "agent@email.com"
  },
  "messages": [
    {
      "username": "visitor-username",
      "msg": "message content",
      "ts": "2024-09-18T12:22:02.975Z"
    },
    {
      "username": "agent.username",
      "agentId": "asdf89as6df8",
      "msg": "message content from agent",
      "ts": "2024-09-18T12:22:02.975Z"
    }
  ]
}
```

## OpenAPI

````json POST /api/v1/livechat/webhook.test
{
  "openapi": "3.0.0",
  "info": {
    "version": "1.0.0",
    "title": "Omnichannel"
  },
  "servers": [
    {
      "url": "https://apiexplorer.support.rocket.chat"
    }
  ],
  "tags": [
    {
      "name": "Omnichannel Users"
    },
    {
      "name": "Omnichannel Agents"
    },
    {
      "name": "Omnichannel Monitors"
    },
    {
      "name": "Omnichannel Visitors"
    },
    {
      "name": "Omnichannel Contacts"
    },
    {
      "name": "Omnichannel Rooms"
    },
    {
      "name": "Omnichannel Departments"
    },
    {
      "name": "Omnichannel Custom Fields"
    },
    {
      "name": "Omnichannel Business Hours"
    },
    {
      "name": "Omnichannel Priorities"
    },
    {
      "name": "Omnichannel Tags"
    },
    {
      "name": "Omnichannel Units"
    },
    {
      "name": "SLA Policies"
    },
    {
      "name": "Canned Responses"
    },
    {
      "name": "Omnichannel Transcript"
    },
    {
      "name": "Omnichannel Statistics"
    },
    {
      "name": "Omnichannel Agent Stats"
    },
    {
      "name": "Omnichannel Dashboards"
    },
    {
      "name": "Reports"
    },
    {
      "name": "Omnichannel Inquiries"
    },
    {
      "name": "Omnichannel Webhooks"
    },
    {
      "name": "Livechat"
    },
    {
      "name": "Livechat Appearance"
    },
    {
      "name": "Livechat Triggers"
    },
    {
      "name": "Livechat Messages"
    },
    {
      "name": "Livechat Page Visited"
    }
  ],
  "paths": {
    "/api/v1/livechat/webhook.test": {
      "post": {
        "summary": "Test the Webhook Integration",
        "tags": [
          "Omnichannel Webhooks"
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/trueSuccess"
          }
        },
        "operationId": "post-api-v1-livechat-webhook.test",
        "description": "This endpoint sends sample data to test whether the [configured webhook URL](https://docs.rocket.chat/docs/webhooks) is functioning correctly. Permission required: `view-livechat-webhooks`.\n\nThe data you can expect on your webhook for this test follows this format:\n```\n{\n  \"type\": \"LivechatSession\",\n  \"_id\": \"fasd6f5a4sd6f8a4sdf\",\n  \"label\": \"title\",\n  \"topic\": \"asiodojf\",\n  \"createdAt\": \"2024-09-18T12:22:02.975Z\",\n  \"lastMessageAt\": \"2024-09-18T12:22:02.975Z\",\n  \"tags\": [\n    \"tag1\",\n    \"tag2\",\n    \"tag3\"\n  ],\n  \"customFields\": {\n    \"productId\": \"123456\"\n  },\n  \"visitor\": {\n    \"_id\": \"\",\n    \"name\": \"visitor name\",\n    \"username\": \"visitor-username\",\n    \"department\": \"department\",\n    \"email\": \"email@address.com\",\n    \"phone\": \"192873192873\",\n    \"ip\": \"123.456.7.89\",\n    \"browser\": \"Chrome\",\n    \"os\": \"Linux\",\n    \"customFields\": {\n      \"customerId\": \"123456\"\n    }\n  },\n  \"agent\": {\n    \"_id\": \"asdf89as6df8\",\n    \"username\": \"agent.username\",\n    \"name\": \"Agent Name\",\n    \"email\": \"agent@email.com\"\n  },\n  \"messages\": [\n    {\n      \"username\": \"visitor-username\",\n      \"msg\": \"message content\",\n      \"ts\": \"2024-09-18T12:22:02.975Z\"\n    },\n    {\n      \"username\": \"agent.username\",\n      \"agentId\": \"asdf89as6df8\",\n      \"msg\": \"message content from agent\",\n      \"ts\": \"2024-09-18T12:22:02.975Z\"\n    }\n  ]\n}\n```",
        "parameters": [
          {
            "$ref": "#/components/parameters/AuthToken"
          },
          {
            "$ref": "#/components/parameters/UserId"
          }
        ]
      }
    }
  },
  "components": {
    "responses": {
      "trueSuccess": {
        "description": "OK",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "success": {
                  "type": "boolean"
                }
              }
            },
            "examples": {
              "Success": {
                "value": {
                  "success": "true"
                }
              }
            }
          }
        }
      }
    },
    "parameters": {
      "AuthToken": {
        "name": "X-Auth-Token",
        "in": "header",
        "description": "The `authToken` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "RScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f"
      },
      "UserId": {
        "name": "X-User-Id",
        "in": "header",
        "description": "The `userId` of the authenticated user.",
        "required": "true",
        "schema": {
          "type": "string"
        },
        "example": "rbAXPnMktTFbNpwtJ"
      }
    }
  }
}
````

