Phonewagon API - Phonewagon

Phonewagon API

Getting Started

Introduction

This reference describes PhoneWagon API. Here you can learn about available requests, the parameters you can provide, and response examples.

The reference is divided into sections based on resource types (e.g. Calls). Each section has several methods available (List calls, List sources etc.). The sections consist of several parts containing API method information (Request, Parameters, Response):

Request

Use the method provided in the Request section to make a request to the corresponding URL:

Method URL

Parameters

You can add parameters to each request to get the information you need. The parameters are organized into a table with columns containing the name of the parameter, its data type, whether the parameter is required to get a response, which value options are available for it and any additional notes.

The API supports query string-type HTTP messages with name/value pairs separated by the ampersand (&). So you can put any parameters you need right into the quiery string, like in the following example:

http://api.phonewagon.com/api/resource_name/method?parameter_1=value&parameter_2=value

Response

This section consists of two parts: status code and response body. The response is provided in JSON format:

{
        key: value      
}

Authentication

In order to start using PhoneWagon API you need to get an access token. All the requests should include the token in the Authorization header.

Authorization: Bearer {{access_token}}

Getting access token

Request

POST http://api.phonewagon.com/token

Parameters

NameTypeRequiredOptionsNotes
client_idstringyes Use your client ID as value
client_secretstringyes Use your secret key as value
grant_typestringyes"client_credentials"

Response

The response contains your access token, its type and expiration time.

Status: 200 OK
{
    "access_token": "S_rc8XWbJO2pjyO9qJc_d16abH92dnWfTKTgfiHqu7rjEXXXXXXXXXXXXXXXXall3oAc9vAi6bfgN40AO085ZzbKUgXuNQm75vJwtqm7L3O7VNuX_w78Yh3ObOqcAarPPhfyAngHwgcAWlipizBPzSjUrAlz4P-HGq-CJAn-r77rItKKBdjW_Y8FL9rcApjA_Q_jDMUjJ28",
    "token_type": "bearer",
    "expires_in": 86399913599
}

Use the access token from the response in the Authorization header of each subsequent request.

Format

In the request header, use:

Content-Type: "application/x-www-form-urlencoded"

Calls

List calls

Use this request to get a list of client company calls according to the provided parameters (calls timeline, campaign name etc.).

Request

GET http://api.phonewagon.com/api/calls

Parameters

NameTypeRequiredOptionsNotes
page_startintegeryes1, 2, 3, ...Starting page number
page_sizeintegeryes10, 25, 50, ...The number of records needed
start_datedateyes8/16/2014 (example)Calls list start date
end_datedateyes8/16/2018 (example)Calls list end date
page_sortintegeryes 1 - call receiving time
2 - campaign name
3 - duration
4 - status
5 - call source
6 - customer city
The column used for sorting
page_orderstringyes"asc", "desc"Ascending or descending order
source_idintegeryes0 - unknownCampaign source ID
company_idintegeryes0 - unknownCompany ID
searchstringyes"campaign" (example)Search for content
is_lead_callboolyestrue, falseGet lead calls only

Response

The response contains general information about the listed calls.

Status: 200 OK
{
    "total_records": 2,
    "calls": [
        {
            "TotalRecord": 2,
            "CompanyId": XXXX,
            "CallId": "XXXXXXXXXXXXX",
            "CompanyName": "TestAPI",
            "ContactCity": null,
            "ContactCountry": "IN",
            "CallerName": null,
            "ContactState": "Punjab",
            "CampaignId": 9999,
            "ReceiveCallTime": "2018-02-21T11:54:58.743",
            "CustomerPhoneNumber": "+XXXXXXXX",
            "CustomerCity": null,
            "CallCharge": null,
            "CallNotes": null,
            "CallDirection": "inbound",
            "CallSource": null,
            "CampaignName": "Test API campaign",
            "CampaignNumber": "+14199806397",
            "Status": "no-answer",
            "Duration": 0,
            "RecordingUrl": null,
            "AgentForwardingNumber": "94187990394",
            "CallsTags": [],
            "UTMSource": null,
            "UTMMedium": null,
            "UTMContent": null,
            "UTMCampaign": null,
            "UTMTerm": null,
            "Gclid": null,
            "Keyword": null,
            "MatchType": "-",
            "AdPosition": "-",
            "Device": "-",
            "Network": "-"
            "KeywordId": null
            "GoogleCampaignId": null
            "GoogleAdgroupId": null

        },
        {
            "TotalRecord": 2,
            "CompanyId": XXXX,
            "CallId": "XXXXXXXXXXXXX",
            "CompanyName": "TestAPI",
            "ContactCity": null,
            "ContactCountry": "IN",
            "CallerName": null,
            "ContactState": "Punjab",
            "CampaignId": 9999,
            "ReceiveCallTime": "2018-02-21T11:54:32.933",
            "CustomerPhoneNumber": "+XXXXXXXX",
            "CustomerCity": null,
            "CallCharge": null,
            "CallNotes": null,
            "CallDirection": "inbound",
            "CallSource": null,
            "CampaignName": "Test API campaign",
            "CampaignNumber": "+141598069997",
            "Status": "completed",
            "Duration": 4,
            "RecordingUrl": "https://api.twilio.com/2010-04-01/Accounts/AC249358f2b007901a553b81efd619e94c/Recordings/REc13ee7d1987e441a5b167ba58a3e6d3e",
            "AgentForwardingNumber": "94187990394",
            "CallsTags": [
                {
                    "TagName": "Lead Call",
                    "TagColor": "#41af47"
                }
            ],
            "UTMSource": null,
            "UTMMedium": null,
            "UTMContent": null,
            "UTMCampaign": null,
            "UTMTerm": null,
            "Gclid": null,
            "Keyword": null,
            "MatchType": "-",
            "AdPosition": "-",
            "Device": "-",
            "Network": "-"
            "KeywordId": null
            "GoogleCampaignId": null
            "GoogleAdgroupId": null

        }
    ]
}

List companies

Use this request to get a list of all of your client companies.

Request

GET http://api.phonewagon.com/api/calls

Response

The response contains a list of all the companies with their IDs.

Status: 200 OK
{ 
    [
        {
            "CompanyId": 9999,
            "CompanyName": "TestAPI"
        }
    ]
}

List sources

Use this request to get a list of all the campaigns for a corresponding company.

Request

GET http://api.phonewagon.com/api/calls

Parameters

NameTypeRequiredOptionsNotes
company_idintegeryes Get sources based on company ID

Response

The response contains a list of all the campaigns with their IDs.

Status: 200 OK
{
    [
        {
            "CampaignId": 9999,
            "CampaignName": "Test API campaign"
        }
    ]
}