# generated by fastapi-codegen:
# filename: openapi.yaml
# timestamp: 2025-06-29T07:36:03+00:00
from __future__ import annotations
from enum import Enum
from typing import Any, Dict, List, Optional, Union
from pydantic import BaseModel, Field, RootModel, conint, constr
class Audio(BaseModel):
url: str = Field(..., examples=['https://example.com/audio.mp3'])
class MessageType(Enum):
audio = 'audio'
class WhatsappReferredProduct(BaseModel):
catalog_id: str = Field(
...,
description="The ID of the catalog associated with the product from the `product` message being quoted or replied to using the 'Message Business' option.",
examples=['1267260820787549'],
)
product_retailer_id: str = Field(
...,
description="The ID of the product from the `product` message being quoted or replied to using the 'Message Business' option.",
examples=['r07qei73l7'],
)
class Context(BaseModel):
message_from: str = Field(
...,
description="The phone number of the **original sender** of the message being quoted in the [E.164](https://en.wikipedia.org/wiki/E.164) format. Not present in a `context` object which is the result of a user selecting 'Message Business' in a `product` message.",
examples=['447700900000'],
)
message_uuid: str = Field(
...,
description="The UUID of the message being quoted. Not present in a `context` object which is the result of a user selecting 'Message Business' in a `product` message.",
examples=['aaaaaaaa-bbbb-cccc-dddd-0123456789ab'],
)
whatsapp_referred_product: Optional[WhatsappReferredProduct] = Field(
None,
description="An object containing details of a product from a `product` message being quoted or replied to using the 'Message Business' option.\n",
)
class MessageType1(Enum):
custom = 'custom'
class ErrorChannel(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The specified channel is not supported.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Unsupported channel']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1100'],
)
class InvalidParameter(BaseModel):
name: Optional[str] = Field(
None, description='Name of invalid parameter', examples=['messenger.category']
)
reason: Optional[str] = Field(
None,
description='Reason of failure',
examples=['Must be one of `response`, `update` or `message_tag`.'],
)
class ErrorChannelParams(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The value of one or more parameters is invalid.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
invalid_parameters: Optional[List[InvalidParameter]] = None
title: str = Field(
...,
description='Generic error message',
examples=['Invalid channel parameters'],
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1110'],
)
class ErrorClientReference(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The client reference can be a string of up to 40 characters.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Invalid client reference']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1060'],
)
class ErrorInternal(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['There was an error processing your request in the Platform.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Internal error']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1000'],
)
class ErrorInvalidJson(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=[
'Unexpected character (\'"\' (code 34)): was expecting comma to separate Object entries'
],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
...,
description='Generic error message',
examples=['The request body did not contain valid JSON'],
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors#invalid-json'],
)
class InvalidParameter1(BaseModel):
name: Optional[str] = Field(
None, description='Name of invalid parameter', examples=['image.url']
)
reason: Optional[str] = Field(
None, description='Reason of failure', examples=['is required.']
)
class ErrorMessageParams(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The value of one or more parameters is invalid.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
invalid_parameters: Optional[List[InvalidParameter1]] = None
title: str = Field(
..., description='Generic error message', examples=['Invalid params']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1150'],
)
class ErrorMessageType(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The `to` parameter is invalid for the given channel.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Invalid message type']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1140'],
)
class ErrorPaymentRequired(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=[
'This request could not be performed due to your account balance being low.'
],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Low balance']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/#low-balance'],
)
class ErrorRecipient(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The `to` parameter is invalid for the given channel.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Invalid recipient']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#110'],
)
class ErrorSender(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['The `from` parameter is invalid for the given channel.'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Invalid sender']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1120'],
)
class ErrorThrottled(BaseModel):
detail: str = Field(
...,
description='Additional information about the error',
examples=['Please wait, then retry your request'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
..., description='Generic error message', examples=['Rate Limit Hit']
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1000'],
)
class ErrorUnauthorizedInvalidApplication(BaseModel):
detail: Optional[str] = Field(
None,
description='Additional information about the error',
examples=['Check your API key is correct and has been whitelisted'],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
...,
description='Generic error message',
examples=[
'The crendentials provided do not have access to the requested product'
],
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/#unprovisioned'],
)
class ErrorUnauthorizedMissingCredentials(BaseModel):
detail: Optional[str] = Field(
None,
description='Additional information about the error',
examples=[
"Check that you're using the correct credentials, and that your account has this feature enabled"
],
)
instance: str = Field(
...,
description='Internal Trace ID',
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: str = Field(
...,
description='Generic error message',
examples=['You did not provide correct credentials.'],
)
type: str = Field(
...,
description='Link to error / remediation options',
examples=['https://developer.nexmo.com/api-errors/#unathorized'],
)
class File(BaseModel):
url: str = Field(..., examples=['https://example.com/file.pdf'])
class MessageType2(Enum):
file = 'file'
class FromId(RootModel[constr(min_length=1, max_length=50)]):
root: constr(min_length=1, max_length=50) = Field(
..., description='The ID of the message sender\n', examples=['9876543210']
)
class FromNumber(RootModel[str]):
root: str = Field(
...,
description="The phone number of the message **sender** in the [E.164](https://en.wikipedia.org/wiki/E.164) format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000. For SMS in certain localities alpha-numeric sender id's will work as well, see [Global Messaging](https://developer.nexmo.com/messaging/sms/guides/country-specific-features#country-specific-features) for more details\n",
examples=['447700900001'],
)
class Image(BaseModel):
url: str = Field(
...,
description='The publicly accessible URL of the image attachment. The image file is available for 48 hours after it is created. Supported types are .jpg, .jpeg, and .png',
examples=['https://example.com/image.jpg'],
)
class MessageType3(Enum):
image = 'image'
class Channel(Enum):
messenger = 'messenger'
class Channel1(Enum):
viber_service = 'viber_service'
class Context1(BaseModel):
message_uuid: Optional[str] = Field(
None,
description='The ID of the message being replied to.',
examples=['1234567890abcdef'],
)
class Location(BaseModel):
address: Optional[str] = Field(
None,
description='Address of the location. Only displayed if `name` is present.',
examples=['23 Main St, Holmdel, NJ 07733, USA'],
)
lat: float = Field(
..., description='Latitude of the location.', examples=[40.34772]
)
long: float = Field(
..., description='Longitude of the location.', examples=[-74.18847]
)
name: Optional[str] = Field(
None, description='Name of the location.', examples=['Vonage']
)
class MessageType4(Enum):
location = 'location'
class MessageUuid(RootModel[str]):
root: str = Field(
...,
description='The UUID of the message',
examples=['aaaaaaaa-bbbb-cccc-dddd-0123456789ab'],
)
class MessageType5(Enum):
order = 'order'
class ProductItem(BaseModel):
currency: Optional[str] = Field(
None,
description='The currency code representing the currency for this specific item.',
examples=['USD'],
)
item_price: Optional[str] = Field(
None, description='The unit price for this specific item.', examples=['9.99']
)
product_retailer_id: Optional[str] = Field(
None,
description='The ID of the specific product being ordered.',
examples=['pk1v7rudbg'],
)
quantity: Optional[str] = Field(
None, description='The quantity ordered for this specific item.', examples=['1']
)
class Order(BaseModel):
catalog_id: str = Field(
...,
description='The ID of the catalog containing the products in this order.',
examples=['2806150799683508'],
)
product_items: List[ProductItem]
class Profile(BaseModel):
name: str = Field(
...,
description="The WhatsApp number's displayed profile name",
examples=['Jane Smith'],
)
class MessageType6(Enum):
reply = 'reply'
class Reply(BaseModel):
description: Optional[str] = Field(
None,
description='A description that may be added to the interactive options presented (available only on interactive lists).',
examples=['Select 9am appointmaent time'],
)
id: str = Field(
...,
description='An identifier to help identify the exact interactive message response.',
examples=['row1'],
)
title: str = Field(
...,
description='The title displayed on the interactive option chosen.',
examples=['9am'],
)
class MessageType7(Enum):
template = 'template'
class TemplateParameters(RootModel[List[str]]):
root: List[str] = Field(
...,
description='The parameters are an array of strings, with the first string being used for {{1}} in the template, with the second being {{2}} etc. Only required if the template specified by `name` contains parameters.',
examples=[['Verification', '2526', '5']],
)
class MessageType8(Enum):
text = 'text'
class Timestamp(RootModel[str]):
root: str = Field(
...,
description='The datetime of when the event occurred, in `ISO 8601` format.',
examples=['2020-01-01T14:00:00.000Z'],
)
class ToId(RootModel[constr(min_length=1, max_length=50)]):
root: constr(min_length=1, max_length=50) = Field(
..., description='The ID of the message recipient\n', examples=['0123456789']
)
class ToNumber(RootModel[constr(min_length=7, max_length=15)]):
root: constr(min_length=7, max_length=15) = Field(
...,
description="The phone number of the message **recipient** in the [E.164](https://en.wikipedia.org/wiki/E.164) format. Don't use a leading + or 00 when entering a phone number, start with the country code, for example, 447700900000.\n",
examples=['447700900000'],
)
class MessageType9(Enum):
unsupported = 'unsupported'
class Currency(Enum):
EUR = 'EUR'
class Usage(BaseModel):
currency: Optional[Currency] = Field(
None, description='The charge currency in ISO 4217 format.', examples=['EUR']
)
price: Optional[str] = Field(
None,
description='The charge amount as a stringified number.',
examples=['0.0333'],
)
class MessageType10(Enum):
video = 'video'
class Video(BaseModel):
url: str = Field(
...,
description='Publicly accessible URL of the video attachment. Supports file types .mp4 and .3gpp\n> Note: Only supports video codec H.264 and audio codec AAC\n',
examples=['https://example.com/video.mp4'],
)
class BaseMessageType(BaseModel):
client_ref: Optional[str] = Field(
None,
description='Client reference of up to 100 characters. The reference will be present in every message status.',
)
class Channel2(Enum):
messenger = 'messenger'
class Category(Enum):
response = 'response'
update = 'update'
message_tag = 'message_tag'
class Messenger(BaseModel):
category: Optional[Category] = Field(
None,
description='The use of different category tags enables the business to send messages for different use cases. For Facebook Messenger they need to comply with their [Messaging Types policy](https://developers.facebook.com/docs/messenger-platform/send-messages#messaging_types). Vonage maps our `category` to their `messaging_type`. If `message_tag` is used, then an additional `tag` for that type is mandatory. By default Vonage sends the `response` category to Facebook Messenger.',
examples=['response'],
)
tag: Optional[str] = Field(
None,
description='A tag describing the type and relevance of the 1:1 communication between your app and the end user. A full list of available tags is available [here](https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags)',
examples=['CONFIRMED_EVENT_UPDATE'],
)
class ChannelOptionsMessenger(BaseModel):
channel: Optional[Channel2] = Field(
None,
description='The channel to send to. You must provide `messenger` in this field',
examples=['messenger'],
)
from_: Optional[FromId] = Field(None, alias='from')
messenger: Optional[Messenger] = None
to: Optional[ToId] = None
class Channel3(Enum):
mms = 'mms'
class ChannelOptionsMms(BaseModel):
channel: Optional[Channel3] = Field(
None,
description='The channel to send to. You must provide `mms` in this field',
examples=['mms'],
)
from_: Optional[FromNumber] = Field(None, alias='from')
to: Optional[ToNumber] = None
class Channel4(Enum):
sms = 'sms'
class ChannelOptionsSms(BaseModel):
channel: Optional[Channel4] = Field(
None,
description='The channel to send to. You must provide `sms` in this field',
examples=['sms'],
)
from_: Optional[FromNumber] = Field(None, alias='from')
to: Optional[ToNumber] = None
class Channel5(Enum):
viber_service = 'viber_service'
class Category1(Enum):
transaction = 'transaction'
promotion = 'promotion'
class ViberService(BaseModel):
category: Optional[Category1] = Field(
None,
description='The use of different category tags enables the business to send messages for different use cases. For Viber Business Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Vonage sends the `transaction` category to Viber Business Messages.',
)
ttl: Optional[conint(ge=30, le=259200)] = Field(
None,
description='Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.',
examples=[600],
)
type: Optional[str] = Field(
None,
description='Viber-specific type definition. To use "template", please contact your Vonage Account Manager to setup your templates. To find out more please visit the [product page](https://www.vonage.com/communications-apis/messages/)',
)
class ChannelOptionsViber(BaseModel):
channel: Optional[Channel5] = Field(
None,
description='The channel to send to. You must provide `viber_service` in this field',
examples=['viber_service'],
)
from_: Optional[FromId] = Field(None, alias='from')
to: Optional[ToNumber] = None
viber_service: Optional[ViberService] = None
class ViberService1(BaseModel):
category: Optional[Category1] = Field(
None,
description='The use of different category tags enables the business to send messages for different use cases. For Viber Business Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Vonage sends the `transaction` category to Viber Business Messages.',
)
duration: Optional[str] = Field(
None, description='The duration of the video in seconds.', examples=['123']
)
file_size: Optional[str] = Field(
None, description='The file size of the video in MB.', examples=['1']
)
ttl: Optional[conint(ge=30, le=259200)] = Field(
None,
description='Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.',
examples=[600],
)
type: Optional[str] = Field(
None,
description='Viber-specific type definition. To use "template", please contact your Vonage Account Manager to setup your templates. To find out more please visit the [product page](https://www.vonage.com/communications-apis/messages/)',
)
class ChannelOptionsViberVideo(BaseModel):
channel: Optional[Channel5] = Field(
None,
description='The channel to send to. You must provide `viber_service` in this field',
examples=['viber_service'],
)
from_: Optional[FromId] = Field(None, alias='from')
to: Optional[ToNumber] = None
viber_service: Optional[ViberService1] = None
class Action(BaseModel):
text: Optional[constr(max_length=30)] = Field(
None,
description='Text which is rendered on the action button.',
examples=['Find out more'],
)
url: Optional[str] = Field(
None,
description='A URL which is requested when the action button is clicked.',
examples=['https://example.com/page1.html'],
)
class ViberService2(BaseModel):
action: Optional[Action] = Field(None, description='Node for Viber action buttons.')
category: Optional[Category1] = Field(
None,
description='The use of different category tags enables the business to send messages for different use cases. For Viber Business Messages the first message sent from a business to a user must be personal, informative & a targeted message - not promotional. By default Vonage sends the `transaction` category to Viber Business Messages.',
)
ttl: Optional[conint(ge=30, le=259200)] = Field(
None,
description='Set the time-to-live of message to be delivered in seconds. i.e. if the message is not delivered in 600 seconds then delete the message.',
examples=[600],
)
type: Optional[str] = Field(
None,
description='Viber-specific type definition. To use "template", please contact your Vonage Account Manager to setup your templates. To find out more please visit the [product page](https://www.vonage.com/communications-apis/messages/)',
)
class ChannelOptionsViberWithButton(BaseModel):
channel: Optional[Channel5] = Field(
None,
description='The channel to send to. You must provide `viber_service` in this field',
examples=['viber_service'],
)
from_: Optional[FromId] = Field(None, alias='from')
to: Optional[ToNumber] = None
viber_service: Optional[ViberService2] = None
class Channel8(Enum):
whatsapp = 'whatsapp'
class ChannelOptionsWhatsapp(BaseModel):
channel: Optional[Channel8] = Field(
None,
description='The channel to send to. You must provide `whatsapp` in this field',
examples=['whatsapp'],
)
from_: Optional[FromNumber] = Field(None, alias='from')
to: Optional[ToNumber] = None
class Channel9(Enum):
mms = 'mms'
class InboundMessageMMS(BaseModel):
channel: Channel9 = Field(
..., description='The channel the message came in on', examples=['mms']
)
from_: FromNumber = Field(..., alias='from')
message_uuid: MessageUuid
timestamp: Timestamp
to: ToNumber
class Channel10(Enum):
sms = 'sms'
class Sms(BaseModel):
keyword: Optional[str] = Field(
None,
description='The first word of the message sent to uppercase.',
examples=['HELLO'],
)
num_messages: Optional[str] = Field(
None,
description='The number of inbound SMS messages concatenated together to comprise this message. SMS messages are 160 characters, if an inbound message exceeds that size they are concatenated together to forma single message. This number indicates how many messages formed this webhook.',
examples=['2'],
)
class InboundMessageSMS(BaseModel):
channel: Channel10 = Field(
..., description='The channel the message came in on', examples=['sms']
)
from_: FromNumber = Field(..., alias='from')
message_uuid: MessageUuid
sms: Optional[Sms] = Field(None, description='Channel specific metadata for SMS')
text: str = Field(
...,
description='The UTF-8 encoded text of the inbound message.\n',
examples=['Hello From Vonage!'],
)
timestamp: Timestamp
to: ToNumber
usage: Optional[Usage] = None
class Channel11(Enum):
whatsapp = 'whatsapp'
class InboundWhatsAppMessageCommon(BaseModel):
channel: Channel11 = Field(
...,
description='The channel that the message came in on',
examples=['whatsapp'],
)
context: Optional[Context] = None
from_: FromNumber = Field(..., alias='from')
message_uuid: MessageUuid
profile: Optional[Profile] = None
provider_message: Optional[str] = Field(
None,
description='A message from the channel provider, which may contain a description, error codes or other information',
)
timestamp: Timestamp
to: ToNumber
class Error(BaseModel):
detail: Optional[str] = Field(
None,
description='Text describing the error. See [our errors list](https://developer.nexmo.com/api-errors/messages-olympus) for a list of possible errors',
examples=[
'Throttled - You have exceeded the submission capacity allowed on this account. Please wait and retry'
],
)
instance: Optional[str] = Field(
None,
description="The record id of this error's occurrence.",
examples=['bf0ca0bf927b3b52e3cb03217e1a1ddf'],
)
title: Optional[str] = Field(
None,
description='The error code encountered when sending the message. See [our errors list](https://developer.nexmo.com/api-errors/messages-olympus) for a list of possible errors',
examples=[1000],
)
type: Optional[str] = Field(
None,
description='The type of error encountered, follow URL for more details',
examples=['https://developer.nexmo.com/api-errors/messages-olympus#1000'],
)
class Status(Enum):
submitted = 'submitted'
delivered = 'delivered'
rejected = 'rejected'
undeliverable = 'undeliverable'
class Usage1(BaseModel):
currency: Optional[Currency] = Field(
None, description='The charge currency in ISO 4217 format.', examples=['EUR']
)
price: Optional[str] = Field(
None,
description='The charge amount as a stringified number.',
examples=['0.0333'],
)
class MessageStatusBase(BaseModel):
client_ref: Optional[str] = Field(
None,
description='Client reference of up to 100 characters. The reference will be present in every message status.',
)
error: Optional[Error] = Field(
None,
description='If the message encountered a problem a descriptive error will be supplied in this object.',
)
from_: FromNumber = Field(..., alias='from')
message_uuid: MessageUuid
status: Status = Field(
..., description='The status of the message.', examples=['submitted']
)
timestamp: str = Field(
...,
description='The datetime of when the event occurred, in `ISO 8601` format.',
examples=['2020-01-01T14:00:00.000Z'],
)
to: ToNumber
usage: Optional[Usage1] = None
class Channel12(Enum):
mms = 'mms'
class MessageStatusMMS(MessageStatusBase):
channel: Optional[Channel12] = Field(
None, description='The channel sending to.', examples=['mms']
)
class Channel13(Enum):
messenger = 'messenger'
class Status1(Enum):
submitted = 'submitted'
delivered = 'delivered'
rejected = 'rejected'
undeliverable = 'undeliverable'
read = 'read'
class MessageStatusMessenger(MessageStatusBase):
channel: Optional[Channel13] = Field(
None, description='The channel sending to.', examples=['messenger']
)
from_: Optional[FromId] = Field(None, alias='from')
status: Optional[Status1] = Field(None, examples=['read'])
to: Optional[ToId] = None
class Channel14(Enum):
sms = 'sms'
class MessageStatusSMS(MessageStatusBase):
channel: Optional[Channel14] = Field(
None, description='The channel sending to.', examples=['sms']
)
class Channel15(Enum):
viber_service = 'viber_service'
class MessageStatusViber(MessageStatusBase):
channel: Optional[Channel15] = Field(
None, description='The channel sending to.', examples=['viber_service']
)
status: Optional[Status1] = Field(None, examples=['read'])
class Channel16(Enum):
whatsapp = 'whatsapp'
class Usage2(BaseModel):
currency: Optional[Currency] = Field(
None, description='The charge currency in ISO 4217 format.', examples=['EUR']
)
price: Optional[str] = Field(
None,
description='The charge amount as a stringified number. For WhatsApp this is the default Vonage charge per conversation.',
examples=['0.0333'],
)
class Origin(BaseModel):
type: Optional[str] = Field(
None, description='The conversation type.', examples=['user_initiated']
)
class Conversation(BaseModel):
id: Optional[str] = Field(
None, description='The id of the conversation.', examples=['1234567890']
)
origin: Optional[Origin] = Field(
None,
description='An object contining data related to the origin of the conversation.',
)
class Whatsapp(BaseModel):
conversation: Optional[Conversation] = Field(
None,
description='An object contining data for the conversation to which the message relates.',
)
class MessageStatusWhatsApp(MessageStatusBase):
channel: Optional[Channel16] = Field(
None, description='The channel sending to.', examples=['whatsapp']
)
status: Optional[Status1] = Field(None, examples=['read'])
usage: Optional[Usage2] = None
whatsapp: Optional[Whatsapp] = Field(
None,
description='An object contining meta-data related to the WhatsApp message that triggered this callback. Only present for callbacks with a `status` of `delivered`.',
)
class MessageType11(Enum):
vcard = 'vcard'
class Vcard(BaseModel):
url: str = Field(
...,
description='The publicly accessible URL of the vCard attachment. Supported types are .vcf only',
examples=['https://example.com/conatact.vcf'],
)
class VCard(BaseMessageType):
message_type: Optional[MessageType11] = Field(
None,
description='The type of message to send. You must provide `vcard` in this field',
examples=['vcard'],
)
vcard: Vcard
class Image2(BaseModel):
caption: Optional[constr(min_length=1, max_length=2000)] = Field(
None,
description='Additional text to accompany the image.',
examples=['Additional text to accompany the image.'],
)
url: str = Field(
...,
description='The URL of the image attachment.\n\nSupports `.jpg`, `.jpeg`, `.png` and `.gif`.\n',
examples=['https://example.com/image.jpg'],
)
class Vcard1(BaseModel):
url: str = Field(
...,
description='The URL of the vCard attachment.\n\nSupports `.vcf` only.\n',
examples=['https://example.com/contact.vcf'],
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest3(VCard, ChannelOptionsMms):
vcard: Optional[Vcard1] = None
class Audio2(BaseModel):
caption: Optional[constr(min_length=1, max_length=2000)] = Field(
None,
description='Additional text to accompany the audio file.',
examples=['Additional text to accompany the audio file.'],
)
url: str = Field(
...,
description='The URL of the audio attachment.\n',
examples=['https://example.com/audio.mp3'],
)
class MessageType12(Enum):
audio = 'audio'
class MessageType13(Enum):
video = 'video'
class Video2(BaseModel):
caption: Optional[constr(min_length=1, max_length=2000)] = Field(
None,
description='Additional text to accompany the video file.',
examples=['Additional text to accompany the video file.'],
)
url: str = Field(
...,
description='The URL of the video attachment.\n',
examples=['https://example.com/video.mp4'],
)
class Image3(BaseModel):
caption: Optional[constr(min_length=1, max_length=3000)] = Field(
None,
description='Additional text to accompany the image.',
examples=['Additional text to accompany the image.'],
)
url: str = Field(
...,
description='The URL of the image attachment.\n\nSupports `.jpg`, `.jpeg`, and `.png`.\n',
examples=['https://example.com/image.jpg'],
)
class Audio3(BaseModel):
url: Any = Field(
...,
description='The URL of the audio attachment.\n\nSupports `.aac`, `.m4a`, `.amr`, `.mp3` and `.opus`.\n',
)
class Video3(BaseModel):
caption: Optional[str] = Field(
None,
description='Additional text to accompany the file.',
examples=['Additional text.'],
)
url: Any = Field(
...,
description='The URL of the video attachment.\n\nSupports `.mp4` and `.3gpp`. Note, only `H.264` video codec and `AAC` audio codec is supported.\n',
)
class File2(BaseModel):
caption: Optional[str] = Field(
None,
description='Additional text to accompany the file.',
examples=['Additional text.'],
)
url: Any = Field(
...,
description='The URL of the file attachment.\n\nSupports supports a wide range of attachments including `.zip`, `.csv` and `.pdf`.\n',
)
class Policy(Enum):
deterministic = 'deterministic'
class Whatsapp1(BaseModel):
locale: str = Field(
...,
description='The [BCP 47](https://en.wikipedia.org/wiki/IETF_language_tag) language of the template. See [the WhatsApp documentation](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages-) for supported languages.',
examples=['en_US'],
)
policy: Optional[Policy] = Field(
None,
description='Policy for resolving what language template to use. As of right now the only valid choice is `deterministic`.',
examples=['deterministic'],
)
class Image4(BaseModel):
url: Optional[str] = Field(
None,
description='The URL of the image attachment.\n\nSupports `.jpg`, `.jpeg`, `.png` and `.gif`.\n',
examples=['https://example.com/image.jpg'],
)
class Audio4(BaseModel):
url: Optional[Any] = Field(
None,
description='The URL of the audio attachment.\n\nOnly supports `.mp3` files\n',
)
class Video4(BaseModel):
url: Optional[Any] = Field(
None,
description='The URL of the video attachment.\n\nSupports `.mp4` files. Note, only `H.264` video codec and `AAC` audio codec is supported.\n',
)
class File3(BaseModel):
url: Optional[Any] = Field(
None,
description='The URL of the file attachment.\n\nSupports a wide range of attachments including `.zip`, `.csv` and `.pdf`.\n',
)
class Image5(BaseModel):
caption: Optional[str] = Field(
None,
description='A caption to accompany the image. Required if the message includes an action button.',
examples=['Check out this new promotion'],
)
url: Optional[str] = Field(
None,
description='The URL of the image attachment.\n\nSupports `.jpg`, `.jpeg`, and `.png`.\n',
examples=['https://example.com/image.jpg'],
)
class Video5(BaseModel):
caption: Optional[str] = Field(
None,
description='Text caption to accompany message.',
examples=['Check out this new video'],
)
thumb_url: constr(max_length=1000) = Field(
...,
description='URL to an image file for a thumbnail preview of the video.',
examples=['https://example.com/file1.jpg'],
)
url: str = Field(
...,
description='The URL of the video attachment.',
examples=['https://example.com/image.jpg'],
)
class File4(BaseModel):
name: Optional[constr(max_length=25)] = Field(
None,
description='The name and extension of the file.',
examples=['example.pdf'],
)
url: Optional[str] = Field(
None,
description='The URL for the file attachment *or* the path for the location of the file attachement. If `name` is included, can just be the path. If `name` is not included, must include the filename and extension.',
examples=['https://example.com/files/'],
)
class FieldDatamodelCodeGeneratorRootSpecialPostResponse1(BaseModel):
message_uuid: Optional[MessageUuid] = None
class FieldDatamodelCodeGeneratorRootSpecialPostResponse(
RootModel[FieldDatamodelCodeGeneratorRootSpecialPostResponse1]
):
root: FieldDatamodelCodeGeneratorRootSpecialPostResponse1
class FieldDatamodelCodeGeneratorRootSpecialPostResponse6(
RootModel[
Union[ErrorUnauthorizedMissingCredentials, ErrorUnauthorizedInvalidApplication]
]
):
root: Union[
ErrorUnauthorizedMissingCredentials, ErrorUnauthorizedInvalidApplication
]
class FieldDatamodelCodeGeneratorRootSpecialPostResponse7(
RootModel[
Union[
ErrorInvalidJson,
ErrorChannel,
ErrorChannelParams,
ErrorSender,
ErrorRecipient,
ErrorMessageType,
ErrorMessageParams,
ErrorClientReference,
]
]
):
root: Union[
ErrorInvalidJson,
ErrorChannel,
ErrorChannelParams,
ErrorSender,
ErrorRecipient,
ErrorMessageType,
ErrorMessageParams,
ErrorClientReference,
]
class Audio1(BaseMessageType):
audio: Audio
message_type: Optional[MessageType] = Field(
None,
description='The type of message to send. You must provide `audio` in this field',
examples=['audio'],
)
class Custom(BaseMessageType):
custom: Optional[Dict[str, Any]] = Field(
None,
description='A custom payload, which is passed directly to WhatsApp for certain features such as templates and interactive messages. The schema of a custom object can vary widely. [Read more about Custom Objects](https://developer.vonage.com/messages/concepts/custom-objects).',
)
message_type: Optional[MessageType1] = Field(
None,
description='The type of message to send. You must provide `custom` in this field',
examples=['custom'],
)
class File1(BaseMessageType):
file: File
message_type: Optional[MessageType2] = Field(
None,
description='The type of message to send. You must provide `file` in this field',
examples=['file'],
)
class Image1(BaseMessageType):
image: Image
message_type: Optional[MessageType3] = Field(
None,
description='The type of message to send. You must provide `image` in this field',
examples=['image'],
)
class InboundMessengerMessageCommon(BaseModel):
channel: Channel = Field(
...,
description='The channel that the message came in on',
examples=['messenger'],
)
from_: FromId = Field(..., alias='from')
message_uuid: MessageUuid
timestamp: Timestamp
to: ToId
class InboundViberMessageCommon(BaseModel):
channel: Channel1 = Field(
...,
description='The channel that the message came in on',
examples=['viber_service'],
)
context: Optional[Context1] = Field(
None,
description='Object containing contextual details for the inbound message when it is a response to another message.',
)
from_: FromNumber = Field(..., alias='from')
message_uuid: MessageUuid
timestamp: Timestamp
to: ToId
class Location1(BaseMessageType):
location: Location
message_type: Optional[MessageType4] = Field(
None,
description='The type of message to send. You must provide `location` in this field',
examples=['location'],
)
class Order1(BaseMessageType):
message_type: Optional[MessageType5] = Field(
None, description='The type of message to send.', examples=['order']
)
order: Order
class Reply1(BaseMessageType):
message_type: Optional[MessageType6] = Field(
None,
description='The type of message to send. You must provide `custom` in this field.',
examples=['reply'],
)
reply: Reply
class Template(BaseModel):
name: str = Field(
...,
description='The name of the template. For WhatsApp use your WhatsApp namespace (available via Facebook Business Manager), followed by a colon : and the name of the template to use.',
examples=['9b6b4fcb_da19_4a26_8fe8_78074a91b584:verify'],
)
parameters: Optional[TemplateParameters] = None
class Template1(BaseMessageType):
message_type: Optional[MessageType7] = Field(
None,
description='The type of message to send. You must provide `template` in this field',
examples=['template'],
)
template: Template
class Text(BaseMessageType):
message_type: Optional[MessageType8] = Field(
None,
description='The type of message to send. You must provide `text` in this field',
examples=['text'],
)
text: str = Field(
..., examples=['Nexmo Verification code: 12345.<br />Valid for 10 minutes.']
)
class Unsupported(BaseMessageType):
message_type: MessageType9 = Field(
...,
description='The type of message to send. Will be `unsupported` if the type of message received from user is not supported by the channel.',
examples=['unsupported'],
)
class Video1(BaseMessageType):
message_type: Optional[MessageType10] = Field(
None,
description='The type of message to send. You must provide `video` in this field',
examples=['video'],
)
video: Video
class FieldDatamodelCodeGeneratorRootSpecialPostRequest1(Text, ChannelOptionsSms):
text: Optional[Any] = Field(
None,
description='The text of message to send; limited to 1000 characters. The Messages API automatically detects unicode characters when sending SMS and sends the message as a unicode SMS. For more information on how concatenation and encoding please visit: [developer.nexmo.com/messaging/sms/guides/concatenation-and-encoding](https://developer.nexmo.com/messaging/sms/guides/concatenation-and-encoding).\n',
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest2(Image1, ChannelOptionsMms):
image: Optional[Image2] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest4(Audio1, ChannelOptionsMms):
audio: Optional[Audio2] = None
message_type: Optional[MessageType12] = Field(
None,
description='The type of message to send. You must provide `audio` in this field.\n\nFor best device and network support .mp3 is recommended. Not supported for US short codes.\n',
examples=['audio'],
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest5(Video1, ChannelOptionsMms):
message_type: Optional[MessageType13] = Field(
None,
description='The type of message to send. You must provide `video` in this field.\n\nFor best device and network support .mp4 is recommended. Not supported for US short codes.\n',
examples=['video'],
)
video: Optional[Video2] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest6(Text, ChannelOptionsWhatsapp):
text: Optional[Any] = Field(
None,
description='The text of message to send; limited to 4096 characters, including unicode.\n',
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest7(
Location1, ChannelOptionsWhatsapp
):
text: Optional[Any] = Field(
None, description='The location to be sent in the message.\n'
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest8(
Image1, ChannelOptionsWhatsapp
):
image: Optional[Image3] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest9(
Audio1, ChannelOptionsWhatsapp
):
audio: Optional[Audio3] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest10(
Video1, ChannelOptionsWhatsapp
):
video: Optional[Video3] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest11(
File1, ChannelOptionsWhatsapp
):
file: Optional[File2] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest12(
Template1, ChannelOptionsWhatsapp
):
whatsapp: Whatsapp1
class FieldDatamodelCodeGeneratorRootSpecialPostRequest13(
Custom, ChannelOptionsWhatsapp
):
pass
class FieldDatamodelCodeGeneratorRootSpecialPostRequest14(
Text, ChannelOptionsMessenger
):
text: Optional[Any] = Field(
None,
description='The text of message to send; limited to 640 characters, including unicode.\n',
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest15(
Image1, ChannelOptionsMessenger
):
image: Optional[Image4] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest16(
Audio1, ChannelOptionsMessenger
):
audio: Optional[Audio4] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest17(
Video1, ChannelOptionsMessenger
):
video: Optional[Video4] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest18(
File1, ChannelOptionsMessenger
):
file: Optional[File3] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest19(
Text, ChannelOptionsViberWithButton
):
text: Optional[Any] = Field(
None,
description='The text of message to send; limited to 1000 characters, including unicode.\n',
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest20(
Image1, ChannelOptionsViberWithButton
):
image: Optional[Image5] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest21(
Video1, ChannelOptionsViberVideo
):
video: Optional[Video5] = None
class FieldDatamodelCodeGeneratorRootSpecialPostRequest22(File1, ChannelOptionsViber):
file: Optional[File4] = Field(
None,
description='An object containing details of the file to be sent. Note: allowed file types are `.doc,` `.docx`, `.rtf`, `.dot`, `.dotx`, `.odt`, `.odf`, `.fodt`, `.txt`, `.info`, `.pdf`, `.xps`, `.pdax`, `.eps`, `.xls`, `.xlsx`, `.ods`, `.fods`, `.csv`, `.xlsm`, `.xltx`. Maximum file size is 200MB',
)
class FieldDatamodelCodeGeneratorRootSpecialPostRequest(
RootModel[
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest1,
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest2,
FieldDatamodelCodeGeneratorRootSpecialPostRequest3,
FieldDatamodelCodeGeneratorRootSpecialPostRequest4,
FieldDatamodelCodeGeneratorRootSpecialPostRequest5,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest6,
FieldDatamodelCodeGeneratorRootSpecialPostRequest7,
FieldDatamodelCodeGeneratorRootSpecialPostRequest8,
FieldDatamodelCodeGeneratorRootSpecialPostRequest9,
FieldDatamodelCodeGeneratorRootSpecialPostRequest10,
FieldDatamodelCodeGeneratorRootSpecialPostRequest11,
FieldDatamodelCodeGeneratorRootSpecialPostRequest12,
FieldDatamodelCodeGeneratorRootSpecialPostRequest13,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest14,
FieldDatamodelCodeGeneratorRootSpecialPostRequest15,
FieldDatamodelCodeGeneratorRootSpecialPostRequest16,
FieldDatamodelCodeGeneratorRootSpecialPostRequest17,
FieldDatamodelCodeGeneratorRootSpecialPostRequest18,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest19,
FieldDatamodelCodeGeneratorRootSpecialPostRequest20,
FieldDatamodelCodeGeneratorRootSpecialPostRequest21,
FieldDatamodelCodeGeneratorRootSpecialPostRequest22,
],
]
]
):
root: Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest1,
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest2,
FieldDatamodelCodeGeneratorRootSpecialPostRequest3,
FieldDatamodelCodeGeneratorRootSpecialPostRequest4,
FieldDatamodelCodeGeneratorRootSpecialPostRequest5,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest6,
FieldDatamodelCodeGeneratorRootSpecialPostRequest7,
FieldDatamodelCodeGeneratorRootSpecialPostRequest8,
FieldDatamodelCodeGeneratorRootSpecialPostRequest9,
FieldDatamodelCodeGeneratorRootSpecialPostRequest10,
FieldDatamodelCodeGeneratorRootSpecialPostRequest11,
FieldDatamodelCodeGeneratorRootSpecialPostRequest12,
FieldDatamodelCodeGeneratorRootSpecialPostRequest13,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest14,
FieldDatamodelCodeGeneratorRootSpecialPostRequest15,
FieldDatamodelCodeGeneratorRootSpecialPostRequest16,
FieldDatamodelCodeGeneratorRootSpecialPostRequest17,
FieldDatamodelCodeGeneratorRootSpecialPostRequest18,
],
Union[
FieldDatamodelCodeGeneratorRootSpecialPostRequest19,
FieldDatamodelCodeGeneratorRootSpecialPostRequest20,
FieldDatamodelCodeGeneratorRootSpecialPostRequest21,
FieldDatamodelCodeGeneratorRootSpecialPostRequest22,
],
]