Skip to content

REST Resource: projects.messages

Resource: Message

The Message resource. This represents a message, such as an SMS.

JSON representation
{
  "name": string,
  "to": string,
  "from": string,
  "body": string,
  "statusUpdateUrl": string,
  "replyUrl": string,
  "validityPeriodSeconds": number (int32),
  "smartEncoding": boolean,
  "labels": {
    string: string,
    ...
  },
  "classification": enum (MessageClassification),
  "unsubscribeContentBehavior": enum (UnsubscribeContentBehavior),
  "direction": enum (Direction),
  "errorCode": string,
  "errorMessage": string,
  "segmentCount": number (int32),
  "price": {
    object (google.type.Money)
  },
  "status": enum (Status),
  "createIdentity": string,
  "createTime": string (Timestamp),
  "sendTime": string (Timestamp),
  "deliverTime": string (Timestamp),
  "encoding": enum (MessageEncoding)
}
Fields  
name string
Resource name of the message. It must match the pattern projects/*/messages/*
to string
Required. The recipient phone number in +E164.
from string
Required. The phone number in +E164 or alphanumeric sender ID that initiated the message.
body string
The text of the message. Maximum of 1530 characters for messages encoding using GSM 7-bit encoding and 670 characters for messages encoding using UCS2 encoding. If a longer body is specified, it will be truncated to the maximum length.
statusUpdateUrl string
The URL where status updates webhooks should be sent.
replyUrl string
The URL where replies, in the form of incoming message webhooks should be sent. This overrides any message handler URLs defined against the phone number receiving the reply.
validityPeriodSeconds number (int32 format)
How long the message can stay in Enfonica's outgoing message queue, in seconds. Once the message has been accepted by carriers, we cannot guarantee the message will not be queued after this period.
smartEncoding boolean
Whether to automatically reply certain Unicode characters with similar GSM-7 characters.
labels map (key: string, value: string)
You can store any arbitrary data against labels. The maximum key size is 100. The maximum value size is 1000. The maximum number of keys is 50.
classification enum (MessageClassification)
The type of message that this is, such as transactional or marketing.
unsubscribeContentBehavior enum (UnsubscribeContentBehavior)
Whether the body should be modified to include content indicatig how to unsubscribe.
direction enum (Direction)
Output only. The direction of the message. Can be outgoing for messages that are sent or incoming for messages that are received.
errorCode string
Output only. If the outgoing message failed to be delivered, the reason why.
errorMessage string
Output only. The human readable message associated with the error.
segmentCount number (int32 format)
Output only. The number of segments that make up the body.
price object (google.type.Money format)
Output only. The price of this message. This may not be populated until a certain stage in the message lifecycle.
status enum (Status)
Output only. The current status of the message.
createIdentity string
Output only. The identity that created the message. This may be your user or service account, or identities used internally by Enfonica products.
createTime string (Timestamp format)
Output only. The creation time of the message.
sendTime string (Timestamp format)
Output only. The time the message was sent. Only set for outgoing message.
deliverTime string (Timestamp format)
Output only. The time when delivery was confirmed for the message. Only set for outgoing message.
encoding enum (MessageEncoding)
Output only. The encoding used for the body.

Message.MessageClassification

The type of message that this is.

Enums  
MESSAGE_CLASSIFICATION_UNSPECIFIED Unspecified.
UNCLASSIFIED The message is not classified. This message will be checked against unsubscribers before being sent.
TRANSACTIONAL A transactional message. This message will not be checked against unsubscribers before being sent.
MARKETING A marketing message. This message will be checked against unsubscribers before being sent.

Message.UnsubscribeContentBehavior

Behaviour with regards to unsubscribe content within the message.

Enums  
UNSUBSCRIBE_CONTENT_BEHAVIOR_UNSPECIFIED Unspecified.
NONE Do not insert any unsubscribe content within the message.
APPEND_URL Append a short URL to the end of the message body which allows the user to unsubscribe. This will only append the URL, and optionally a whitespace character before the URL.

Example body to use with this paramater:

"This is a marketing message. To unsubscribe:"

Message.Direction

The direction of a message.

Enums  
DIRECTION_UNSPECIFIED Unspecified direction.
OUTGOING An outgoing message.
INCOMING An incoming message

Message.Status

The status of a message.

Enums  
STATUS_UNSPECIFIED Unspecified status.
QUEUED The message has been queued for sending.
SENDING The message is currently being dispatched to an upstream carrier.
SENT The upstream carrier has accepted the message.
FAILED The message failed to be sent within the Enfonica network. For upstream failures, the status will be UNDELIVERED.
DELIVERED The upstream has confirmed message delivery, where available, to the destination handset.
UNDELIVERED The upstream returned a delivery receipt indicating the message was not delivered.
RECEIVED The message is an incoming message that has been received.

Message.MessageEncoding

The encoding of a message body.

Enums  
MESSAGE_ENCODING_UNSPECIFIED Unknown message encoding.
GSM7 GSM 7-bit encoding.
UCS2 UCS-2 encoding.

Methods

Methods  
create POST /v1/{parent}/messages
Creates a Message and queues it for sending. Returns the created message.

The caller must have messaging.messages.create permission on the project.
get GET /v1/{name}
Retrieves a Message identified by the supplied resource name.

The caller must have messaging.messages.get permission on the project.
list GET /v1/{parent}/messages
Lists the Messages of the specified project. List returns Messages sorted by create_time descending.

The caller must have messaging.messages.list permission on the project.