User Tools

Site Tools


api_reference

API Reference

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:

  • apiId – your integration's ID (provided by support)
  • apiKey – your API access key

Common Parameters

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

Functions

Send Chat History

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)

Get Chat Ad

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)

Get Page Ad

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)

Render Ad into Element (JS only)

Automatically fetches and renders an HTML ad into the specified element.

AdSDK.renderAdIntoElement(apiId, apiKey, userId, conversationId, adType, elementId)

React SDK Tags (JSX)

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" />

Ad Types

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

Errors

All SDKs use standard error handling:

  • Go: `error` return values
  • JS: callback with error or `try/catch` depending on usage

If an API call fails, check:

  • Incorrect or missing credentials
  • Invalid input (missing messages, empty content, etc.)
  • Unsupported ad type or request method

See Also

api_reference.txt · Last modified: by 127.0.0.1