This page provides a complete reference of all core functions available across SDKs. These functions allow you to send context (chat or HTML) and receive ads in various formats.
All functions require:
| Name | Type | Description |
| `userId` | string | Unique user identifier |
| `conversationId` | string | Unique conversation/session identifier |
| `messages` | array | Array of `{ role, text }` objects |
| `pageContent` | string | Raw HTML or plain text of the page |
| `adType` | string | Ad format: `Json`, `HtmlTextAd`, `HtmlImageAd`, `JavaScript` |
| `jsFunc` | string | (Optional) Name of callback function for JS-based ads |
| `elementId` | string | (JS SDK only) DOM element ID to inject HTML ad into |
Sends a complete conversation to the system for later use in ad generation.
SendChatHistory(apiId, apiKey, userId, conversationId, messages)
AdSDK.sendChatHistory(apiId, apiKey, userId, conversationId, messages)
Returns an ad based on chat history, in one of the supported formats.
GetChatAd(apiId, apiKey, userId, conversationId, adType, jsFunc) → (string, error)
AdSDK.getChatAd(apiId, apiKey, userId, conversationId, adType, callback)
Returns an ad based on a web page's content.
GetPageAd(apiId, apiKey, pageContent, adType, jsFunc) → (string, error)
AdSDK.getPageAd(apiId, apiKey, pageContent, adType, callback)
Automatically fetches and renders an HTML ad into the specified element.
AdSDK.renderAdIntoElement(apiId, apiKey, userId, conversationId, adType, elementId)
React SDK uses special JSX tags to abstract API calls.
<SendChatHistory apiId="..." apiKey="..." userId="..." conversationId="..."> <YourChatComponent /> </SendChatHistory> <RenderChatAd apiId="..." apiKey="..." userId="..." conversationId="..." type="HtmlTextAd" /> <RenderPageAd apiId="..." apiKey="..." type="HtmlImageAd" />
| Type | Description |
| `Json` | Raw ad data as structured object (for custom use) |
| `HtmlTextAd` | Ready-to-insert text ad in HTML format |
| `HtmlImageAd` | Ad with image/icon and label, as HTML |
| `JavaScript` | JavaScript snippet that invokes your function |
All SDKs use standard error handling:
If an API call fails, check: