sinch.domains.conversation.api.v1.messages_apis module

class sinch.domains.conversation.api.v1.messages_apis.Messages(sinch)[source]

Bases: BaseConversation

delete(
message_id: str,
messages_source: Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) None[source]
Delete a specific message by its ID. Note that this operation deletes the message from Conversation API storage;

this operation does not affect messages already delivered to recipients’ handsets. Also note that removing all messages of a conversation will not automatically delete the conversation.

Parameters:
  • message_id (str) – The unique ID of the message. (required)

  • messages_source (Optional[MessageSourceType]) – Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. Defaults to CONVERSATION_SOURCE when not specified. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). (optional)

  • **kwargs

    Additional parameters for the request.

Returns:

None

Return type:

None

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

get(
message_id: str,
messages_source: Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) AppMessageResponse | ContactMessageResponse[source]

Retrieves a specific message by its ID.

Parameters:
  • message_id (str) – The unique ID of the message. (required)

  • messages_source (Optional[MessageSourceType]) – Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. Defaults to CONVERSATION_SOURCE when not specified. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). (optional)

  • **kwargs

    Additional parameters for the request.

Returns:

ConversationMessageResponse

Return type:

ConversationMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

list(
page_size: int | None = None,
page_token: str | None = None,
conversation_id: str | None = None,
contact_id: str | None = None,
app_id: str | None = None,
channel_identity: str | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
view: Literal['WITH_METADATA', 'WITHOUT_METADATA'] | Annotated[str, Strict(strict=True)] | None = None,
messages_source: Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | Annotated[str, Strict(strict=True)] | None = None,
only_recipient_originated: bool | None = None,
channel: Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)] | None = None,
direction: Literal['TO_APP', 'TO_CONTACT'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) Paginator[AppMessageResponse | ContactMessageResponse][source]

List messages sent or received via particular Processing Modes. The messages are ordered by their accept_time property in descending order.

Parameters:
  • page_size (Optional[int]) – Maximum number of messages to fetch. Defaults to 10, maximum is 1000.

  • page_token (Optional[str]) – Next page token previously returned if any.

  • conversation_id (Optional[str]) – Filter messages by conversation ID.

  • contact_id (Optional[str]) – Filter messages by contact ID.

  • app_id (Optional[str]) – Filter messages by app ID.

  • channel_identity (Optional[str]) – Channel identity of the contact.

  • start_time (Optional[datetime]) – Filter messages with accept_time after this timestamp.

  • end_time (Optional[datetime]) – Filter messages with accept_time before this timestamp.

  • view (Optional[ConversationMessagesViewType]) – Messages view type. WITH_METADATA or WITHOUT_METADATA.

  • messages_source (Optional[MessageSourceType]) – Specifies the message source for the request.

  • only_recipient_originated (Optional[bool]) – Only fetch recipient-originated messages.

  • channel (Optional[ConversationChannelType]) – Only fetch messages from the specified channel.

  • direction (Optional[ConversationDirectionType]) – Only fetch messages with the specified direction. TO_APP or TO_CONTACT.

  • **kwargs

    Additional parameters for the request.

Returns:

TokenBasedPaginator with ConversationMessageResponse items

Return type:

Paginator[ConversationMessageResponse]

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

list_last_messages_by_channel_identity(
channel_identities: List[str] | None = None,
contact_ids: List[str] | None = None,
app_id: str | None = None,
messages_source: Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | Annotated[str, Strict(strict=True)] | None = None,
page_size: int | None = None,
page_token: str | None = None,
view: Literal['WITH_METADATA', 'WITHOUT_METADATA'] | Annotated[str, Strict(strict=True)] | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
channel: Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)] | None = None,
direction: Literal['TO_APP', 'TO_CONTACT'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) Paginator[AppMessageResponse | ContactMessageResponse][source]

Retrieves the last message sent to specified channel identities. In CONVERSATION_SOURCE mode, you can query either by channel_identities or by contact_ids. Note: Use either contact_ids OR channel_identities per request, not both. DISPATCH_SOURCE mode does not support contact_ids.

