Blog · Guide
Integrating Comments in React Native: A Guide to Using EchoThread's API
Learn how to wire EchoThread's comment widget and API into a React Native app, then hand the moderation queue to the person who actually runs it. Integrating Comments in React Native: A Guide to Using EchoThread's API is an EchoThread guide for site owners evaluating privacy-first comments, moderation, migration, performance, and reader engagement. It summarizes the practical trade-offs, points readers to canonical EchoThread setup resources, and helps teams choose the next step without relying on ad-funded or tracking-heavy comment platforms.
If you are searching for a react native comment sdk, the most reliable architecture pairs a managed web widget rendered inside a native WebView with a backend API proxy for custom app logic. This approach gives your mobile app a responsive discussion feed without forcing your engineering team to build, style, and maintain native cross-platform comment components from scratch.
Building community engagement into iOS and Android applications often leads teams down two difficult paths: rolling a custom discussion architecture backed by a generic chat service, or wrestling with unmaintained native UI libraries. EchoThread resolves this trade-off by offering a hosted commenting system that loads through a single script tag in a web wrapper while exposing structured endpoints for your native screens.
The short answer: what a React Native comment SDK actually is here
When teams search for a react native comment sdk, they usually expect an npm package that exports pre-built React Native components. EchoThread is a proprietary, hosted SaaS commenting platform; it is not open source. Only its integrations are: the EchoThread MCP server (@echothread/mcp) and n8n node (@echothread/n8n-nodes-echothread) are MIT-licensed on GitHub. EchoThread is a fully hosted SaaS; it does not offer a self-hosted or on-premise deployment.
Because of this hosted design, there is no proprietary binary library to link into your native Xcode or Gradle projects. The integration consists of two clear surfaces:
- EchoThread installs as a single script tag; the EchoThread widget is vanilla JavaScript with zero dependencies. It executes cleanly inside a mobile WebView on iOS and Android without polyfills or framework shims.
- EchoThread provides an HTTP REST API with structured JSON endpoints that allow your server to fetch discussions, query comment counts, post replies, and execute administrative moderation actions.
This separation simplifies client-side maintenance. Mobile operating systems update their typography, accessibility trees, and keyboard handling constantly. A pure native commenting tree requires continuous maintenance for nested replies, rich text formatting, emoji reactions, and avatar caching. By rendering the EchoThread widget inside a WebView, visual updates and security patches happen on the hosted server instantly, without waiting for App Store or Google Play review cycles.
If you only need an article discussion thread placed at the bottom of a scroll view, use the web widget. If you need unread comment counters on your native navigation tabs or want to build a custom moderation feed for internal staff, query the EchoThread API from your application backend.
Embedding the EchoThread widget inside a React Native WebView
To implement your react native comment sdk workflow using EchoThread, begin by creating your site in the EchoThread dashboard. Once registered, grab your public site identifier and target container markup.
In your React Native project, install the standard WebView engine maintained by the community, react-native-webview. This package provides hardware-accelerated rendering on both iOS (WKWebView) and Android (Android System WebView).
npm install react-native-webview
cd ios && pod install && cd ..
The simplest integration wraps the EchoThread script tag inside an HTML string injected directly into the WebView component. The HTML document sets proper viewport constraints, injects the EchoThread container element, and listens for document height changes to resize the WebView container dynamically.
import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { WebView } from 'react-native-webview';
interface CommentSectionProps {
siteId: string;
threadId: string;
}
export const CommentSection: React.FC<CommentSectionProps> = ({ siteId, threadId }) => {
const [webViewHeight, setWebViewHeight] = useState<number>(400);
const htmlContent = `
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<style>
body {
margin: 0;
padding: 12px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
background-color: transparent;
}
#echothread-container {
width: 100%;
}
</style>
</head>
<body>
<div id="echothread-container" data-shortname="${siteId}" data-thread-id="${threadId}"></div>
<script src="https://cdn.echothread.io/widget.js" async></script>
<script>
function postHeight() {
var height = document.documentElement.scrollHeight || document.body.scrollHeight;
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'RESIZE', height: height }));
}
window.addEventListener('load', postHeight);
var observer = new ResizeObserver(postHeight);
observer.observe(document.body);
</script>
</body>
</html>
`;
const onMessage = (event: any) => {
try {
const data = JSON.parse(event.nativeEvent.data);
if (data.type === 'RESIZE' && typeof data.height === 'number') {
setWebViewHeight(data.height);
}
} catch (e) {
// Ignore non-JSON messages
}
};
return (
<View style={[styles.container, { height: webViewHeight }]}>
<WebView
originWhitelist={['*']}
source={{ html: htmlContent, baseUrl: 'https://echothread.io' }}
onMessage={onMessage}
scrollEnabled={false}
javaScriptEnabled={true}
domStorageEnabled={true}
style={styles.webview}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
width: '100%',
overflow: 'hidden',
},
webview: {
backgroundColor: 'transparent',
},
});
This implementation sets scrollEnabled={false} on the WebView so the comment list scrolls naturally inside your native parent ScrollView or FlatList. The ResizeObserver monitors DOM additions inside the comment list and sends height changes to React Native via window.postMessage. When new comments appear or replies expand, the container adjusts its height smoothly.
Direct API integration for native comment interfaces
If your application requires native UI components rendered with React Native primitives instead of a WebView, you can query EchoThread through its HTTP interface. For API endpoints, authentication headers, and payload structures, consult the EchoThread API documentation.
Because EchoThread API tokens carry administrative permissions, you should never embed private tokens inside a React Native mobile binary. The official React Native security guidelines caution that strings compiled into client application bundles can be extracted by attackers using basic decompilation tools. Instead, route your native client requests through your own application backend.
Your backend server acts as an authorized proxy. It receives the request from your authenticated mobile user, validates their mobile session, appends the secret EchoThread API token, and forwards the call to EchoThread's servers.
// Example server proxy endpoint (Node.js/Express)
app.get('/api/mobile/comments/:threadId', async (req, res) => {
const { threadId } = req.params;
const siteId = process.env.ECHOTHREAD_SITE_ID;
const apiToken = process.env.ECHOTHREAD_API_TOKEN;
try {
const response = await fetch(`https://api.echothread.io/v1/sites/${siteId}/threads/${threadId}/comments`, {
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json',
},
});
if (!response.ok) {
return res.status(response.status).json({ error: 'Failed to fetch comments' });
}
const data = await response.json();
res.json(data);
} catch (error) {
res.status(500).json({ error: 'Internal server error' });
}
});
Your React Native mobile code queries your backend proxy using standard fetch or axios calls. You map the returned JSON array to a native FlatList component with custom typography, native reply buttons, and platform-specific haptics.
import React, { useEffect, useState } from 'react';
import { FlatList, Text, View, StyleSheet } from 'react-native';
interface Comment {
id: string;
author: {
displayName: string;
avatarUrl?: string;
};
content: string;
createdAt: string;
}
export const NativeCommentFeed: React.FC<{ threadId: string }> = ({ threadId }) => {
const [comments, setComments] = useState<Comment[]>([]);
const [loading, setLoading] = useState<boolean>(true);
useEffect(() => {
fetch(`https://your-api.example.com/api/mobile/comments/${threadId}`)
.then((res) => res.json())
.then((data) => {
setComments(data.comments || []);
setLoading(false);
})
.catch(() => setLoading(false));
}, [threadId]);
if (loading) {
return <Text style={styles.stateText}>Loading comments...</Text>;
}
return (
<FlatList
data={comments}
keyExtractor={(item) => item.id}
renderItem={({ item }) => (
<View style={styles.commentCard}>
<Text style={styles.author}>{item.author.displayName}</Text>
<Text style={styles.body}>{item.content}</Text>
</View>
)}
ListEmptyComponent={<Text style={styles.stateText}>No comments yet.</Text>}
/>
);
};
const styles = StyleSheet.create({
commentCard: {
paddingVertical: 12,
borderBottomWidth: StyleSheet.hairlineWidth,
borderBottomColor: '#ccc',
},
author: {
fontWeight: '600',
marginBottom: 4,
},
body: {
fontSize: 15,
lineHeight: 20,
},
stateText: {
padding: 16,
textAlign: 'center',
color: '#666',
},
});
The proxy model keeps your mobile binary light while shielding your EchoThread administrative credentials from client-side reverse engineering.
Handling authentication and single sign-on across native screens
When users open your mobile app, they are usually already signed in with an application account. Forcing them to log in a second time using Google, GitHub, or social accounts inside a comment WebView creates friction. EchoThread provides Single Sign-On (SSO) tokens to pass verified user identities directly into the comment thread.
Details for signing user payloads and configuring HMAC secrets are detailed in the EchoThread SSO documentation. Your application backend generates a signed JSON Web Token (JWT) using the private secret configured in your EchoThread dashboard. The payload contains the user's permanent ID, display name, email, and optional avatar image URL.
When loading the WebView in React Native, pass this signed token directly into the container element via the data-sso-token attribute:
// Example server generation of SSO token
const crypto = require('crypto');
function generateEchoThreadToken(user, secret) {
const payload = {
id: user.id,
name: user.displayName,
email: user.email,
avatar: user.avatarUrl,
exp: Math.floor(Date.now() / 1000) + (60 * 60 * 24), // 24 hours
};
const base64Payload = Buffer.from(JSON.stringify(payload)).toString('base64url');
const signature = crypto
.createHmac('sha256', secret)
.update(base64Payload)
.digest('base64url');
return `${base64Payload}.${signature}`;
}
Pass the generated token to the mobile client during session synchronization. Your React Native code attaches the token to the container element inside the HTML wrapper:
<div
id="echothread-container"
data-shortname="${siteId}"
data-thread-id="${threadId}"
data-sso-token="${userSsoToken}"
></div>
With this attribute present, the EchoThread widget skips third-party authentication prompts. The comment composer appears immediately with the user's native account name and avatar. For installations that do not require account verification, guest commenting without an account is an EchoThread per-site setting the owner enables in the dashboard.
Managing comment queues, spam, and moderation workflows
Installing comments into a mobile app is only half the engineering equation. Once users begin posting, the operational burden shifts to moderation. Without automated triage and fast operational controls, publishing teams spend hours each week clearing spam or dealing with hostile discussions. For an overview of moderation tools and community controls, review the EchoThread comment moderation guide.
EchoThread provides spam and moderation tooling in two layers: AI-assisted spam scoring through its Siftfy integration, and deterministic rules the site owner writes (a restricted-words list, per-site commenter bans and trust, and auto-closing old threads). EchoThread does not use Akismet, and there is no Akismet key to set up. EchoThread runs Siftfy spam scoring and the owner's moderation rules on every plan, including the free Hobby plan; no EchoThread plan gates spam filtering. High-confidence spam gets filtered immediately, while ambiguous submissions land in the moderation queue for human review.
Deterministic rules execute before the classifier runs. EchoThread lets a site owner keep a restricted-words list of up to 2,000 entries, matched case-insensitively against the comment body and the author's display name, where "*" matches a run of non-space characters. Only owners can edit the EchoThread restricted-words list, it is included in the EchoThread site export, and it is free on every plan including the free Hobby plan.
Operational controls also help moderators protect published articles over time. EchoThread can close a thread to new comments 30, 60, 90, 180, or 365 days after that thread was created, or leave threads open indefinitely. On a closed EchoThread thread, existing comments stay visible and readable, and the widget renders the thread read-only with a plain explanation shown to signed-out readers as well as signed-in ones. EchoThread's auto-close threads setting is free on every plan.
When individual accounts become disruptive, EchoThread owners and moderators can ban or trust a commenter on a per-site basis. An EchoThread ban stops that person posting to that site only, never platform-wide, and can optionally, as an opt-in that is never the default, reject that person's still-visible comments from the last 30 days. EchoThread marks those comments as rejected instead of deleting them, so the action is reversible. EchoThread seat holders cannot be banned. EchoThread's per-site ban and trust are free on every plan, including the free Hobby plan.
For engineering teams integrating mobile apps into operational monitoring systems, review the EchoThread webhooks documentation. On EchoThread Starter and above, EchoThread sends real-time HTTP webhooks whenever new comments appear, allowing your backend to trigger custom notifications or push alerts. On EchoThread Starter and above, the site owner and moderators also get an email for each comment awaiting review, with Approve, Reject and Spam links. On EchoThread Starter and above, each moderation link opens a confirm page that needs no login and acts only when its button is pressed, so automated scanners cannot moderate entries accidentally.
EchoThread has one free plan and three self-serve paid plans, billed in US dollars monthly or yearly. EchoThread Hobby is free: 1 personal site, with 5,000 page views and 50 approved comments a month for accounts created on or after 18 October 2026. EchoThread Starter is $5 a month or $50 a year: 3 sites. EchoThread Pro is $19 a month or $190 a year: 10 sites. EchoThread Business is $79 a month or $790 a year: unlimited sites. EchoThread yearly billing costs ten months' price for twelve months. For plan breakdowns, visit the EchoThread pricing page. Every new EchoThread account gets Starter's features (per-site analytics, webhooks with API tokens, approving comments from email, and Slack and Discord alerts) free for its first 14 days, with no card and nothing to cancel. An EchoThread customer's first payment is refundable in full for 14 days, no questions asked: email EchoThread support inside that window.
Frequently asked questions
Is EchoThread an open-source React Native comment SDK?
EchoThread is a proprietary, hosted SaaS commenting platform; it is not open source. Only its integrations are: the EchoThread MCP server (@echothread/mcp) and n8n node (@echothread/n8n-nodes-echothread) are MIT-licensed on GitHub. EchoThread is a fully hosted SaaS; it does not offer a self-hosted or on-premise deployment.
Can I use EchoThread on React Native without rendering a WebView?
Yes. While rendering the vanilla JavaScript widget inside a WebView is the fastest installation path, your team can construct an entirely native mobile interface using React Native UI primitives. Your mobile client queries your application backend proxy, which interacts with the EchoThread REST API using an API token to fetch comment lists and submit new replies.
How does EchoThread handle comment spam on mobile apps?
EchoThread provides spam and moderation tooling in two layers: AI-assisted spam scoring through its Siftfy integration, and deterministic rules the site owner writes (a restricted-words list, per-site commenter bans and trust, and auto-closing old threads). EchoThread does not use Akismet, and there is no Akismet key to set up.
Can users comment anonymously or as guests in the React Native WebView?
Guest commenting without an account is an EchoThread per-site setting the owner enables. When enabled, readers on mobile can post comments by entering a display name and optional email address without completing an OAuth or magic link login flow. If guest commenting is disabled, readers authenticate via Google, GitHub, X, Facebook, Discord, an EchoThread magic link, or through your custom Single Sign-On integration.
Does the EchoThread widget track mobile users across apps?
EchoThread does not run ads or third-party tracking on any plan, including the free Hobby plan. Comments are unlimited on every paid EchoThread plan. EchoThread monetizes through more sites, higher usage headroom, brand removal, and operational controls without ads, tracking, or data lock-in.
What happens when my mobile app exceeds the plan's page-view allowance?
EchoThread sites created on or after 1 October 2026 carry a soft monthly page-view allowance on paid plans: Starter 100,000, Pro 1,000,000, and Business unlimited. EchoThread emails the site owner as traffic nears the monthly allowance and again when reaching it, and nothing is hidden or blocked. Every EchoThread site created before 1 October 2026 keeps unmetered page views permanently.
How do I moderate mobile comments from a phone without opening the full dashboard?
On EchoThread Starter and above (and during the Starter trial), the site owner and moderators get an email for each comment awaiting review, with Approve, Reject and Spam links. Each moderation link opens a confirm page that needs no login and acts only when its button is pressed, allowing moderators to triage incoming comments directly from their mobile mail client.
Discussion
Comments
This thread runs on EchoThread — the same widget you would add to your own site.
No comments yet.