Message Log

URL | Verbs | Fields | List | Error Codes

Use this endpoint to retrieve previously sent or received messages. This is a read-only endpoint.

URL Scheme

https://app.mojotxt.com/api/v1/{phone_number}/messageLog/{verb}

Available Verbs

VerbDescription
listRetrieve a list of incoming/outgoing messages.

Message Log Object Fields

FieldTypeNotes
LogIDIntegerA unique identifier for this message.
DirectionString"I" if the message is incoming (received from the remote phone) or "O" if the message is outgoing (sent to the remote phone).
PhoneNumberStringThe phone number of the person who sent/received the message in international format.
FirstNameStringThe first name of the person who sent/received the message.
LastNameStringThe last name of the person who sent/received the message.
TimestampUNIX Timestamp (Integer)The time when the message was sent/received.
URLClickTimestampUNIX Timestamp (Integer)If the message contained a MojoTxt-provided URL, this field shows when it was clicked. (Unclicked URLs will have a NULL value.)
BodyStringThe contents of the message body.
DeliveryStatusStringThe status of a sent message.
Will be one of the following:
  • queued - The message is waiting in the outbound delivery queue and will be released to our carrier according to your message campaign limits.
  • transmitted - The message has been sent to our carrier partner and is awaiting delivery to the destination carrier.
  • sending - Our carrier partner is sending the message.
  • sent - The message has been sent to the destination carrier.
  • failed - The message could not be sent due to an error.
  • error - The message could not be sent due to an error.
  • delivered - MojoTxt has received a successful delivery receipt from the destination carrier.
  • undelivered - The destination carrier reported that they did not deliver the message.
ErrorMessageStringIf the message is in "failed", "error" or "undelivered" status, this field contains a human-readable description of the error (if the carrier provided one).
CreditsNumberThe number of MojoTxt credits used to send/receive this message. Can be a fraction.
TypeStringEither "SMS" or "MMS".
MediaStringIf message is an MMS, a URL to the message's media attachment.
PhoneIDIntegerThe id of the subscriber who sent/received the message.
ListMessageIDIntegerThe MessageID of the message this was sent for, if any.
KeywordIDIntegerThe keyword this message is connected to, if any.
ListIDIntegerThe list this message is connected to, if any.
ResponderIDIntegerThe auto-responder this message is connected to, if any.
StatusStringAn internal MojoTxt status code. Use DeliveryStatus to follow delivery.
InboxStatusStringFor a message in your inbox: "U" (unread) or "R" (read).
ErrorCodeIntegerThe carrier's numeric error code, if it provided one.
URLStringThe link attached to this message, if any.

Verb: List

Return a list of messages from the Message Log.

https://app.mojotxt.com/api/v1/{phone_number}/messageLog/list

Parameters:

Parameters can be sent in the URL querystring or as POST variables.

ParameterOptionsDescription
SortLogID, TimestampSort the list by a field.
SortDirectionASC, DESCSort Ascending or Descending
StartTimeUNIX Timestamp (Integer) or ISO dateShow messages from this time onward. An ISO date without a time zone is read as UTC. StartDate is accepted as another name for this parameter.
EndTimeUNIX Timestamp (Integer) or ISO dateShow messages up to this time. (Can be used in conjunction with StartTime to specify a range.) EndDate is accepted as another name for this parameter.
MessageIDIntegerShow logs for a particular message. (Useful to retrieve the delivery information or link click status for a particular outgoing message.)
PhoneIDIntegerShow logs for a particular subscriber.
DirectionString (either "O" or "I")Show only Incoming or Outgoing messages. (By default, both are shown.) The words "in", "inbound", "out" and "outbound" also work.
LimitInteger (1-500), Default: 100The maximum number of records to list per page.
PageIntegerThe page of records to return.

Example Request:

The following request would show all incoming messages received after 12:16 PM Eastern on March 5, 2023.

GET https://app.mojotxt.com/api/v1/+15555550100/messageLog/list?StartTime=1678036608&Direction=I

Example Result:

{
    "result": "success",
    "timestamp": 1793491200,
    "request": {
        "StartTime": "1678036608",
        "Direction": "I",
        "object": "messageLog",
        "verb": "list",
        "phone": "+15555550100"
    },
    "record_count": 3,
    "records": [
        {
            "LogID": 1911307,
            "Direction": "I",
            "PhoneNumber": "+15555550101",
            "FirstName": null,
            "LastName": null,
            "Timestamp": 1679528862,
            "URLClickTimestamp": null,
            "Body": "help",
            "DeliveryStatus": null,
            "ErrorMessage": null,
            "Credits": 0,
            "Type": "SMS",
            "Media": null,
            "PhoneID": 6024,
            "ListMessageID": null,
            "KeywordID": null,
            "ListID": null,
            "ResponderID": null,
            "Status": "S",
            "InboxStatus": "R",
            "ErrorCode": null,
            "URL": null
        },
        {
            "LogID": 1911305,
            "Direction": "I",
            "PhoneNumber": "+15555550102",
            "FirstName": "Jane",
            "LastName": "Example",
            "Timestamp": 1679528847,
            "URLClickTimestamp": null,
            "Body": "This is an incoming message.",
            "DeliveryStatus": null,
            "ErrorMessage": null,
            "Credits": 0,
            "Type": "SMS",
            "Media": null,
            "PhoneID": 6025,
            "ListMessageID": null,
            "KeywordID": null,
            "ListID": null,
            "ResponderID": null,
            "Status": "S",
            "InboxStatus": "R",
            "ErrorCode": null,
            "URL": null
        },
        {
            "LogID": 1911303,
            "Direction": "I",
            "PhoneNumber": "+15555550103",
            "FirstName": "Sam",
            "LastName": "Sample",
            "Timestamp": 1679528824,
            "URLClickTimestamp": null,
            "Body": "A family photo :)",
            "DeliveryStatus": null,
            "ErrorMessage": null,
            "Credits": 1,
            "Type": "MMS",
            "Media": "https://example.com/media/photo.jpg",
            "PhoneID": 6026,
            "ListMessageID": null,
            "KeywordID": null,
            "ListID": null,
            "ResponderID": null,
            "Status": "S",
            "InboxStatus": "R",
            "ErrorCode": null,
            "URL": null
        }
    ]
}

Error Codes

Error CodeEndpointDescriptionNotes
1000-1099API Core(Multiple)See API Error Codes