shipany.bot.conversation.models.activations
shipany.bot.conversation.models.activations package
Submodules
shipany.bot.conversation.models.activations.base module
pydantic model shipany.bot.conversation.models.activations.base.BaseActivation
Bases: BaseModel
Base activation model.
- Fields:
field next_step : str [Required] (alias ‘next-step’)
Next step identifier.
field condition : JsonLogic | None = None
Condition that must be met to activate the step. Expressed in JSONLogic. Empty means always true.
shipany.bot.conversation.models.activations.command module
pydantic model shipany.bot.conversation.models.activations.command.CommandActivation
Bases: BaseActivation
Describes a command that triggers the conversation.
Examples:
- Command with a prefix:
{"next-step": "step-1","condition": {"var": "user.name"},"command": "start","prefix": "/"}
- Command without a prefix:
{"next-step": "step-1","condition": {"var": "user.name"},"command": "start","prefix": ""}
- Fields:
- Validators:
check_command_prefix»all fields
field command : str [Required]
Command name.
- Constraints:
- min_length = 1
- max_length = 32
- Validated by:
field prefix : str = ”
Command prefix.
- Constraints:
- max_length = 1
- Validated by:
validator check_command_prefix » all fields
Check if the command prefix is valid. The prefix must be a non-alphabetic character.
- Parameters: self (Self)
- Return type: Self
shipany.bot.conversation.models.activations.event module
pydantic model shipany.bot.conversation.models.activations.event.EventActivation
Bases: BaseActivation
Describes an event that triggers the conversation. Commonly used for message events.
Payload samples
- Event with a prefix:
{"next-step": "step-1","condition": {"var": "user.name"},"event": "on-message"}
Pydantic model parameters
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
- Validators:
field event : str [Required]
Event name that can trigger the conversation steps.
- Validated by:
validator validate_event » event
Validate the event name. The event name should start with ‘on-’ prefix.
- Parameters: value (str)
- Return type: str
shipany.bot.conversation.models.activations.timeout module
pydantic model shipany.bot.conversation.models.activations.timeout.TimeoutActivation
Bases: BaseActivation
Describes a timeout that triggers the conversation.
Payload samples
- Timeout activation:
{"next-step": "step-1","condition": {"var": "user.name"},"timeout": "timeout-1"}
Pydantic model parameters
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
field timeout_id : str [Required] (alias ‘timeout’)
Timeout identifier. Can be paired with TimeoutAction.
shipany.bot.conversation.models.activations.webhook module
pydantic model shipany.bot.conversation.models.activations.webhook.WebhookActivation
Bases: BaseActivation
Webhook model.
Contains information about the webhook path and the list of actions to perform in response.
Payload samples
- Webhook activation:
{"next-step": "step-1","condition": {"var": "user.name"},"webhook": "webhook-1"}
Pydantic model parameters
- Config:
- extra: str = ignore
- frozen: bool = True
- Fields:
field webhook : str [Required]
Webhook identifier. Must be declared in the .webhooks list.
Module contents
The module contains the activation models for the bot.
Built-in activation models are used to trigger the bot’s conversations. They are used to define the conditions under which a conversation should be triggered.
The activation models are:
- CommandActivation: activation model for commands
- EventActivation: activation model for events
- TimeoutActivation: activation model for timeouts
- WebhookActivation: activation model for webhooks