Introduction to interfaces
Overview
Interfaces in the Botpress SDK establish standardized contracts that integrations must implement to enable extra features and capabilities. For example, an integration might implement the hitl
(human-in-the-loop) interface to support human agent intervention, or the typing-indicator
interface to use typing indicators provided by the external service.
Interface Definition
Each interface is defined through an Interface Definition that specifies the contract integrations must fulfill.
Key Components of Interface Definitions
Events
Interfaces can define events that integrations must support. These events establish a consistent model for how activities are communicated to bots, regardless of the underlying external service.
Actions
Interfaces can specify actions that integrations must provide. These actions define standardized operations that bots can invoke across different integrations that implement the same interface.
Channels
Interfaces can define communication channel requirements that integrations must implement.
Entities
Entities define standardized data structures for an interface. They:
- Establish common data models across different integrations
- Allow integrations to extend and customize the base entity
Actions and events defined by an interface may consume or produce these entities.
Component Renaming
Integrations can rename an interface’s events, actions, channels, and entities to better align with the concepts and terminology of their specific external service. Integrations can also extend entities with additional fields to accomodate the requirements of their external service.
Benefits of Interfaces
Interfaces provide significant benefits to the Botpress ecosystem:
- Consistency: Bots can interact with many external services through a standardized approach
- Reusability: Plugins can build upon interfaces instead of individual integrations
- Adaptability: Integrations can fulfill interface requirements while maintaining the appropriate terminology for their external service
- Extensibility: New integrations can quickly provide established functionality by implementing existing interfaces
Was this page helpful?