Text records

A text record stores information about an SMS which was sent or received.

Fields

class TextRecord
body: string

The body of the SMS. NB: Omitted by default in list/detail responses.

campaign: integer

The campaign the job belongs to.

id: integer

The text record’s unique ID.

job: integer

The text record’s job.

number: string

The SMS recipient’s phone number, in international format.

portal: integer

The portal for which a unique link was included in the SMS.

reference: string

Your reference for this job (e.g. customer ID), which must be unique within the campaign.

state: integer

The SMS’s delivery state.

  • 0 = sent

  • 1 = delivered

  • 2 = failed

  • 3 = rejected

team: integer

The text record’s team.

timestamp: datetime

The text record’s date and time.

API

GET /j/text_records

Retrieves the list of text records.

You must specify a start date and an end date.

Example request:

GET /j/text_records?start=2015-01-06T00:00:00Z&end=2015-01-07T00:00:00Z&team=1 HTTP/1.1
Authorization: Bearer 0a1b2c3d4e5f

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

[
   {
      "campaign": 1,
      "id": 1,
      "job": 1,
      "number": "+33612345678",
      "portal": null,
      "reference": "123456",
      "state": 0,
      "team": 1,
      "timestamp": "2015-01-06T10:21:14.243Z"
    }
]
Request Headers:
Query Parameters:
  • end (datetime) – An end date and time.

  • start (datetime) – A start date and time.

  • team (integer) – An optional team ID.

  • include (string) – comma-separated list of optional fields to include in the response. Supported options: body

Response JSON Array of Objects:
  • body (string) – Optional The body of the SMS. Add body in the include= query parameter to fetch this value.

  • campaign (integer) – The campaign the job belongs to.

  • id (integer) – The text record’s unique ID.

  • job (integer) – The text record’s job.

  • number (string) – The SMS recipient’s phone number, in international format.

  • portal (integer) – The portal for which a unique link was included in the SMS.

  • reference (string) – Your reference for this job (e.g. customer ID), which must be unique within the campaign.

  • state (integer) – The SMS’s delivery state.

  • team (integer) – The text record’s team.

  • timestamp (datetime) – The text record’s date and time.

Status Codes:
  • 200 OK – no error

  • 400 Bad Request – for instance a required field is missing

  • 403 Forbidden – you tried to access a forbidden resource, check you provided a valid OAuth token

POST /j/text_records

Sends a single SMS.

Example request:

POST /j/text_records HTTP/1.1
Authorization: Bearer 0a1b2c3d4e5f
Content-Type: application/json

{
   "body": "Hello there",
   "number": "+33612345678",
   "team": 1
}

Example response:

HTTP/1.1 201 Created
Content-Type: application/json

{
   "campaign": null,
   "id": 1,
   "job": null,
   "number": "+33612345678",
   "portal": null,
   "reference": null,
   "state": 0,
   "team": 1,
   "timestamp": "2016-03-15T19:59:46.625Z"
}
Request Headers:
Request JSON Object:
  • body (string) – The body of the SMS.

  • number (string) – The SMS recipient’s phone number, in international format.

  • team (integer) – The text record’s team.

Response JSON Object:
  • campaign (integer) – The campaign the job belongs to.

  • id (integer) – The text record’s unique ID.

  • job (integer) – The text record’s job.

  • number (string) – The SMS recipient’s phone number, in international format.

  • portal (integer) – The portal for which a unique link was included in the SMS.

  • reference (string) – Your reference for this job (e.g. customer ID), which must be unique within the campaign.

  • state (integer) – The SMS’s delivery state.

  • team (integer) – The text record’s team.

  • timestamp (datetime) – The text record’s date and time.

Status Codes: