Referencia de la API

SMS

Lee y envía mensajes SMS/MMS. Requiere permiso de SMS. No disponible en la versión de Google Play.

Definiciones de tipos

bash
type Message {
  id: ID!
  body: String!
  address: String!       # phone number
  date: String!          # ISO 8601
  serviceCenter: String!
  read: Boolean!
  threadId: String!
  type: Int!             # 1=inbox 2=sent 3=draft 5=failed
  subscriptionId: Int!
  isMms: Boolean!
  attachments: [MessageAttachment!]!
}

type MessageAttachment {
  path: String!
  contentType: String!
  name: String!
}

type SmsConversation {
  id: String!
  address: String!
  snippet: String!
  date: String!
  messageCount: Int!
  read: Boolean!
}

type SmsCounts {
  inbox: Int!
  sent: Int!
  draft: Int!
  failed: Int!
}

Operaciones

query

sms

Busca mensajes SMS. Usa una cadena vacía en la consulta para listar todos.

bash
query GetSms($offset: Int!, $limit: Int!, $query: String!) {
  sms(offset: $offset, limit: $limit, query: $query) {
    id body address date read threadId type subscriptionId isMms
    attachments { path contentType name }
  }
}
query

smsCount

Cuenta los mensajes SMS que coinciden con una consulta.

bash
query GetSmsCount($query: String!) {
  smsCount(query: $query)
}
query

smsConversations

Lista las conversaciones SMS (hilos), paginadas.

bash
query GetSmsConversations($offset: Int!, $limit: Int!, $query: String!) {
  smsConversations(offset: $offset, limit: $limit, query: $query) {
    id address snippet date messageCount read
  }
}
query

smsConversationCount

Cuenta las conversaciones SMS que coinciden con una consulta.

bash
query GetSmsConversationCount($query: String!) {
  smsConversationCount(query: $query)
}
query

smsAllCounts

Devuelve los conteos de todas las categorías de SMS.

bash
query GetSmsAllCounts {
  smsAllCounts { inbox sent draft failed }
}
query

archivedConversations

Lista las conversaciones archivadas (ocultas).

bash
query GetArchivedConversations {
  archivedConversations { id address snippet date messageCount read }
}
mutation

sendSms

Envía un SMS. Pasa subscriptionId=-1 para usar la SIM predeterminada.

bash
mutation SendSms($number: String!, $body: String!, $subscriptionId: Int!) {
  sendSms(number: $number, body: $body, subscriptionId: $subscriptionId)
}
mutation

sendMms

Inicia la app de SMS por defecto prellenada con un MMS (uno o más adjuntos). Devuelve un id de MMS pendiente; PlainApp sondea el estado de envío e informa del éxito mediante eventos WebSocket. attachmentPaths debe apuntar a archivos del almacén AppFile de PlainApp (URIs fid:).

bash
mutation SendMms($number: String!, $body: String!, $attachmentPaths: [String!]!, $threadId: String!) {
  sendMms(number: $number, body: $body, attachmentPaths: $attachmentPaths, threadId: $threadId)
}
mutation

archiveSmsConversation

Archive a conversation by thread id; the server derives the snapshot date.

bash
mutation ArchiveSmsConversation($id: String!) {
  archiveSmsConversation(id: $id)
}
mutation

unarchiveSmsConversation

Remove a conversation from the archive.

bash
mutation UnarchiveSmsConversation($id: String!) {
  unarchiveSmsConversation(id: $id)
}