Parameters:
  • channel_identities (Optional[List[str]]) – Optional. Filter messages by channel_identity.

  • contact_ids (Optional[List[str]]) – Optional. Resource name (id) of the contact. CONVERSATION_SOURCE: list last messages by contact_id. DISPATCH_SOURCE: unsupported.

  • app_id (Optional[str]) – Optional. Resource name (id) of the app.

  • messages_source (Optional[MessageSourceType]) – Specifies the message source for the request.

  • page_size (Optional[int]) – Optional. Maximum number of messages to fetch. Defaults to 10, maximum is 1000.

  • page_token (Optional[str]) – Optional. Next page token previously returned if any.

  • view (Optional[ConversationMessagesViewType]) – Optional. Specifies the representation (WITH_METADATA or WITHOUT_METADATA). Default WITH_METADATA.

  • start_time (Optional[datetime]) – Optional. Only fetch messages with accept_time after this date.

  • end_time (Optional[datetime]) – Optional. Only fetch messages with accept_time before this date.

  • channel (Optional[ConversationChannelType]) – Optional. Only fetch messages from the specified channel.

  • direction (Optional[ConversationDirectionType]) – Optional. Only fetch messages with the specified direction (TO_APP or TO_CONTACT).

Return type:

Paginator[AppMessageResponse | ContactMessageResponse]

# Code review: :param **kwargs is invalid Sphinx syntax; use kwargs or document as “Additional keyword arguments”. :param kwargs: Additional parameters for the request. :type kwargs: dict

Returns:

TokenBasedPaginator with ConversationMessageResponse items

Return type:

Paginator[ConversationMessageResponse]

