- Updated: March 18, 2026
- 6 min read
Integrating the OpenClaw Rating API into Your AI Agent Apps and Moltbook
The OpenClaw Rating API can be integrated into your AI agents and Moltbook platform by installing the Rating SDK, authenticating with secure API keys, invoking the API from Clawd.bot or Moltbot, and embedding the rating widget directly into Moltbook entries.
1. Introduction
What is the OpenClaw Rating API? OpenClaw provides a cloud‑native Rating SDK that lets developers capture, store, and analyze user‑generated scores for any digital asset. The API returns real‑time aggregates, sentiment breakdowns, and customizable rating scales, making it ideal for AI‑driven conversational agents and content‑rich platforms like Moltbook.
Why integrate it with AI agents and Moltbook? AI agents such as ChatGPT and Telegram integration thrive on contextual feedback. By feeding rating data back into the conversation loop, agents can adapt responses, prioritize high‑rated content, and surface personalized recommendations. Moltbook, a collaborative knowledge‑base for developers, benefits from visible rating widgets that surface community‑validated resources, driving engagement and trust.
In this guide we walk you through the entire workflow—from SDK setup to a live Moltbook integration—so you can ship a rating‑enabled AI experience in under an hour.
2. SDK Setup
2.1 Prerequisites
- Node.js ≥ 18 or Python ≥ 3.9
- Access to a UBOS workspace (free tier available on the UBOS pricing plans)
- Git client for version control
2.2 Installing the Rating SDK
OpenClaw publishes SDKs for both JavaScript/TypeScript and Python. Choose the language that matches your AI agent stack.
// JavaScript (npm)
npm install @openclaw/rating-sdk
# Python (pip)
pip install openclaw-rating-sdk
2.3 Verifying Installation
Run the built‑in health check to confirm the SDK can reach OpenClaw’s endpoint.
// JavaScript
const { healthCheck } = require('@openclaw/rating-sdk');
healthCheck().then(console.log).catch(console.error);
// Python
from openclaw_rating_sdk import health_check
print(health_check())
If the console prints { status: 'ok' }, you’re ready for authentication.
3. Authentication
3.1 Obtaining API Keys
Log in to the UBOS homepage and navigate to Developer Settings → API Keys**. Click Create New Key**, select the Rating API scope, and copy the generated OPENCLAW_API_KEY.
3.2 Secure Storage of Credentials
Never hard‑code keys. Use environment variables or a secret manager:
- Node.js:
process.env.OPENCLAW_API_KEY - Python:
os.getenv('OPENCLAW_API_KEY')
3.3 Sample Authentication Code
// JavaScript
const { RatingClient } = require('@openclaw/rating-sdk');
const client = new RatingClient({
apiKey: process.env.OPENCLAW_API_KEY,
});
// Python
from openclaw_rating_sdk import RatingClient
import os
client = RatingClient(api_key=os.getenv('OPENCLAW_API_KEY'))
Both clients automatically inject the Authorization: Bearer <API_KEY> header on every request.
4. Making API Calls from Clawd.bot / Moltbot
4.1 Request Structure
OpenClaw expects a JSON payload with three fields: entityId, rating (1‑5), and optional metadata.
{
"entityId": "moltbook:article:12345",
"rating": 4,
"metadata": {
"userId": "user_987",
"sessionId": "sess_abc123"
}
}
4.2 Handling Responses
The API returns the updated aggregate and a confidence score. Example response:
{
"entityId": "moltbook:article:12345",
"averageRating": 4.2,
"totalVotes": 57,
"confidence": 0.93
}
4.3 Error Handling Best Practices
- Network errors: Implement exponential back‑off and retry up to 3 times.
- Rate limits: Respect the
Retry-Afterheader; the default limit is 120 requests/minute. - Invalid payload: Validate
ratingrange client‑side before sending.
Sample error‑handling wrapper (JavaScript):
async function submitRating(payload) {
const maxRetries = 3;
let attempt = 0;
while (attempt setTimeout(r, wait));
} else {
throw err;
}
}
attempt++;
}
throw new Error('Failed after retries');
}
Integrate this function into your Clawd.bot or Moltbot message handlers so that every user interaction can be rated on the fly.
5. Simple Moltbook Integration
5.1 Embedding Rating Widgets
Moltbook pages are rendered with the UBOS Web app editor on UBOS. Insert the following HTML snippet where you want the widget to appear:
<div id="rating-widget" data-entity="moltbook:article:{{articleId}}"></div>
<script src="https://cdn.openclaw.com/rating-widget.js"></script>
The script automatically reads the data-entity attribute, renders a 5‑star UI, and posts the rating to OpenClaw.
5.2 Syncing Ratings with Moltbook Entries
To display the live average rating next to each article title, add a small server‑side fetch in your Moltbook rendering pipeline:
// Node.js example in Moltbook's Express route
app.get('/article/:id', async (req, res) => {
const article = await getArticle(req.params.id);
const rating = await client.getAggregate({
entityId: `moltbook:article:${req.params.id}`
});
res.render('article', {
article,
rating: rating.averageRating.toFixed(1)
});
});
5.3 Example Implementation
Below is a minimal end‑to‑end example that ties everything together:
- Set up the SDK and authentication (see sections 2‑3).
- Create a Moltbook page with the widget snippet.
- In the page controller, call
client.getAggregateto fetch the current average. - Render the rating next to the article title:
<h1>{{article.title}} <span class="text-yellow-500">★ {{rating}}</span></h1>
<div id="rating-widget" data-entity="moltbook:article:{{article.id}}"></div>
Now every visitor can rate the article, see the updated average instantly, and the AI agents behind Clawd.bot can query the same aggregate to tailor suggestions.
6. Publishing the Article on UBOS
6.1 Formatting Guidelines
UBOS expects Markdown or HTML content wrapped in a <body> tag. Use semantic headings (h2, h3, h4) and Tailwind utility classes for styling. Avoid h1 because the platform automatically injects the page title.
6.2 SEO Considerations
- Primary keyword OpenClaw Rating API appears in the title, first paragraph, and URL slug.
- Secondary keywords (AI agents, Moltbook integration, SDK setup) are distributed across subheadings.
- Internal links to related UBOS solutions (Enterprise AI platform by UBOS, UBOS partner program) boost topical authority.
- External citation to the official OpenClaw announcement (see below) adds credibility.
6.3 Adding the Internal Link
When you publish, embed the dedicated OpenClaw hosting page exactly once, as shown in the next paragraph.
For developers who prefer a managed environment, UBOS offers a one‑click OpenClaw hosting solution that provisions the Rating SDK, API gateway, and monitoring dashboard.
7. Conclusion
Integrating the OpenClaw Rating API into AI agents and Moltbook unlocks a feedback loop that improves content relevance, boosts user engagement, and provides actionable analytics for product teams. By following the SDK installation, secure authentication, and widget embedding steps outlined above, you can launch a fully rated AI experience in minutes.
Next steps:
- Explore advanced analytics with the Chroma DB integration for vector‑based similarity search.
- Combine rating data with AI marketing agents to auto‑generate promotion strategies for top‑rated articles.
- Scale to enterprise workloads using the Enterprise AI platform by UBOS.
Happy coding, and may your ratings always be five stars! 🚀
For the official announcement of the OpenClaw Rating API, see the original news release: OpenClaw launches Rating API.