v1
NotificationService manages sending and receiving notifications.
Send UNARY
Send delivers a notification to a recipient.
Request: SendRequest
| Name | |||||||
|---|---|---|---|---|---|---|---|
recipient | shared.notifications.v1.Recipientshared.notifications.v1.Recipient
recipient is who the notification should be delivered to. | ||||||
subject | stringsubject is the short title of the notification. | ||||||
body | stringbody is the full notification content. | ||||||
scheduled_at | optional shared.notifications.v1.Timestampshared.notifications.v1.Timestamp
scheduled_at optionally schedules delivery for a future time. |
Response: SendResponse
| Name | ||||||
|---|---|---|---|---|---|---|
notification_id | stringnotification_id is the unique identifier assigned to the notification. | |||||
status | shared.notifications.v1.DeliveryStatusshared.notifications.v1.DeliveryStatus
status is the initial delivery status. | |||||
queued_at | shared.notifications.v1.Timestampshared.notifications.v1.Timestamp
queued_at is the time the notification was accepted. |
Errors
INVALID_ARGUMENT
one or more fields failed validation.
Detail type: shared.notifications.v1.ValidationFailurefield string reason string
{
"field": "recipient.email | subject | body",
"reason": "human-readable constraint violation"
}RESOURCE_EXHAUSTED
the caller has exceeded its notification quota.
Detail type: google.rpc.QuotaFailure
{
"violations": [
{
"description": "daily send limit reached.",
"subject": "notifications/day"
},
{
"description": "rate limit exceeded; back off and retry.",
"subject": "notifications/second"
}
]
}NOT_FOUND
the target resource could not be located.
Detail type: google.rpc.ResourceInfo
{
"resource_name": "recipient.user_id",
"resource_type": "Recipient"
}NOT_FOUND
the recipient user does not exist.
FAILED_PRECONDITION
the account is not in a state that allows sending.
Detail type: google.rpc.PreconditionFailure
{
"violations": [
{
"description": "the sending account has been suspended.",
"type": "ACCOUNT_SUSPENDED"
},
{
"description": "the sender email has not been verified.",
"type": "EMAIL_UNVERIFIED"
}
]
}UNAUTHENTICATED
the request could not be authenticated.
Detail type: google.rpc.ErrorInfo
{
"domain": "notifier.example.com",
"reason": "INVALID_TOKEN"
}UNAVAILABLE
the service is temporarily unavailable; retry after the indicated delay.
Detail type: google.rpc.RetryInfo
{
"retry_delay": "5s"
}Subscribe SERVER STREAM
Subscribe opens a live stream of incoming notifications for a user.
Request: SubscribeRequest
| Name | |
|---|---|
user_id | stringuser_id identifies the user whose notifications to stream. |
Response: Notification
| Name | ||||||
|---|---|---|---|---|---|---|
notification_id | stringnotification_id is the unique identifier of the notification. | |||||
subject | stringsubject is the short title of the notification. | |||||
body | stringbody is the full notification content. | |||||
status | shared.notifications.v1.DeliveryStatusshared.notifications.v1.DeliveryStatus
status is the current delivery status. | |||||
sent_at | shared.notifications.v1.Timestampshared.notifications.v1.Timestamp
sent_at is when the notification was originally sent. |
Errors
NOT_FOUND
the user does not exist.
UNAUTHENTICATED
the request could not be authenticated.
Detail type: google.rpc.ErrorInfo
{
"domain": "notifier.example.com",
"reason": "INVALID_TOKEN"
}UNAVAILABLE
the service is temporarily unavailable; retry after the indicated delay.
Detail type: google.rpc.RetryInfo
{
"retry_delay": "5s"
}Acknowledge CLIENT STREAM
Acknowledge bulk-acknowledges a stream of notification IDs.
Request: AcknowledgeRequest
| Name | |
|---|---|
notification_id | stringnotification_id is the ID of the notification to acknowledge. |
Response: AcknowledgeResponse
| Name | |
|---|---|
acknowledged_count | int32acknowledged_count is how many notifications were successfully acknowledged. |
failed_ids | string[]failed_ids contains IDs that could not be acknowledged. |
Errors
NOT_FOUND
one or more notification IDs do not exist.
UNAUTHENTICATED
the request could not be authenticated.
Detail type: google.rpc.ErrorInfo
{
"domain": "notifier.example.com",
"reason": "INVALID_TOKEN"
}Chat BIDI STREAM
Chat opens a bidirectional stream for real-time messaging.
Request: ChatMessage
| Name | |||||
|---|---|---|---|---|---|
sender_id | stringsender_id is the user ID of the message author. | ||||
text | stringtext is the content of the message. | ||||
sent_at | shared.notifications.v1.Timestampshared.notifications.v1.Timestamp
sent_at is when the message was sent. |
Response: ChatMessage
| Name | |||||
|---|---|---|---|---|---|
sender_id | stringsender_id is the user ID of the message author. | ||||
text | stringtext is the content of the message. | ||||
sent_at | shared.notifications.v1.Timestampshared.notifications.v1.Timestamp
sent_at is when the message was sent. |
Errors
NOT_FOUND
the target user for the chat session does not exist.
UNAUTHENTICATED
the request could not be authenticated.
Detail type: google.rpc.ErrorInfo
{
"domain": "notifier.example.com",
"reason": "INVALID_TOKEN"
}RESOURCE_EXHAUSTED
the caller has exceeded its concurrent stream limit.
Detail type: google.rpc.QuotaFailure
{
"violations": [
{
"description": "maximum concurrent chat streams reached.",
"subject": "chat/concurrent_streams"
}
]
}