A project web hook is a URL that will be executed when a session is created, updated or deleted. Each project can be configured with a project web hook which can be enabled/disabled at any time, either via the Project Options page or via the API.


GET /api/v1/projects/:project_id/web_hook
Get the project's web hook details.

Returns the web hook configuration for a project.

Examples

{
    "status": "success",
    "message": "success",
    "result": {
        "client_id": 19817472,
        "project_id": 1249918,
        "endpoint": "example.com/web_hook",
        "enable_http_authorization": false,
        "enable_web_hook": true
    }
}

Params

Param name Description
project_id
required

The ID of the project.

Validations:

  • Must be a Integer


PUT /api/v1/projects/:project_id/web_hook
Creates or updates the web hook for a project

Creates a new web hook configuration for a project or updates the existing configuration.

Examples

Example Response:
{
    "status": "success",
    "message": "success",
    "result": {
        "client_id": 19817472,
        "project_id": 1249918,
        "endpoint": "example.com/web_hook",
        "enable_http_authorization": false,
        "enable_web_hook": true,
        "customer_parameters": {
          "key 1": "value 1",
          "key 2": "value 2",
          "key 3": "value 3",
        }
    }
}

Params

Param name Description
project_id
required

The ID of the project.

Validations:

  • Must be a Integer

endpoint
optional

The URL to execute when this web hook is triggered. The HTTPS protocol is automatically enforced to increase security and the endpoint URL should not contain the protocol.

Validations:

  • Must be a String

enable_web_hook
optional

Enables or disables the web hook. Can be “true” (enabled) or “false” (disabled).

Validations:

  • Must be a String

enable_http_authorization
optional

Enables or disables using HTTP Authorization header with the web hook. Can be “true” (enabled) or “false” (disabled).

Validations:

  • Must be a String

http_authorization_value
optional

The value to be added to the HTTP Authorization header when the web hook is executed. This value cannot be retrieved once set. This value can be set to basic authentication, token authentication or other HTTP Authorization values in order to authorize the web hook event for the executed endpoint.

Validations:

  • Must be a String

custom_parameters
optional

A dictionary of key-pair values that will be added to the web hook POST request.

Validations:

  • Must be a Hash


DELETE /api/v1/projects/:project_id/web_hook
Removes the web hook configuration for the project

Removes the web hook configuration for a project.

Examples

{
    "status": "success",
    "message": "success",
    "result": "deleted"
}

Params

Param name Description
project_id
required

The ID of the project.

Validations:

  • Must be a Integer


POST /api/v1/projects/:project_id/web_hook/trigger_session_test
Tests the execution of the project's web hook with a payload containing dummy data with the event type 'session.test'.

Tests the project’s web hook configuration by sending a POST request to the endpoint with a test payload. The test payload will be sent with the session.test event type and a null session_id.

The request will return a Web Hook Event that is created to process the request.

Examples

Example of the POST parameters that are sent to the endpoint.
{
    "client_id": 19817472,
    "project_id": 1249918,
    "session_id": null,
    "event_type": "session.test",
    "event_timestamp": 1512624088.977,
    "custom parameter key 1": "custom parameter value 1",
    "custom parameter key 2": "custom parameter value 2",
    "custom parameter key 3": "custom parameter value 3",
    "ssl_version": 1.2
}
Example response from triggering the test event. Polling can be used to re-request this event until the processing is complete which can be determined by waiting for the response_code and response_message to be populated.
{
    "status": "success",
    "message": "success",
    "result": {
        "id": EVENT_ID,
        "client_id": 19817472,
        "project_id": 1249918,
        "session_id": null,
        "event_type": "session.test",
        "event_timestamp": 1512624088.977,
        "response_code": null,
        "response_message": null
    }
}

Params

Param name Description
project_id
required

The ID of the project.

Validations:

  • Must be a Integer