This document includes material copied from the W3C Editor's Draft of the Messaging API from 29 November 2013. Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved. W3C liability, trademark and permissive document license rules apply.
This specification defines a System Level API which offers a simple interface to get access to mobile messaging services. A typical use case of the Messaging API is the implementation of a messaging client application that allows the user to send SMS and MMS messages as well as to access and manage the received SMS and MMS messages.
This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.
This document was produced by the System Applications Working Group. Members of this Working Group have agreed not to progress the Messaging API specification further as a Recommendation track document, electing instead to publish it as an informative Working Group Note under a permissive license with a view to enabling it to form the basis of further work by others, e.g. in a W3C Community Group.
This document was published by the System Applications Working Group as a Working Group Note. If you wish to make comments regarding this document, please send them to public-sysapps@w3.org (subscribe, archives). All comments are welcome.
W3C makes this document available under the terms of the W3C Software and Document License pursuant to W3C's policy for Relicensing Unfinished W3C Specifications. Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.
This document is governed by the 1 August 2014 W3C Process Document.
Navigator
InterfaceMessagingManager
InterfaceSmsManager
InterfaceSmsSegmentInfo
DictionaryMmsManager
InterfaceMmsSendParameters
DictionarySmsMessage
InterfaceMmsMessage
InterfaceMmsContent
DictionaryMmsAttachment
DictionaryMmsDeliveryInfo
DictionaryConversation
InterfaceMessagingCursor
InterfaceReceivedMessage
InterfaceDeliveryReport
InterfaceReadReport
InterfaceMessagingEvent
InterfaceDeliveryReportEvent
InterfaceReadReportEvent
InterfaceServiceChangeEvent
InterfaceMessagingFilter
DictionaryFilterOptions
DictionaryThis section is non-normative.
The Messaging API provides operations to get access to the primitives offered by mobile messaging services (send, receive) as well as those that allow to manage a mobile messaging client inbox (delete, store, mark as read)
An example of use is provided below:
navigator.messaging.sms.send ( '+1234567890', 'How are you?').then( function(message) { window.console.log('Message with identifier ' + message.messageID + ' sent at ' + message.timestamp); }, function(error) { window.console.error('Error: ' + error); } )
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
The key words MAY, MUST, SHALL, SHOULD, and SHOULD NOT are to be interpreted as described in [RFC2119].
This specification defines conformance criteria that apply to a single product: the user agent that implements the interfaces that it contains.
Implementations that use ECMAScript to implement the APIs defined in this specification MUST implement them in a manner consistent with the ECMAScript Bindings defined in the Web IDL specification [WEBIDL], as this specification uses that specification and terminology.
The
EventHandler
interface represents a callback used for event
handlers as defined in [HTML5].
The concepts queue a task and fire an event are defined in [HTML5].
The terms event handler and event handler event types are defined in [HTML5].
The Promise interface, the concepts of a resolver, a resolver's fulfill algorithm and a resolver's reject algorithm are defined in ECMAScript 6 (ECMA-262).
This API must be only exposed to trusted content
MessagingManager
InterfaceThe MessagingManager
interface
represents the initial entry point for getting access to the mobile messaging
services, i.e. SMS and MMS.
interface MessagingManager {
readonly attribute SmsManager
sms;
readonly attribute MmsManager
mms;
Promise findMessages (MessagingFilter
filter, FilterOptions
options);
Promise findConversations (DOMString groupBy, MessagingFilter
filter, FilterOptions
options);
Promise getMessage (DOMString messageID);
Promise deleteMessage (DOMString messageID);
Promise deleteConversation (DOMString conversationID);
Promise markMessageRead (DOMString messageID, boolean value, optional boolean sendReadReport = false);
Promise markConversationRead (DOMString conversationID, boolean value, optional boolean sendReadReport = false);
};
sms
of type SmsManager
, readonly mms
of type MmsManager
, readonly findMessages
filter
parameter and according to the filtering options
described in the options
. It returns a new
Promise
that will be used to notify the caller about
the result of the operation, which is a MessagingCursor to access the set of
messages.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
filter |
| ✘ | ✘ | Filter that identifies the set of messages that are requested to be retrieved |
options |
| ✘ | ✘ | Indicates the filtering options (i.e. sorting criteria, sorting order, limit of results). |
Promise
findConversations
groupBy
parameter.
Only those messages matching the filter described in the filter
parameter SHALL be included in the resulting conversations, what can be
useful for instance to filter just a specific type of messages (e.g. SMS) or
to implement message search in a conversational messaging client. It returns
a new Promise
that will be used to notify the caller
about the result of the operation, which is a MessagingCursor to access the
set of conversations.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
groupBy | DOMString | ✘ | ✘ | Indicates the criteria used to define the conversations. It may have the values 'participants' if a conversation is to be defined as the set of messages exchanged among the same set of parties, and 'subject' if a conversation is to be defined as the set of messages with the same subject. |
filter |
| ✘ | ✘ | Filter that identifies the set of messages that are requested to be included in the resulting conversations. |
options |
| ✘ | ✘ | Indicates the filtering options (i.e. sorting criteria, sorting order, limit of results) to be aplied when filtering the messages to be included in each of the resulting conversations. |
Promise
getMessage
messageID
parameter.
It returns a new Promise
object which allows the
caller to be notified about the result of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
messageID | DOMString | ✘ | ✘ | Identifier of the message that is requested to be retrieved |
Promise
deleteMessage
messageID
parameter. A new Promise
is returned in order to
notify the request result (success or error) to the caller.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
messageID | DOMString | ✘ | ✘ | Identifier of the message that is requested to be deleted |
Promise
deleteConversation
conversationID
parameter. A new Promise
is
returned in order to notify the request result (success or error) to the
caller.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
conversationID | DOMString | ✘ | ✘ | Identifier of the conversation whose messages are requested to be deleted |
Promise
markMessageRead
messageID
parameter. The method returns a new
Promise
that will allow the caller to be notified
about the result (success, error) of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
messageID | DOMString | ✘ | ✘ | Identifier of the message that is requested to be marked as read or unread |
value | boolean | ✘ | ✘ | Indicates whether the message is to be marked as read ('true') or unread ('false') |
sendReadReport | boolean = false | ✘ | ✔ | Indicates that, in case a Read Report was requested, it is to be sent ('true') or not ('false', which is the default) |
Promise
markConversationRead
conversationID
parameter. The method returns a new
Promise
that will allow the caller to be notified about the
result (success, error) of the operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
conversationID | DOMString | ✘ | ✘ | Identifier of the conversation whose messages are requested to be marked as read or unread |
value | boolean | ✘ | ✘ | Indicates whether the messages in the conversation are to be marked as read ('true') or unread ('false') |
sendReadReport | boolean = false | ✘ | ✔ | Indicates that, in case a Read Report was requested for any MMS message in the conversation, a Read Report is to be sent ('true') or not ('false', which is the default) |
Promise
The findMessages
method when invoked MUST run the following steps:
Promise
object and
resolver its associated resolver
filter
parameter and according to the
filtering options described in the options
parameter.
value
argument.
MessagingCursor
object providing access to the results of the retrieval, i.e. the set of
SmsMessage
and/or MmsMessage
elements.
value
argument.
The findConversations
method when invoked MUST
run the following steps:
Promise
object and
resolver its associated resolver
groupBy
parameter, and filtering
the messages included in those conversations according to the filter
included in the filter
parameter and the filtering options
described in the options
parameter.
value
argument.
MessagingCursor
object providing access to the results of the retrieval, i.e. the set of
Conversation
elements.
value
argument.
The getMessage
method when invoked MUST run
the following steps:
Promise
object and
resolver its associated resolver
messageID
parameter passed in the request.
value
argument.
SmsMessage
or
MmsMessage
whose identifier matches the
messageID
parameter.
value
argument.
The deleteMessage
method when invoked MUST run the
following steps:
Promise
object and
resolver its associated resolver
messageID
parameter passed in the request.
value
argument.
messageID
parameter
passed in the request
value
argument.
The deleteConversation
method when invoked MUST
run the following steps:
Promise
object and
resolver its associated resolver
conversationID
parameter passed
in the request.
value
argument.
conversationID
parameter passed in the request
value
argument.
The markMessageRead
method when invoked MUST run
the following steps:
Promise
object and
resolver its associated resolver
value
parameter being respectively 'true' or 'false') the
message with identifier equal to the messageID
parameter
passed in the request, and to send a Read Report if
sendReadReport
is set to 'true'.
value
argument.
messageID
parameter
passed in the request
value
argument.
The markConversationRead
method when invoked
MUST run the following steps:
Promise
object and
resolver its associated resolver
value
parameter being respectively 'true' or 'false') the
messages in the conversation with identifier equal to the
conversationID
parameter passed in the request, and in case
sendReadReport
is set to 'true', to send a Read Report for
each of the MMS messages for which it was requested.
value
argument.
conversationID
parameter passed in the request
value
argument.
SmsManager
InterfaceThe SmsManager
interface represents the SMS messaging service
manager.
interface SmsManager : EventTarget {
readonly attribute MessageType
type;
readonly attribute DOMString[] serviceIDs;
Promise segmentInfo (DOMString text, optional DOMString serviceID);
Promise send (DOMString to, DOMString text, optional DOMString serviceID);
Promise clear (DOMString serviceID);
attribute EventHandler onreceived;
attribute EventHandler onsent;
attribute EventHandler ondeliverysuccess;
attribute EventHandler ondeliveryerror;
attribute EventHandler onserviceadded;
attribute EventHandler onserviceremoved;
};
type
of type MessageType
, readonly serviceIDs
of type array of DOMString, readonly onreceived
of type EventHandler, received
event of type MessagingEvent
,
fired when a new message is received on this messaging service manager.onsent
of type EventHandler, sent
event of type MessagingEvent
, fired
when a new message is sent using this messaging service manager.ondeliverysuccess
of type EventHandler, deliverysuccess
event of type
DeliveryReportEvent
, fired when a new succesful delivery
report is received on this messaging service manager.ondeliveryerror
of type EventHandler, deliveryerror
event of type
DeliveryReportEvent
, fired when a new failure delivery
report is received on this messaging service manager.onserviceadded
of type EventHandler, serviceadded
event of type
ServiceChangeEvent
, fired whenever a new messaging service is enabled
on this messaging service manager.onserviceremoved
of type EventHandler, serviceremoved
event of type
ServiceChangeEvent
, fired when an existing messaging service is
disabled on this messaging service manager.segmentInfo
text
parameter, the number of characters available per segment and the maximum
number of available characters in the last segment.
A Promise
object will be returned in order to notify
the result of the request.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
text | DOMString | ✘ | ✘ | Text intended to be sent as an SMS, whose segmentation information is checked by this method. |
serviceID | DOMString | ✘ | ✔ | Identifier of the service through which the message is would be sent. |
Promise
send
text
parameter to the destination
number indicated in the to
parameter.
A Promise
object will be returned in order to notify
the result of the request.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
to | DOMString | ✘ | ✘ | Destination number for the SMS message. |
text | DOMString | ✘ | ✘ | Content of the SMS message to be sent. |
serviceID | DOMString | ✘ | ✔ | Identifier of the service through which the message is requested to be sent. |
Promise
clear
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
serviceID | DOMString | ✘ | ✘ | Identifies the messaging service all whose messages are requested to be deleted. |
Promise
The send
method when invoked MUST run the following steps:
Promise
object and
resolver its associated resolver
SmsMessage
:
messageID
of smsMessage to the
generated identifier.
type
of smsMessage to 'sms'.
serviceID
of smsMessage to the
identifier of the service used to send the message, i.e. the one passed in
the serviceID
parameter, if provided, or otherwise to the
first item in the serviceIDs
attribute of the
SmsManager
.
from
of smsMessage to the number of the
mobile subscription used to send this SMS message.
read
of smsMessage to 'true'.
to
of smsMessage to the value of the
to
parameter.
body
of smsMessage to the value of the
text
parameter.
messageClass
of smsMessage to 'class1'.
state
of smsMessage to 'sending'.
deliveryStatus
of smsMessage to
'pending' if a delivery report has been requested or to 'not-applicable'
otherwise.
text
parameter to the number of the recipient
indicated in the to
parameter, using the proper service as
described above.
deliveryStatus
of smsMessage to 'error'.
value
argument.
state
of smsMessage to 'sent'.
timestamp
of smsMessage to the
device's date when the SMS message was sent, i.e. when the SMS-SUBMIT
Protocol Data Unit was sent.
value
argument.
sent
with
the message
attribute set to smsMessage.
The segmentInfo
method when invoked MUST run the
following steps:
Promise
object and
resolver its associated resolver
SmsSegmentInfo
.
text
parameter, using the service with identifier equal to the one passed in the
serviceID
parameter, if provided, or otherwise to the first
item in the serviceIDs
attribute of the
SmsManager
.
value
argument.
segments
of smsSegmentInfo to the
number of concatenated SMS segments needed to send the provided text.
charsPerSegment
of smsSegmentInfo to
the number of characters available per SMS segment. This number depends
on the encoding to be used to send the SMS message, which in turn
depends on the language / special characters included in the text.
charsAvailableInLastSegment
of
smsSegmentInfo to the maximum number of available characters in
the last segment that would be needed to send the input string. This
provides useful information to the user on the number of characters that
can type without requiring an additional SMS segment to send the text.
value
argument.
Note that the application that has invoked the segmentInfo
method SHOULD NOT split the text in a set of strings that fit each into a
single SMS segment and send each of them by an independent call to the
sendSMS
method as it would result in different independent SMS
messages being sent, but SHOULD instead send the full message in a single
sendSMS
request. However having information on the number of SMS
segments may be required by the application in order to inform the user (e.g.
in case the length of the text impacts on the price charged for sending the
message).
Upon a new SMS message being received, the user agent MUST:
SmsMessage
.
messageID
of smsMessage to the
generated identifier.
type
of smsMessage to 'sms'.
serviceID
of smsMessage to the
identifier of the service at which the message has been received.
from
of smsMessage to the
sender of the SMS message, i.e. the value of the TP Originating Address
(TP-OA) field of the SMS message [GSM-SMS].
timestamp
of smsMessage to the
timestamp of the SMS message, i.e. the value of the
TP-Service-Centre-Time-Stamp (TP-SCTS) parameter received in the SMS
DELIVER Protocol Data Unit [GSM-SMS].
read
of smsMessage to 'false'.
to
of smsMessage to the recipient of the
SMS message, i.e. the value of the TP Destination Address (TP-DA) field of
the SMS message [GSM-SMS].
messageClass
of smsMessage to the
message class indicated in the TP-Data-Coding-Scheme (TP-DCS) field of the
SMS message [GSM-SMS].
body
element to the text of the received SMS
message, i.e. the value of the SM element contained within the TP User
Data (TP-UD) field of the SMS message [GSM-SMS].
state
of smsMessage to
'received'.
deliveryStatus
of smsMessage to
'not-applicable'.
received
with the message
attribute set to smsMessage.
received
of type ReceivedMessage
with the
message
attribute set to smsMessage.
Upon a delivery report of a previously sent SMS message being received, the user agent MUST
SmsMessage
to which this delivery report is related.
deliveryStatus
parameter of smsMessage
to 'success' or 'error' depending on the reported
result.
deliveryTimestamp
of smsMessage
to the delivery time of the SMS message, i.e. the TP-Discharge-Time (TP
DT) parameter included in the SMS-STATUS-REPORT Protocol Data Unit
[GSM-SMS].
messageID
attribute set to the
messageID
attribute of smsMessage,
serviceID
attribute set to the
serviceID
attribute of smsMessage,
recipients
attribute set to the
to
attribute of smsMessage, and
deliveryTimestamps
attribute set
to delivery time of such message.
DeliveryReport
named deliverysuccess
or
deliveryerror
respectively if the delivery was successfull or
not, with
messageID
attribute set to the
messageID
attribute of smsMessage,
serviceID
attribute set to the
serviceID
attribute of smsMessage, and
recipients
attribute set to the
to
attribute of smsMessage.
deliveryTimestamps
attribute set
to delivery time of such message.
The clear
method when invoked MUST run the following steps:
Promise
object and
resolver its associated resolver
serviceID
parameter.
value
argument.
serviceID
parameter
passed in the request
value
argument.
The following are the event handlers (and their corresponding event types) that MUST be
supported as attributes by the SmsManager
object.
event handler | event name | event type | short description |
---|---|---|---|
onreceived |
received |
MessagingEvent |
handles received messages |
onsent |
sent |
MessagingEvent |
handles sent messages |
ondeliverysuccess |
deliverysuccess |
DeliveryReportEvent |
handles successful delivery reports |
ondeliveryerror |
deliveryerror |
DeliveryReportEvent |
handles failure delivery reports |
onserviceadded |
serviceadded |
ServiceChangeEvent |
handle new messaging services |
onserviceremoved |
serviceremoved |
ServiceChangeEvent |
handle disabled messaging services |
SmsSegmentInfo
DictionaryThe SmsSegmentInfo
dictionary contains information about the
segmentation of a given text to be sent as SMS.
dictionary SmsSegmentInfo {
long segments;
long charsPerSegment;
long charsAvailableInLastSegment;
};
SmsSegmentInfo
Memberssegments
of type long, charsPerSegment
of type long, charsAvailableInLastSegment
of type long, MmsManager
InterfaceThe MmsManager
interface represents the MMS messaging service
manager.
interface MmsManager : EventTarget {
readonly attribute MessageType
type;
readonly attribute DOMString[] serviceIDs;
FetchMode
getFetchMode (optional DOMString serviceID);
void setFetchMode (FetchMode
fetchMode, optional DOMString serviceID);
Promise send (MmsContent
mmsContent, optional MmsSendParameters
sendParameters);
Promise fetch (DOMString messageID);
Promise clear (DOMString serviceID);
attribute EventHandler onreceived;
attribute EventHandler onsent;
attribute EventHandler ondeliverysuccess;
attribute EventHandler ondeliveryerror;
attribute EventHandler onreadsuccess;
attribute EventHandler onreaderror;
attribute EventHandler onserviceadded;
attribute EventHandler onserviceremoved;
};
type
of type MessageType
, readonly serviceIDs
of type array of DOMString, readonly onreceived
of type EventHandler, received
event of type MessagingEvent
,
fired when a new message is received on this messaging service manager.onsent
of type EventHandler, sent
event of type MessagingEvent
, fired
when a new message is sent using this messaging service manager.ondeliverysuccess
of type EventHandler, deliverysuccess
event of type
DeliveryReportEvent
, fired when a new succesful delivery
report is received on this messaging service manager.ondeliveryerror
of type EventHandler, deliveryerror
event of type
DeliveryReportEvent
, fired when a new failure delivery
report is received on this messaging service manager.onreadsuccess
of type EventHandler, readsuccess
event of type
ReadReportEvent
, fired when a new succesful read report is
received on this messaging service manager.onreaderror
of type EventHandler, readerror
event of type
ReadReportEvent
, fired when a new failure read report is received
on this messaging service manager.onserviceadded
of type EventHandler, serviceadded
event of type
ServiceChangeEvent
, fired whenever a new messaging service is enabled
on this messaging service manager.onserviceremoved
of type EventHandler, serviceremoved
event of type
ServiceChangeEvent
, fired when an existing messaging service is
disabled on this messaging service manager.getFetchMode
serviceID
parameter, if
provided, or the first item in the serviceIDs
attribute of
the MmsManager
otherwise).
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
serviceID | DOMString | ✘ | ✔ | Identifier of the service whose fetch mode is queried. |
FetchMode
setFetchMode
serviceID
parameter, if provided, or for all services otherwise, to the mode indicated
in the fetchMode
parameter.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
fetchMode |
| ✘ | ✘ | Fetch mode that is requested to be set for a specific service. |
serviceID | DOMString | ✘ | ✔ | Identifier of the service whose fetch mode is requested to be set. |
void
send
mmsContent
parameter.
A Promise
object will be returned in order to notify the result
of the request.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
mmsContent |
| ✘ | ✘ | Content and recipients of the MMS message to be sent. |
sendParameters |
| ✘ | ✔ | Set of parameters related to the submission of the message (e.g. request of delivery/read report or not). |
Promise
fetch
messageID
parameter from the URL indicated
in the MMS notification. The method returns a new Promise
that
will allow the caller to be notified about the result (success, error) of
the
operation.
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
messageID | DOMString | ✘ | ✘ | Identifier of the MMS message that is requested to be download. |
Promise
clear
Parameter | Type | Nullable | Optional | Description |
---|---|---|---|---|
serviceID | DOMString | ✘ | ✘ | Identifies the messaging service all whose messages are requested to be deleted. |
Promise
The send
method when invoked MUST run the following steps:
Promise
object and
resolver its associated resolver
MmsMessage
and:
messageID
of mmsMessage to the
generated identifier.
type
of mmsMessage to 'mms'.
serviceID
of mmsMessage to the
identifier of the service used to send the message, i.e. the one passed in
the serviceID
parameter in MmsSendParameters
, if
provided, or otherwise to the first item in the serviceIDs
attribute of the MmsManager
.
from
of mmsMessage to the number of the
mobile subscription used to send this MMS message.
read
of mmsMessage to 'true'.
to
of mmsMessage to the to
in the mmsContent
parameter.
cc
of mmsMessage to the cc
array in the mmsContent
parameter.
bcc
of mmsMessage to the
bcc
array in the mmsContent
parameter.
subject
of mmsMessage to the value of
the the subject
parameter in mmsContent
.
smil
of mmsMessage to the value of the
the smil
parameter in mmsContent
.
attachments
of mmsMessage to the value
of the the attachments
array in mmsContent
parameter.
state
of mmsMessage to 'sending'.
deliveryInfo
attribute of
mmsMessage for each unique recipient included in the
to
, cc
and bcc
parameters (i.e. a
single item if the same address has multiple ocurrences across these
parameters), with the recipient
attribute set to this
recipient's address, with the deliveryStatus
attribute set to
'pending', if a delivery report has been requested, or 'not-applicable'
otherwise and with the readStatus
attribute set to 'pending',
if a read report has been requested, or 'not-applicable' otherwise.
content
parameter to the number(s) of indicated
in the to
parameter, using the proper service as described
above and asking for delivery and/or read report if requested.
deliveryStatus
attribute of the different items in the
deliveryInfo
array attribute of mmsMessage to
'error'.
value
argument.
state
of mmsMessage to 'sent'.
timestamp
of mmsMessage to the
device's date when the MMS message was sent, i.e. the date when the
M-Send.req Protocol Data Unit was sent by the MMS Client.
value
argument.
sent
with
the message
attribute set to mmsMessage.
The reception of an MMS message is a two-step process: Firstly, an MMS notification encapsulated in a WAP Push OTA message [OMA-PUSH] is received by the device. This MMS notification contains limited information about the MMS message and a URL where the device can retrieve the full MMS message from. Secondly, the MMS message is retrieved either automatically, i.e. performed right after the reception of the MMS notification, or manually, i.e. invoked manually by the user.
Upon a new MMS notification being received, the user agent MUST:
MmsMessage
.
messageID
of mmsMessage to the
generated identifier.
type
of mmsMessage to 'mms'.
serviceID
of mmsMessage to the
identifier of the service at which the message has been received.
read
of mmsMessage to 'false'.
from
of mmsMessage to the
value of the 'From' field of the MMS notification, if present.
timestamp
of mmsMessage to
the timestamp of the binary SMS message used to transport the MMS
notification, i.e. the value of the TP-Service-Centre-Time-Stamp
(TP-SCTS) parameter received in the SMS-DELIVER Protocol Data Unit
[GSM-SMS].
expiry
of mmsMessage to the value of
the 'X-Mms-Expiry' field of the MMS notification.
to
array of mmsMessage
for each of recipients in the 'To' field of the MMS notification
[MMS13], if present.
cc
array of mmsMessage
for each of recipients in the 'Cc' field of the MMS notification
[MMS13], if present.
bcc
array of
mmsMessage for each of recipients in the 'Bcc' field of the
MMS notification [MMS13], if present.
subject
attribute to the value of the 'Subject'
field of the MMS notification [MMS13], if present.
state
of mmsMessage to
'not-downloaded'.
MmsMessage
object with the data contained in the MMS
message enclosed in the M-Retrieve.conf Protocol Data Unit.
from
of mmsMessage to the
value of the 'From' field of the MMS message [MMS13].
timestamp
of mmsMessage to
the value of the 'Date' field of the MMS message [MMS13].
to
array of
mmsMessage for each of recipients in the 'To' field of
the MMS message [MMS13], if present.
cc
array of
mmsMessage for each of recipients in the 'Cc' field of
the MMS message [MMS13], if present.
bcc
array of
mmsMessage for each of recipients in the 'Bcc' field of
the MMS message [MMS13], if present.
subject
attribute to the value of the 'Subject'
field of the MMS message [MMS13], if present.
smil
attribute to a DOMString
containing the SMIL object of the received MMS message [MMS13],
if present.
attachments
array with:
Blob
object including the actual content
of the attachment and the media type. The charset encoding
is indicated as part of the type
attribute of the
Blob
object by means of appending a
charset
parameter after the media type as
explained in [RFC2046], e.g. "text/plain; charset=utf-8".
contentID
attribute filled with the Content-ID used
to reference this attachment from the SMIL object in the incoming MMS
message [MMS13], if present.
contentLocation
attribute filled with the
Content-Location used to reference this attachment from the SMIL object in
the incoming MMS message [MMS13], if present.
readReportRequested
attribute to 'true'
if the 'X-Mms-Read-Report' field is present in the incoming MMS
message [MMS13] and has the value 'Yes', and to 'false'
otherwise.
state
of mmsMessage to
'received'.
deliveryInfo
array attribute of
mmsMessage for each unique recipient included in the
'To', 'Cc' and 'Bcc' fields (i.e. a single item if the same address
has multiple ocurrences across these parameters), with the
recipient
attribute set to this recipient's address and
the deliveryStatus
attribute set to 'not-applicable'.
received
with the message
attribute set
to mmsMessage.
received
of type ReceivedMessage
with the
message
attribute set to mmsMessage.
The fetch
method can be invoked to fetch an MMS
message that has not been automatically fetched upon receiving the
corresponding MMS notification, e.g. due to the fetch mode being manual. When this
method is invoked the User Agent MUST run the following steps:
Promise
object and
resolver its associated resolver
messageID
parameter passed in the request matches
with an MMS message that has already been fetched, or to an SMS message go
to next step, otherwise let mmsMessage the message with
messageID
attribute equal to the messageID
parameter and set the state
of mmsMessage to
'fetching' and make a request to the system to fetch the MMS message.
value
argument.
value
argument.
An example of manual fetch of an MMS is provided below:
navigator.setMessageHandler ('received', onMessageReceived) function onMessageReceived(message) { if (message.type == 'sms') { window.console.log('SMS Message from ' + message.from + ' received'); } else if (message.type == 'mms') { window.console.log('MMS Message from ' + message.from + ' received'); if (message.state == 'not-downloaded') { window.console.log('MMS Message download started'); navigator.messaging.mms.fetch (message.id).done( function(message) { window.console.log('MMS Message downloaded!');}, function(error) { window.console.error('Error: ' + error);} ); } } }
Upon a delivery report of a previously sent MMS message being received, the user agent MUST
MmsMessage
to which this delivery report is related.
deliveryInfo
array
attribute of mmsMessage whose recipient
attribute matches one of the recipients of the MMS to which the delivery
report is related,
deliveryStatus
attribute:
deliveryTimestamp
attribute to the delivery
time, i.e. the 'Date' field in the M-Delivery.ind Protocol Data Unit
[MMS13], in case of successful delivery.
messageID
attribute set to the
messageID
attribute of mmsMessage,
serviceID
attribute set to the
serviceID
attribute of mmsMessage,
recipients
attribute set to the subset of the
original recipients of mmsMessageto which this delivery
report is related, and
deliveryTimestamps
attribute set to the delivery time of
the MMS message to the corresponding recipient, i.e. that in the
same position of the recipients
array.
DeliveryReport
named deliverysuccess
or
deliveryerror
respectively if the delivery was successfull or
not, with
messageID
attribute set to the
messageID
attribute of mmsMessage,
serviceID
attribute set to the
serviceID
attribute of mmsMessage,
recipients
attribute set to the subset of the
original recipients of mmsMessageto which this delivery
report is related, and
deliveryTimestamps
attribute set to the delivery time of
the MMS message to the corresponding recipient, i.e. that in the
same position of the recipients
array.
Upon a read report of a previously sent MMS message being received, the user agent MUST
MmsMessage
to which this read report is related.
deliveryInfo
array
attribute of mmsMessage whose recipient
attribute matches one of the recipients of the MMS to which the read
report is related,
readStatus
attribute:
readTimestamp
attribute to the read
time, i.e. the 'Date' field in the M-Read-Orig.ind Protocol Data Unit
[MMS13], in case the message has been read.
messageID
attribute set to the
messageID
attribute of mmsMessage,
serviceID
attribute set to the
serviceID
attribute of mmsMessage,
recipients
attribute set to the subset of the
original recipients of mmsMessageto which this read
report is related, and
readTimestamps
attribute set to the read time of
the MMS message by the corresponding recipient, i.e. that in the
same position of the recipients
array.
ReadReport
named readsuccess
or
readerror
respectively if the message has been read or not, with
messageID
attribute set to the
messageID
attribute of mmsMessage,
serviceID
attribute set to the
serviceID
attribute of mmsMessage,
recipients
attribute set to the subset of the
original recipients of mmsMessageto which this read
report is related, and
readTimestamps
attribute set to the read time of
the MMS message by the corresponding recipient, i.e. that in the
same position of the recipients
array.
The clear
method when invoked MUST run the following steps:
serviceID
parameter.
Promise
object and
resolver its associated resolver
value
argument.
serviceID
parameter
passed in the request
value
argument.
The following are the event handlers (and their corresponding event types) that MUST be
supported as attributes by the MmsManager
object.
event handler | event name | event type | short description |
---|---|---|---|
onreceived |
received |
MessagingEvent |
handles received messages |
onsent |
sent |
MessagingEvent |
handles sent messages |
ondeliverysuccess |
deliverysuccess |
DeliveryReportEvent |
handles successful delivery reports |
ondeliveryerror |
deliveryerror |
DeliveryReportEvent |
handles failure delivery reports |
onreadsuccess |
readsuccess |
ReadReportEvent |
handles successful read reports |
onreaderror |
readerror |
ReadReportEvent |
handles failure read reports |
onserviceadded |
serviceadded |
ServiceChangeEvent |
handle new messaging services |
onserviceremoved |
serviceremoved |
ServiceChangeEvent |
handle disabled messaging services |
MmsSendParameters
Dictionarydictionary MmsSendParameters {
optional DOMString serviceID;
boolean requestDeliveryReport;
boolean requestReadReport;
};
MmsSendParameters
MembersserviceID
of type optional DOMString, requestDeliveryReport
of type boolean, requestReadReport
of type boolean, SmsMessage
InterfaceThe SmsMessage
interface represents an SMS message as defined in
[GSM-SMS]. This interface is not intended to represent binary SMS, which
are out of the scope of this API.
interface SmsMessage {
readonly attribute DOMString messageID;
readonly attribute MessageType
type;
readonly attribute DOMString serviceID;
readonly attribute DOMString from;
readonly attribute Date timestamp;
readonly attribute boolean read;
readonly attribute DOMString to;
readonly attribute DOMString body;
readonly attribute SmsState
state;
readonly attribute DeliveryStatus
deliveryStatus;
readonly attribute Date? deliveryTimestamp;
readonly attribute MessageClass
messageClass;
};
messageID
of type DOMString, readonly type
of type MessageType
, readonly serviceID
of type DOMString, readonly from
of type DOMString, readonly timestamp
of type Date, readonly read
of type boolean, readonly to
of type DOMString, readonly body
of type DOMString, readonly state
of type SmsState
, readonly deliveryStatus
of type DeliveryStatus
, readonly deliveryTimestamp
of type Date, readonly , nullablemessageClass
of type MessageClass
, readonly MmsMessage
InterfaceThe MmsMessage
interface represents an MMS message, as defined in
[MMS13].
interface MmsMessage {
readonly attribute DOMString messageID;
readonly attribute MessageType
type;
readonly attribute DOMString serviceID;
readonly attribute DOMString from;
readonly attribute Date timestamp;
readonly attribute unsigned long? expiry;
readonly attribute boolean read;
readonly attribute DOMString[] to;
readonly attribute DOMString[] cc;
readonly attribute DOMString[] bcc;
readonly attribute DOMString subject;
readonly attribute DOMString smil;
readonly attribute MmsAttachment
[]? attachments;
readonly attribute MmsState
state;
readonly attribute MmsDeliveryInfo
[] deliveryInfo;
readonly attribute boolean? readReportRequested;
};
messageID
of type DOMString, readonly type
of type MessageType
, readonly serviceID
of type DOMString, readonly from
of type DOMString, readonly timestamp
of type Date, readonly expiry
of type unsigned long, readonly , nullableread
of type boolean, readonly to
of type array of DOMString, readonly cc
of type array of DOMString, readonly bcc
of type array of DOMString, readonly subject
of type DOMString, readonly smil
of type DOMString, readonly attachments
of type array of MmsAttachment
, readonly , nullablestate
of type MmsState
, readonly deliveryInfo
of type array of MmsDeliveryInfo
, readonly readReportRequested
of type boolean, readonly , nullableMmsContent
Dictionarydictionary MmsContent {
DOMString subject;
DOMString[] to;
DOMString[] cc;
DOMString[] bcc;
DOMString smil;
MmsAttachment
[] attachments;
};
MmsContent
Memberssubject
of type DOMString, to
of type array of DOMString, to
,
cc
or bcc
attributes.cc
of type array of DOMString, to
,
cc
or bcc
attributes.bcc
of type array of DOMString, to
,
cc
or bcc
attributes.smil
of type DOMString, attachments
of type array of MmsAttachment
, MmsAttachment
Dictionarydictionary MmsAttachment {
DOMString contentID;
DOMString contentLocation;
Blob content;
};
MmsAttachment
MemberscontentID
of type DOMString, contentLocation
of type DOMString, content
of type Blob, MmsDeliveryInfo
Dictionarydictionary MmsDeliveryInfo {
DOMString recipient;
DeliveryStatus
deliveryStatus;
Date deliveryTimestamp;
ReadStatus
readStatus;
Date readTimestamp;
};
MmsDeliveryInfo
Membersrecipient
of type DOMString, deliveryStatus
of type DeliveryStatus
, deliveryTimestamp
of type Date, readStatus
of type ReadStatus
, readTimestamp
of type Date, Conversation
InterfaceThe Conversation
interface represents a set of messages that are
grouped together either because they are exchanged among the same set of
participants or because they have the same subject.
interface Conversation {
readonly attribute DOMString conversationID;
readonly attribute MessageType
type;
readonly attribute DOMString[] participants;
readonly attribute DOMString subject;
readonly attribute DOMString[] messageTypes;
readonly attribute unsigned long messageCount;
readonly attribute unsigned long unreadCount;
readonly attribute DOMString lastMessageID;
readonly attribute MessageCursor cursor;
};
conversationID
of type DOMString, readonly type
of type MessageType
, readonly participants
of type array of DOMString, readonly subject
of type DOMString, readonly messageTypes
of type array of DOMString, readonly messageCount
of type unsigned long, readonly unreadCount
of type unsigned long, readonly lastMessageID
of type DOMString, readonly cursor
of type MessageCursor, readonly MessageCursor
to access the messages in
this conversation.MessagingCursor
InterfaceThe MessagingCursor
interface allows to iterate through a list of
Conversation
elements or of messages (SmsMessage
and/or MmsMessage
elements).
A MessagingCursor
always has, an associated request which
is the Promise that created it.
As soon as the MessagingCursor
is accessing an element,
it MUST put its associated request in the 'processing'
readyState
, and set the result
to null. Then, the UA
MUST fetch the next/previous element asynchronously. When the element is
retrieved, the associated request's readyState
must be set
to 'done' and the result
must point to the cursor. If no element
was found, the cursor's element
property must return null.
interface MessagingCursor {
readonly attribute any? element;
void next ();
void previous ();
};
element
of type any, readonly , nullablenext
"InvalidStateError"
error as defined in [DOM4].
void
previous
"InvalidStateError"
error as defined in [DOM4].
void
ReceivedMessage
InterfaceThe ReceivedMessage
interface represents a system message related to
a received message. This event is originated from the system and will start
the application if it is not currently running.
The application that consumes this API SHOULD set a message handler for the
ReceivedMessage
system message to listen for when a system
message related to a received message is fired.
interface ReceivedMessage {
readonly attribute (SmsMessage
or MmsMessage
) message;
};
message
of type (SmsMessage or MmsMessage), readonly SmsMessage
or MmsMessage
object to which this system message is related.DeliveryReport
InterfaceThe DeliveryReport
interface represents a system message related to
a delivery report of a sent message. This event is originated from the system
and will start the application if it is not currently running.
The application that consumes this API MAY set a message handler for the
DeliveryReport
system message to listen for when a system
message related to a received delivery report is fired.
interface DeliveryReport {
readonly attribute DOMString serviceID;
readonly attribute DOMString messageID;
readonly attribute DOMString[] recipients;
readonly attribute Date[]? deliveryTimestamps;
};
serviceID
of type DOMString, readonly messageID
of type DOMString, readonly recipients
of type array of DOMString, readonly deliveryTimestamps
of type array of Date, readonly , nullablerecipients
array. It MUST return null if case of delivery
failure (e.g. message expired)
ReadReport
InterfaceThe ReadReport
interface represents a system message related to
a read report of a sent MMS message. This event is originated from the system
and will start the application if it is not currently running.
The application that consumes this API MAY set a message handler for the
ReadReport
system message to listen for when a system
message related to a received read report is fired.
interface ReadReport {
readonly attribute DOMString serviceID;
readonly attribute DOMString messageID;
readonly attribute DOMString[] recipients;
readonly attribute Date[]? readTimestamps;
};
serviceID
of type DOMString, readonly messageID
of type DOMString, readonly recipients
of type array of DOMString, readonly readTimestamps
of type array of Date, readonly , nullablerecipients
array.
MessagingEvent
InterfaceThe MessagingEvent
interface represents events related to a message
sent or received.
interface MessagingEvent {
readonly attribute (SmsMessage
or MmsMessage
) message;
};
message
of type (SmsMessage or MmsMessage), readonly SmsMessage
or MmsMessage
object to which this event is related.DeliveryReportEvent
InterfaceThe DeliveryReportEvent
interface represents events related
to a delivery report of a sent message.
interface DeliveryReportEvent : Event {
readonly attribute DOMString serviceID;
readonly attribute DOMString messageID;
readonly attribute DOMString[] recipients;
readonly attribute Date[]? deliveryTimestamps;
};
serviceID
of type DOMString, readonly messageID
of type DOMString, readonly recipients
of type array of DOMString, readonly deliveryTimestamps
of type array of Date, readonly , nullablerecipients
array. It MUST return null if case of delivery
failure (e.g. message expired)
ReadReportEvent
InterfaceThe ReadReportEvent
interface represents events related
to a read report of a sent message.
interface ReadReportEvent : Event {
readonly attribute DOMString serviceID;
readonly attribute DOMString messageID;
readonly attribute DOMString[] recipients;
readonly attribute Date[]? readTimestamps;
};
serviceID
of type DOMString, readonly messageID
of type DOMString, readonly recipients
of type array of DOMString, readonly readTimestamps
of type array of Date, readonly , nullablerecipients
array.
ServiceChangeEvent
InterfaceThe ServiceChangeEvent
interface represents events related to
messaging services enabled or disabled.
interface ServiceChangeEvent : Event {
readonly attribute DOMString serviceID;
};
serviceID
of type DOMString, readonly MessagingFilter
DictionaryThe MessagingFilter
Dictionary represents a filter that is used to
select a set of messages (e.g. to be provided upon invoking the
findMessages
or the findConversations
method in the
Messaging
interface).
dictionary MessagingFilter {
MessageType
type;
Date startDate;
Date endDate;
DOMString from;
sequence<DOMString> recipients;
(SmsState
or MmsState
) state;
DOMString serviceID;
boolean read;
};
MessagingFilter
Memberstype
of type MessageType
, startDate
of type Date, endDate
of type Date, from
of type DOMString, recipients
of type sequence<DOMString>, state
of type (SmsState or MmsState), serviceID
of type DOMString, read
of type boolean, FilterOptions
Dictionarydictionary FilterOptions {
DOMString sortBy;
DOMString sortOrder;
unsigned long limit;
};
FilterOptions
MemberssortBy
of type DOMString, sortOrder
of type DOMString, limit
of type unsigned long, The attibute type
can have the following values:
enum MessageType {
"sms",
"mms"
};
Enumeration description | |
---|---|
sms | Corresponding to SMS message(s). |
mms | Corresponding to MMS message(s). |
The attibute messageClass
in an SmsMessage
can have
the following values:
enum MessageClass {
"class-0",
"class-1",
"class-2",
"class-3",
"normal"
};
Enumeration description | |
---|---|
class-0 | The message is of class 0. |
class-1 | The message is of class 1. |
class-2 | The message is of class 2. |
class-3 | The message is of class 3. |
normal | The message is of class 1 (same as 'class-1'). |
The attibute state
in an SmsMessage
can have
the following values:
enum SmsState {
"received",
"sending",
"sent",
"failed"
};
Enumeration description | |
---|---|
received | The message is an inbound message. |
sending | The message is in process of being sent. |
sent | The message has been successfully sent. |
failed | The message is an outbound message whose submission has failed. |
The attibute state
in an MmsMessage
can have
the following values:
enum MmsState {
"not-downloaded",
"fetching",
"received",
"sending",
"sent",
"failed"
};
Enumeration description | |
---|---|
not-downloaded | The message is an inbound message, for which an MMS notification has been received but that has not yet been downloaded. |
fetching | The message is an inbound message, for which an MMS notification has been received, and whose download has started and not yet finished. |
received | The message is an inbound message. |
sending | The message is in process of being sent. |
sent | The message has been successfully sent. |
failed | The message is an outbound message whose submission has failed. |
The attibute deliveryStatus
can have the following values:
enum DeliveryStatus {
"success",
"pending",
"error",
"not-applicable"
};
Enumeration description | |
---|---|
success | The message has been succesfully delivered to the recipient. |
pending | The message is pending delivery. |
error | The delivery of the message has failed. |
not-applicable | The delivery status is not applicable either because a delivery report has not been requested or because the message is an inbound message |
The attibute readStatus
can have the following values:
enum ReadStatus {
"success",
"pending",
"error",
"not-applicable"
};
Enumeration description | |
---|---|
success | The message has been read by the recipient. |
pending | There is no positive knowledge that the message has been read by the recipient. |
error | The delivery of the message has failed. |
not-applicable | The read status is not applicable either because a read report has not been requested or because the message is an inbound message |
The MMS fetch mode can have the following values:
enum FetchMode {
"automatic",
"automatic-home",
"manual",
"never"
};
Enumeration description | |
---|---|
automatic | MMS message is fecthed right after the reception of the MMS notification. |
automatic-home | MMS message is fecthed right after the reception of the MMS notification if the device is located in the home network, i.e. not roaming, otherwise the message will be fetched upon the device entering in the home network again or the user manually requesting it. |
manual | The message is not fecthed until the user manually requests it. |
never | MMS message retrieval is completely disabled. |
The editors would like to express their gratitude to the Mozilla B2G Team and specially to Jonas Sicking, Mounir Lamouri and Vicamo Yang for their technical guidance, implementation work and support.