Skip to content

ExternalAiAssistant ​

Core class for integrating external AI assistants with the Stripo Email Editor.

typescript
class ExternalAiAssistant

Description ​

ExternalAiAssistant enables integration of third-party AI services (like OpenAI, Claude, or custom AI solutions) into the Stripo Email Editor. This interface allows users to leverage AI for generating and improving email content including subject lines, preheaders, and body text. The AI assistant can provide contextual suggestions based on the type of content being edited.

Import ​

typescript
import { ExternalAiAssistant } from '@stripoinc/ui-editor-extensions';

Methods ​

openAiAssistant() ​

Opens the AI assistant interface for content generation or improvement.

typescript
openAiAssistant(params: {
  value: string;
  onDataSelectCallback: ExternalAiAssistantCallback;
  onCancelCallback: ExternalAiAssistantCancelCallback;
  type: AiAssistantValueType;
}): void

Parameters ​

NameTypeDescription
valuestringCurrent content to be improved or context for generation
onDataSelectCallbackExternalAiAssistantCallbackCalled when AI generates content
onCancelCallbackExternalAiAssistantCancelCallbackCalled when user cancels
typeAiAssistantValueTypeType of content (SUBJECT, HIDDEN_PREHEADER, TEXT_BLOCK)

Callback Types ​

ExternalAiAssistantCallback ​

Called when AI assistant generates content.

typescript
type ExternalAiAssistantCallback = (html: string) => void

Parameters:

  • html - Generated HTML content from the AI

ExternalAiAssistantCancelCallback ​

Called when the user cancels the AI assistant.

typescript
type ExternalAiAssistantCancelCallback = () => void