The Text Messages API provides a read-only access to text messages.

JSON format

NameRead OnlyTypeDescription
associated_deal_idstruearrayAn array of ids of deals associated to the text message.
contenttruestringContent of the text message.
created_attruestringDate and time of creation in UTC (ISO8601 format).
idtruenumberUnique identifier of the text message.
incomingtruebooleanIndicator of whether the text message was incoming or not.
resource_idtruenumberUnique identifier of the resource the text message is attached to.
resource_typetruestringName of the resource type the text message is attached to. Possible values: lead, contact, none
resource_phone_numbertruestringPhone number of a resource the text message was sent to/received by.
sent_attruestringDate and time of the message send time in UTC (ISO8601 format).
user_idtruenumberUnique identifier of the user who sent/received the text message.
user_phone_numbertruestringPhone number of the user who sent/received the text message.
updated_attruestringDate and time of the last update in UTC (ISO8601 format).

Retrieve all text messages

GET /v2/text_messages

Returns Text Messages, according to the parameters provided.

Parameters

NameRequiredTypeInDescription
pagefalsenumberQueryPage number to start from. Page numbering starts at 1 and omitting the page parameter will return the first page. Maximum page that can be returned is 1000.
per_pagefalsenumberQueryNumber of records to return per page. The default limit is 25 and the maximum number that can be returned is 100.
idsfalsestringQueryComma-separated list of text message IDs to be returned in request.
resource_typefalsestringQueryName of the type of a resource text messages are attached to. Requires also resource_id to be specified. Possible values: lead, contact
resource_idfalsenumberQueryUnique identifier of a resource text messages are attached to. Requires also resource_type to be specified
sort_byfalsestringQueryA field to sort by. Default ordering is descending. If you want to change the sort ordering to ascending, append :asc to the field e.g. sort_by=id:desc. Possible values: id

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/text_messages \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "items": [    {      "data": {        "id": 1,        "user_id": 1,        "user_phone_number": "+44-208-1234567",        "content": "Schedule another call.",        "incoming": true,        "resource_phone_number": "+44-208-1234567",        "resource_type": "contact",        "resource_id": 7,        "associated_deal_ids": [          12        ],        "send_at": "2016-10-02T11:08:56Z",        "updated_at": "2016-10-03T16:32:56Z",        "created_at": "2016-10-03T16:32:56Z"      },      "meta": {        "type": "text_message"      }    }  ],  "meta": {    "type": "collection",    "count": 1,    "links": {      "self": "http://api.getbase.com/v2/text_messages.json"    }  }}

Retrieve a single text message

GET /v2/text_messages/:id

Returns a single text message available to the user, according to the unique text message ID provided. If the specified text message does not exist, this query returns an error.

Parameters

NameRequiredTypeInDescription
idtruenumberQueryUnique identifier of the text message.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/text_messages/1 \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "user_id": 1,    "user_phone_number": "+44-208-1234567",    "content": "Schedule another call.",    "incoming": true,    "resource_phone_number": "+44-208-1234567",    "resource_type": "contact",    "resource_id": 7,    "associated_deal_ids": [      12    ],    "send_at": "2016-10-02T11:08:56Z",    "updated_at": "2016-10-03T16:32:56Z",    "created_at": "2016-10-03T16:32:56Z"  },  "meta": {    "type": "text_message"  }}