sinch.domains.conversation.templates package

class sinch.domains.conversation.templates.Templates(sinch)[source]

Bases: BaseConversation

create(default_translation: str, translations: ~typing.List[~sinch.domains.conversation.templates.models.v2.types.template_translation_dict.TemplateTranslationDict], id: str | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, description: str | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, version: int | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, **kwargs) → TemplateResponse[source]

Creates a new template under the given project ID.

Parameters:
  • default_translation (str) – The default translation to use if not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list. (required)

  • translations (List[TemplateTranslationDict]) – The translations of the template. Each translation defines exactly one message type (text_message, card_message, carousel_message, choice_message, location_message, media_message, template_message, list_message or contact_info_message). (required)

  • id (UnsetOr[Optional[str]]) – The id of the template. If not specified, an ID is generated. Must be unique for a given project. (optional)

  • description (UnsetOr[Optional[str]]) – The description of the template. (optional)

  • version (UnsetOr[Optional[int]]) – The version of the template. If not specified, the server defaults it to 1. (optional)

  • **kwargs –

    Additional parameters for the request.

Returns:

The created template.

Return type:

TemplateResponse

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

delete(template_id: str, **kwargs) → None[source]

Deletes a template under the given project ID.

Parameters:
  • template_id (str) – The ID of the template to delete. (required)

  • **kwargs –

    Additional parameters for the request.

Returns:

None

Return type:

None

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

get(
template_id: str,
**kwargs,
) → TemplateResponse[source]

Fetches a template under the given project ID.

Parameters:
  • template_id (str) – The ID of the template to fetch. (required)

  • **kwargs –

    Additional parameters for the request.

Returns:

The template details.

Return type:

TemplateResponse

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

list(
**kwargs,
) → Paginator[ListTemplatesResponse, TemplateResponse][source]

Lists all templates belonging to the given project ID.

Parameters:

**kwargs –

Additional parameters for the request.

Returns:

A paginator for iterating through the templates.

Return type:

Paginator[ListTemplatesResponse, TemplateResponse]

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

list_translations(
template_id: str,
language_code: str | None = None,
translation_version: str | None = None,
**kwargs,
) → ResolveUnion object at 0x7ff1c9f23a50>]][source]

Lists all translations for a template under the given project ID.

Parameters:
  • template_id (str) – The ID of the template to fetch. (required)

  • language_code (Optional[str]) – The translation’s language code. (optional)

  • translation_version (Optional[str]) – The translation’s version. (optional)

  • **kwargs –

    Additional parameters for the request.

Returns:

A paginator for iterating through the translations.

Return type:

Paginator[ListTranslationsResponse, TemplateTranslation]

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

update(
template_id: str,
version: int,
default_translation: str | None | Unset = <sinch.core.sentinel.Unset object>,
translations: List[TemplateTranslationDict] | None | Unset = <sinch.core.sentinel.Unset object>,
description: str | None | Unset = <sinch.core.sentinel.Unset object>,
**kwargs,
) → TemplateResponse[source]

Updates a template under the given project ID.

The template is replaced with the provided content; omitted parameters are not sent.

Parameters:
  • template_id (str) – The id of the template to be updated. Specified or automatically generated during template creation. Unique per project. (required)

  • version (int) – The latest version of the template. It must match the current version of the template in order for the update to be successful. (required)

  • default_translation (UnsetOr[Optional[str]]) – The default translation to use if not specified. Specified as a BCP-47 language_code and the language_code must exist in the translations list. (optional)

  • translations (UnsetOr[Optional[List[TemplateTranslationDict]]]) – The translations of the template. Each translation defines exactly one message type. (optional)

  • description (UnsetOr[Optional[str]]) – The description of the template. (optional)

  • **kwargs –

    Additional parameters for the request.

Returns:

The updated template.

Return type:

TemplateResponse

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