tommy

Rendered from docs/openapi-sms.json in the repository.

On this page

tommy sms API v1

Captures the SMS and MMS your code sends through a provider API instead of delivering them, and shows each one as a phone-style conversation with the segment count and encoding it would really cost on the wire.

These routes read back what tommy captured, in the shape this content type wants: filters that only mean something here, and the parts that are bytes rather than JSON. They read from the same store as the events API, so a client that sends and immediately fetches sees its own write, and every entry carries the id of the event behind it.

The events API - /api/v1/events, described in its own document - is the generic view of the same captures, and is the one to use when what you are asserting does not depend on the content type. The fake vendor endpoints are described nowhere here: they are the vendors' specifications, not tommy's.

This document is generated from the server's route table. It cannot describe a route that does not exist, and CI fails if the checked-in copy stops matching the code.

Server

  • /api/v1/sms — This tommy's sms API.

Operations

GET /messages Every captured text message, newest first.

Parameters

NameInTypeDescription
provider query string Only entries captured by this provider, such as mailjet.
type query string Only entries of this event type, such as mail.message.
search query string Case-insensitive substring over the summary and type.
since query string RFC3339 timestamp, a duration such as 5m, or unix milliseconds.
limit query integer Maximum number of entries to return.
offset query integer How many entries to skip.
to query string Substring of the recipient number.
from query string Substring of the sender number.
status query string Delivery status the provider reported, such as queued.
direction query string outbound or inbound.
encoding query string GSM-7 or UCS-2.
mms query boolean Only messages that carry media, or only those that do not.

Responses

StatusBodyDescription
200 application/json · array of sms.MessageEnvelope
Success.
400 application/json · api.Error
A query parameter could not be parsed - a malformed since, a negative limit.
DELETE /messages Clear every captured text message.

Responses

StatusBodyDescription
204 no body Done. No body.
GET /messages/{id} One message, with its segment arithmetic and media references.

Parameters

NameInTypeDescription
id required path string The event id, as returned by any listing.

Responses

StatusBodyDescription
200 application/json · sms.MessageEnvelope
Success.
404 application/json · api.Error
No such resource, or it belongs to another plugin.
GET /messages/{id}/media/{idx} One MMS attachment, streamed from the blob store with range support.

Parameters

NameInTypeDescription
id required path string The event id, as returned by any listing.
idx required path string Zero-based index into the attachments or media of that message.

Responses

StatusBodyDescription
200 application/octet-stream
Success.
404 application/json · api.Error
No such resource, or it belongs to another plugin.

Schemas

api.Error

PropertyType
error requiredstring

blob.Ref

PropertyType
content_typestring
filenamestring
id requiredstring
size requiredinteger

sms.Media

PropertyType
blobblob.Ref
content_typestring
filenamestring
urlstring

sms.MediaRef

PropertyType
content_typestring
filenamestring
index requiredinteger
sizeinteger
stored requiredboolean
url requiredstring

sms.Message

PropertyType
body requiredstring
directionstring
fromstring
mediaarray of sms.Media
messaging_servicestring
segments requiredsms.Segments
statusstring
to requiredstring

sms.MessageEnvelope

PropertyType
id requiredstring
mediaarray of sms.MediaRef
message requiredsms.Message
metaobject of any
provider requiredstring
received_at requiredstring (date-time)
type requiredstring
urlstring

sms.Segments

PropertyType
capacity requiredinteger
count requiredinteger
encoding requiredstring
remaining requiredinteger
units requiredinteger