API リファレンス
SMS
SMS/MMS メッセージの読み取りと送信を行います。SMS 権限が必要です。Google Play 版では利用できません。
型定義
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!
}操作
query
sms
SMS メッセージを検索します。クエリに空文字列を使用するとすべて一覧表示されます。
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
クエリに一致する SMS メッセージの数をカウントします。
bash
query GetSmsCount($query: String!) {
smsCount(query: $query)
}query
smsConversations
SMS 会話 (スレッド) をページ分割で一覧表示します。
bash
query GetSmsConversations($offset: Int!, $limit: Int!, $query: String!) {
smsConversations(offset: $offset, limit: $limit, query: $query) {
id address snippet date messageCount read
}
}query
smsConversationCount
クエリに一致する SMS 会話の数をカウントします。
bash
query GetSmsConversationCount($query: String!) {
smsConversationCount(query: $query)
}query
smsAllCounts
すべての SMS カテゴリのカウントを返します。
bash
query GetSmsAllCounts {
smsAllCounts { inbox sent draft failed }
}query
archivedConversations
アーカイブ (非表示) された会話を一覧表示します。
bash
query GetArchivedConversations {
archivedConversations { id address snippet date messageCount read }
}mutation
sendSms
SMS を送信します。subscriptionId=-1 を渡すとデフォルトの SIM が使用されます。
bash
mutation SendSms($number: String!, $body: String!, $subscriptionId: Int!) {
sendSms(number: $number, body: $body, subscriptionId: $subscriptionId)
}mutation
sendMms
デフォルトの SMS アプリを起動し、MMS (1 つ以上の添付ファイル) を事前入力します。保留中の MMS id を返します。PlainApp は送信状態をポーリングし、WebSocket イベントで成功を報告します。attachmentPaths は PlainApp の AppFile ストア内のファイル (fid: URI) を指す必要があります。
bash
mutation SendMms($number: String!, $body: String!, $attachmentPaths: [String!]!, $threadId: String!) {
sendMms(number: $number, body: $body, attachmentPaths: $attachmentPaths, threadId: $threadId)
}mutation
archiveConversation
スレッド id と日付で会話をアーカイブします。
bash
mutation ArchiveConversation($id: String!, $date: Long!) {
archiveConversation(id: $id, date: $date)
}mutation
unarchiveConversation
会話をアーカイブから削除します。
bash
mutation UnarchiveConversation($id: String!) {
unarchiveConversation(id: $id)
}