Parameters:
  • channel_identities (List[str] | None)

  • contact_ids (List[str] | None)

  • app_id (str | None)

  • messages_source (Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | None)

  • page_size (int | None)

  • page_token (str | None)

  • view (Literal['WITH_METADATA', 'WITHOUT_METADATA'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | None)

  • start_time (datetime | None)

  • end_time (datetime | None)

  • channel (Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | None)

  • direction (Literal['TO_APP', 'TO_CONTACT'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | None)

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

update(
message_id: str,
metadata: str,
messages_source: Literal['CONVERSATION_SOURCE', 'DISPATCH_SOURCE'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) AppMessageResponse | ContactMessageResponse[source]

Update a specific message metadata by its ID.

Parameters:
  • message_id (str) – The unique ID of the message. (required)

  • metadata (str) – Metadata that should be associated with the message. (required)

  • messages_source (Optional[MessageSourceType]) – Specifies the message source for which the request will be processed. Used for operations on messages in Dispatch Mode. Defaults to CONVERSATION_SOURCE when not specified. For more information, see [Processing Modes](https://developers.sinch.com/docs/conversation/processing-modes/). (optional)

  • **kwargs

    Additional parameters for the request.

Returns:

ConversationMessageResponse

Return type:

ConversationMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send(
app_id: str,
message: SendMessageRequestBodyDict | dict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • message (Union[SendMessageRequestBodyDict, dict]) – The message content to send. Can be a SendMessageRequestBodyDict or a dict.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the request.

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_text_message(
app_id: str,
text: str,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a text message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • text (str) – The text content of the message.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_card_message(
app_id: str,
card_message: CardMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a card message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • card_message (CardMessageDict) – The card message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

Send a carousel message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • carousel_message (CarouselMessageDict) – The carousel message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_choice_message(
app_id: str,
choice_message: ChoiceMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a choice message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • choice_message (ChoiceMessageDict) – The choice message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_contact_info_message(
app_id: str,
contact_info_message: ContactInfoMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a contact info message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • contact_info_message (ContactInfoMessageDict) – The contact info message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_list_message(
app_id: str,
list_message: ListMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a list message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • list_message (ListMessageDict) – The list message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_location_message(
app_id: str,
location_message: LocationMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a location message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • location_message (LocationMessageDict) – The location message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_media_message(
app_id: str,
media_message: MediaPropertiesDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a media message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • media_message (MediaPropertiesDict) – The media message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.

send_template_message(
app_id: str,
template_message: TemplateMessageDict,
contact_id: str | None = None,
recipient_identities: List[ChannelRecipientIdentityDict] | None = None,
ttl: str | int | None = None,
event_destination_target: str | None = None,
channel_priority_order: List[Literal['WHATSAPP', 'RCS', 'SMS', 'MESSENGER', 'VIBERBM', 'MMS', 'INSTAGRAM', 'TELEGRAM', 'KAKAOTALK', 'KAKAOTALKCHAT', 'LINE', 'WECHAT', 'APPLEBC'] | Annotated[str, Strict(strict=True)]] | None = None,
channel_properties: Dict[str, str] | None = None,
message_metadata: str | None = None,
conversation_metadata: Dict[str, Any] | None = None,
queue: Literal['NORMAL_PRIORITY', 'HIGH_PRIORITY'] | Annotated[str, Strict(strict=True)] | None = None,
processing_strategy: Literal['DEFAULT', 'DISPATCH_ONLY'] | Annotated[str, Strict(strict=True)] | None = None,
correlation_id: str | None = None,
conversation_metadata_update_strategy: Literal['REPLACE', 'MERGE_PATCH'] | Annotated[str, Strict(strict=True)] | None = None,
message_content_type: Literal['CONTENT_UNKNOWN', 'CONTENT_MARKETING', 'CONTENT_NOTIFICATION'] | Annotated[str, Strict(strict=True)] | None = None,
**kwargs,
) SendMessageResponse[source]

Send a template message from a Conversation app to a contact associated with that app. If the recipient is not associated with an existing contact, a new contact will be created. The message is added to the active conversation with the contact if a conversation already exists. If no active conversation exists a new one is started automatically.

Parameters:
  • app_id (str) – The ID of the Conversation API app sending the message.

  • contact_id (Optional[str]) – The contact ID of the recipient. Either contact_id or recipient_identities must be provided.

  • recipient_identities (Optional[List[ChannelRecipientIdentityDict]]) – List of channel identities for the recipient. Either contact_id or recipient_identities must be provided.

  • template_message (TemplateMessageDict) – The template message content.

  • ttl (Optional[Union[str, int]]) – The timeout allotted for sending the message. Can be seconds (int) or a string like ’10s’.

  • event_destination_target (Optional[str]) – Overwrites the default event destination target for delivery receipts for this message.

  • channel_priority_order (Optional[List[ConversationChannelType]]) – Explicitly define the channels and order in which they are tried when sending the message.

  • channel_properties (Optional[Dict[str, str]]) – Channel-specific properties. The key in the map must point to a valid channel property key.

  • message_metadata (Optional[str]) – Metadata that should be associated with the message. Up to 1024 characters long.

  • conversation_metadata (Optional[Dict[str, Any]]) – Metadata that will be associated with the conversation. Up to 2048 characters long.

  • queue (Optional[MessageQueueType]) – Select the priority type for the message. Can be ‘NORMAL_PRIORITY’ or ‘HIGH_PRIORITY’.

  • processing_strategy (Optional[ProcessingStrategyType]) – Overrides the app’s Processing Mode. Can be ‘DEFAULT’ or ‘DISPATCH_ONLY’.

  • correlation_id (Optional[str]) – An arbitrary identifier that will be propagated to callbacks related to this message. Up to 128 characters long.

  • conversation_metadata_update_strategy (Optional[MetadataUpdateStrategyType]) – Update strategy for the conversation_metadata field. Can be ‘REPLACE’ or ‘MERGE_PATCH’.

  • message_content_type (Optional[MessageContentType]) – Classifies the message content for use with consent management. Can be ‘CONTENT_UNKNOWN’, ‘CONTENT_MARKETING’, or ‘CONTENT_NOTIFICATION’.

  • **kwargs

    Additional parameters for the message body (e.g., agent, etc.).

Returns:

SendMessageResponse

Return type:

SendMessageResponse

For detailed documentation, visit https://developers.sinch.com/docs/conversation/.