Integrations

Contents

Listing All Integrations

Return a paginated list of all integrations associated with the given company.

API Endpoint

Method URL
GET /v1/companies/{company_id}/integrations.json

Request Parameters

None

Response Fields

Name Type Description
id number Unique identifier for the integration.
Example: 4
type string Describes what type of integration this object represents.
Example: “Webhooks”
state string Current state of the integration. One of “active”, “disabled”, or “failed”.
Example: “active”
config object A sub-object containing specific information about the configuration for the integration. The contents of this object will vary depending on the integration type.

Example

curl -H "Authorization: Token token=abc1234" \
  https://api.callrail.com/v1/companies/238422/integrations.json
{
  "page": 1,
  "per_page": 250,
  "total_pages": 1,
  "total_records": 3,
  [
    {
      "id": 5,
      "config": {
        "api_key": "12345"
      },
      "state": "disabled",
      "type": "PipelineDeals"
    },
    {
      "id": 10,
      "config": {
        "api_key": "12345"
      },
      "state": "active",
      "type": "KissMetrics"
    },
    {
      "id": 4,
      "config": {
        "pre_call_webhook": ["http://example.com/webhook.php"]
      },
      "state": "active",
      "type": "Webhooks"
    }
  ]
  }
  

Retrieving a Single Integration

API Endpoint

Method URL
GET /v1/companies/{company_id}/integrations/{id}.json

Request Parameters

None

Response Fields

Includes all of the above fields.

Creating an Integration

You can use the API to create and activate a new instance of an integration for a company. A company may only have a single integration of a given type. Currently the only types that can be created via the API are Webhooks and Custom integrations.

API Endpoint

Method URL
POST /v1/companies/{company_id}/integrations.json

Request Body

Name Type Required? Description
type string required The type of integration to create. Either Webhooks to create a Webhooks integration, or Custom to create a Custom Cookie Capture integration.
config object required The integration-specific configuration for this integration. See Integration Config.

Response Fields

When successfully created, the response will be 201 CREATED along with the integration body specified above. If an error occurs, the response code will be 4xx or 5xx and include:

Name Type Description
error string Short description of why the request failed.
Example: “Unexpected integration type”

Example

 curl -H "Authorization: Token token=abc1234" \
      -H "Content-Type: application/json"     \   
      -X POST \
      -v \
      -d '{"type": "Webhooks", "config": {"pre_call_webhook":["http://app.example.com/call-conversion.php"]}}' \
      https://api.callrail.com/v1/companies/238422/integrations.json

Updating an Integration

You can update an integration’s configuration via the API.

API Endpoint

Method URL
PUT /v1/companies/{company_id}/integrations/{id}.json

Request Body

Name Type Required? Description
state string optional One of “active”, or “disabled”. Setting to “disabled” will disable the integration.
config object required The integration-specific configuration for this integration. See above for specifics.

Response Fields

When successfully updated, the response will be 204 NO CONTENT. If an error occurs, the response code will be 4xx or 5xx and include:

Name Type Description
error string Short description of why the request failed.
Example: “Unexpected integration type”

Example

 curl -H "Authorization: Token token=abc1234" \
      -H "Content-Type: application/json"     \   
      -X PUT \
      -v \
      -d '{"type": "Webhooks", "config": {"pre_call_webhook":["http://app.example.com/call-conversion.php"]}}' \
      https://api.callrail.com/v1/companies/238422/integrations/2492175.json

Disabling an Integration

API Endpoint

Method URL
DELETE /v1/companies/{company_id}/integrations.json

Request Body

None

Response Fields

When successfully disabled, the response will be 200 OK along with the integration body specified above.