MOPO logoAI Agent Docs

Webpage APIs

Overview

Using Web Page Agent APIs, you can improve your website's search and information discovery experience, helping your site visitors find what they are looking for quickly. MOPO Web Page Agent APIs enable you to connect elements on your web pages to your Agent and generate answers.

For example, your Agent can :

*Power AI Search across your website by connecting a search form to your Agent.

Enable your visitors to learn more about specific topics by linking text or images to the Agent.

How It Works

When a user submits a question through the search box or clicks a connected link, a message is sent to the AI agent using window.postMessage. The AI agent receives the request, processes it, and displays an answer with page links.

Implementation

1. Adding a Search Box

To enable users to type and submit queries, add the following search box to your webpage:

<form onsubmit="event.preventDefault(); sendSearchTermToIframe(document.getElementById('searchTerm').value);">
    <input type="text" id="searchTerm" placeholder="Ask me anything..." />
    <button type="submit">Search</button>
</form>

2. Creating Clickable AI-Enabled Links

You can define links that send predefined queries to the AI agent:

<a onclick="sendSearchTermToIframe('What services do you provide?');">
    What services do you provide?
</a>

Example Use Case

If a webpage wants to provide interactive support, it can embed this functionality to let users ask questions directly instead of navigating through static content.

For instance, if a support page contains multiple FAQ links, instead of redirecting users to another page, clicking a question can trigger the AI agent to provide an immediate answer.

© 2025 MOPO AI. All rights reserved.