URL | Verbs | Fields | Error Codes
Use this endpoint to retrieve previously sent or received messages. This is a read-only endpoint.
https://app.mojotxt.com/api/v1/{phone_number}/messageLog/{verb}
Verb | Description |
---|---|
list | Retrieve a list of incoming/outgoing messages. |
Field | Type | Notes |
---|---|---|
LogID | Integer | A unique identifier for this message. |
Direction | String | "I" if the message is incoming (received from the remote phone) or "O" if the message is outgoing (sent to the remote phone). |
PhoneNumber | String | The phone number of the person who sent/received the message in international format. |
FirstName | String | The first name of the person who sent/received the message. |
LastName | String | The last name of the person who sent/received the message. |
Timestamp | UNIX Timestamp (Integer) | The time when the message was sent/received. |
URLClickTimestamp | UNIX Timestamp (Integer) | If the message contained a MojoTxt-provided URL, this field shows when it was clicked. (Unclicked URLs will have a NULL value.) |
Body | String | The contents of the message body. |
DeliveryStatus | String | The status of a sent message. Will be one of the following:
|
ErrorMessage | String | If the message is in "failed" or "undelivered" status, this field contains a human-readable description of the error (if the carrier provided one). |
Credits | Integer | The number of MojoTxt credits used to send/receive this message. |
Type | String | Either "SMS" or "MMS". |
Media | String | If message is an MMS, a URL to the message's media attachment. |
https://app.mojotxt.com/api/v1/{phone_number}/messageLog/list
Parameters can be sent in the URL querystring.
Parameter | Options | Description |
---|---|---|
Sort | LogID, Timestamp | Sort the list by a field. |
SortDirection | ASC, DESC | Sort Ascending or Descending |
StartTime | UNIX Timestamp (Integer) | Show messages newer than this timestamp. |
EndTime | UNIX Timestamp (Integer) | Show messages older than this timestamp. (Can be used in conjunction with StartTime to specify a range.) |
MessageID | Integer | Show logs for a particular Subscription List message. (Useful to retrieve the delivery information or link click status for a particular outgoing message.) |
Direction | String (either "O" or "I") | Show only Incoming or Outgoing messages. (By default, both are shown.) |
Limit | Integer (1-500), Default: 100 | The maximum number of records to list per page. |
Page | Integer | The page of records to return. |
The following request would show all incoming messages received after 12:16 PM (EDT) on 3/5/2023...
GET https://app.mojotxt.com/api/v1/+16147052760/messageLog/list?StartTime=1678036608&Direction=I
{
"result": "success",
"timestamp": 1680716059,
"request": {
"phone": "+16147052760",
"object": "messageLog",
"verb": "list",
"StartTime": "1678036608",
"Direction": "I"
},
"record_count": 3,
"records": [
{
"LogID": 1911307,
"Direction": "I",
"PhoneNumber": "+15558843215",
"FirstName": null,
"LastName": null,
"Timestamp": 1679528862,
"URLClickTimestamp": null,
"Body": "help",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 0,
"Type": "SMS",
"Media": null
},
{
"LogID": 1911305,
"Direction": "I",
"PhoneNumber": "+15554421154",
"FirstName": "John",
"LastName": "Johnson",
"Timestamp": 1679528847,
"URLClickTimestamp": null,
"Body": "This is an coming message.",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 0,
"Type": "SMS",
"Media": null
},
{
"LogID": 1911303,
"Direction": "I",
"PhoneNumber": "+15553351531",
"FirstName": "Joe",
"LastName": "Hohman",
"Timestamp": 1679528824,
"URLClickTimestamp": null,
"Body": "A family photo :)",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 1,
"Type": "MMS",
"Media": "https://0e14ff136a08c07d7154-b6a01d4d3e4ddab8d8e6109bb8efa0f6.ssl.cf1.rackcdn.com/10/mms-images/0ac2433bf2e07b0fedfebb8bbeea6fbb.jpg"
}
]
}