getBatchResponses

Returns a list of SMS responses for a Batch.

getBatchResponses

Returns a list of SMS responses for a Batch.

Top ↑

Syntax

array getBatchResponses(
    string api_key,
    int batch_id,
  [ array search_criteria,
    int limit,
    int offset,
    string sort_by,
    string sort_order ] 
);

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

batch_id (int)

The Batch ID of the send.

search_criteria (array - optional)

An array of search criteria. See the remarks section below for the list of values which are searchable.
If you do not specify search criteria, all responses are returned.

limit (int - optional)

Maximum number of items to return.

offset (int - optional)

Number of items to skip before beginning to return results. See Using Search Methods for information about using the offset parameter with the limit parameter to include pagination in your results.

sort_by (string - optional)

The name of the value to sort the results by.

sort_order (string - optional)

The order the results are returned in (either ascending or descending). The default is descending. Valid values are:

  • DESC - Sort from highest to lowest (default).
  • ASC - Sort from lowest to highest.

Return Value

Returns an array containing zero or more associative arrays of response details. See the remarks section below for the list of values this method returns.

Examples

$search_criteria = array(
    array('mobile_phone', 'exactly', '61412345678'),
    'OR',
    array('mobile_phone', 'exactly', '61444111222')
);

$api = new Api($url, 'YOURAPIKEY');
$responses = $api->invokeMethod('getBatchResponses', 12345, $search_criteria, 2, 0, 'time', 'ASC');
{
    "id": 3,
    "method": "getBatchResponses",
    "params": [
        "YOURAPIKEY",
        12345,
        [
            [
                "mobile_phone",
                "exactly",
                "61412345678"
            ],
            "OR",
            [
                "mobile_phone",
                "exactly",
                "61444111222"
            ]
        ],
        2,
        0,
        "last_modified_time",
        "DESC"
    ]
}
{
    "id": 3,
    "result": [
        {
            "id": "12345",
            "contact_id": "23874623",
            "send_id": "894372",
            "mobile_phone": "614280287271",
            "updated_field": "Last Response",
            "time": "1141956048",
            "response_text": "yes I'll be there",
            "is_unsubscribed": 1,
            "is_active": 1,
            "last_modified_time": "1141956048"
        }
    ],
}

Remarks

The following table shows the values that are returned.

Key Type Searchable Description
id int Yes The response ID.
contact_id int Yes The Contact ID.
send_id int Yes The Batch send ID
mobile_phone string Yes The Contacts Mobile Number
updated_field string Yes The name of the List Field which was updated
time int Yes Timestamp of when the response was receieved
response_text string Yes The content of the response
is_unsubscribed bool Yes Value indicating if the Contact is unsubscribed
is_active bool Yes Value indicating if the Contact is active
last_modified_time int Yes Timestamp of when the Contact was last modified

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
308 Unable to Load Batch batch_id is not a valid Batch
311 Invalid Search Parameter Format search_critera is not valid

See Also