Integration Guide
Quick assessment for potential customers: How much development work is required?
TL;DR: Integration Effort
Basic Setup
15-30 minutes
⭐ Easy
Smart Contract Deployment
2-4 hours
⭐⭐ Moderate
Conversion Tracking
2-4 hours
⭐⭐ Moderate
Full Integration
6-8 hours
⭐⭐ Moderate
Total Development Time: One full day for a complete integration.
What You Need to Integrate
1. Account Setup (15-30 minutes)
Contact ReplyCorp to request access
ReplyCorp registers your organization and creates your account
Log into the admin panel and retrieve:
Your API key
Your campaign ID
Enter contract parameters in the admin panel:
Chain (blockchain network)
Token address for fee distribution
Revenue share percentage
ReplyCorp fee percentage (set by ReplyCorp when creating your account)
What you provide to ReplyCorp:
Organization name and slug
Admin email address
Campaign details (Twitter handle to track, campaign name)
What ReplyCorp handles:
Account provisioning
Initial account setup
2. Smart Contract Deployment (2-4 hours)
Required step: Deploy the fee routing smart contract that receives fees and distributes them based on attribution data.
What you need to do:
Enter contract parameters in the admin panel (chain, token address, revenue share %)
ReplyCorp fee percentage is set by ReplyCorp when creating your account
Receive contract code from ReplyCorp
Deploy the contract to your specified chain with the parameters you entered
Configure your system to interact with the deployed contract address
⚠️ CRITICAL: Funding the Distribution Wallet
The wallet that calls startDistribution() must have sufficient ERC-20 token balance available at the time the function is executed. The contract pulls tokens from this wallet to perform all distributions.
The distribution wallet may be funded in either of the following ways:
Real-time funding Conversion transactions can be configured to route ERC-20 proceeds directly to the distribution wallet as they occur.
Pre-funding You may pre-fund the distribution wallet by transferring ERC-20 tokens in advance to cover an expected amount of upcoming rewards over a defined timeframe. This is not a one-time setup — the wallet balance must be monitored and periodically topped up over time to continue supporting future distributions.
In both cases, the contract does not mint or source tokens. It only transfers tokens already held by the distribution wallet. If the wallet balance is insufficient when startDistribution() is called, the transaction will revert.
⚠️ CRITICAL: Token Denomination
Token denomination consistency: If you're rewarding with a specific token (e.g., USDC), all financial data posted to the API (
totalVolume,netProfit,commission) must be denominated in that same token. For example, if distributing USDC, all amounts should be in USDC, not USD or other currencies.
How the contract works:
When you call the conversion API, ReplyCorp calculates attribution and updates the contract with attribution data (tied to conversion ID) before sending you the API response
The API response includes the
conversion.id,attributionHash, andtotalToSendToContractamountYou send the total fees (from the API response), conversion ID, and attribution hash to the contract - the contract automatically verifies the hash matches and distributes fees to referrers based on the pre-calculated and now approved attribution breakdown
Code Example:
What you build:
Contract deployment script with parameters from admin panel
Fee sending logic that includes conversion ID
What ReplyCorp handles:
Contract code and deployment instructions
Attribution calculation and contract updates (happens automatically before API response)
2.5A. Alternative: Smart Contract Deployment + Later/Periodic Fee Distribution (instead of real-time fee distribution)
When to use this approach:
You want to use the fee router contract for automated distribution
But you need to batch payments or distribute commissions on a schedule (weekly, monthly, etc.) instead of real-time
You want to manually review attribution data before distributing fees
You want to aggregate multiple conversions before distributing fees
How it works:
Deploy the fee router contract (same as section 2)
Call the conversion API - ReplyCorp automatically updates the contract with attribution data
Store conversion IDs and fee distribution data from API responses
Later (weekly/monthly), batch process multiple conversions by calling the contract distribution functions
Best Practices:
Store Conversion Data for Batching
Batch Process Multiple Conversions
Consider Gas Optimization
Batch multiple
startDistributioncalls in a single transaction if possibleProcess batches sequentially to avoid gas limit issues
Monitor gas costs - batching may be more cost-effective than real-time distribution
Handle Failures and Retries
Track which conversions failed to distribute
Implement retry logic with exponential backoff
Set maximum retry attempts before manual review
Reconciliation
Use
conversion.idto track which conversions have been distributedQuery contract state to verify distribution completion
Reconcile with your accounting system
Important Notes:
The contract stores attribution data permanently - you can distribute at any time
Attribution hash verification ensures you're distributing the correct amounts
You can batch process conversions in any order
Failed transfers accumulate as dust (see contract documentation)
Consider gas costs when deciding batch frequency
Benefits of This Approach:
✅ Uses automated contract distribution (no manual payout logic)
✅ Allows batching for gas efficiency
✅ Maintains attribution verification via hash
✅ Can aggregate multiple conversions before distributing
✅ Still benefits from contract's best-effort distribution model
2.5B. Alternative: Independent Fee Routing
When to use this approach:
You're using a different payment system or smart contract architecture
We recommend using the fee router contract for real-time, automated fee distribution. However, if you're using a different payment system or smart contract architecture, you can store the attribution data from our API and distribute fees using your own system.
Best Practices:
Store the Complete Attribution Data
Save the entire API response, including:
conversion.id- Unique identifier for the conversionattribution.attributions[]- Array of all attributed referrers with percentagesattribution.attributions[].walletAddress- Wallet addresses (may be null)attribution.attributions[].attributedAmount- Dollar amount attributed to each referrerattribution.attributions[].attributionPercentage- Percentage of conversion attributedconversion.conversionValue- The conversion amount
Handle Missing Wallet Addresses
Some referrers may not have connected their wallets (
walletAddress: null)Options for handling:
Escrow: Hold funds in your system until wallet is connected (set a time limit, e.g., 30 days)
Match on your side: If you have wallet addresses linked to Twitter IDs in your system, match them
Webhook notifications: Subscribe to webhook updates when participants connect wallets
Calculate Payouts When Ready to Distribute
Track Distribution Status
Store which conversions have been distributed
Track which referrers have been paid
Handle partial distributions (if some wallets are missing)
Reconcile with your accounting system
Consider Batch Processing
If distributing weekly/monthly, aggregate attribution data:
Use Conversion ID for Reconciliation
The
conversion.idis unique and permanentUse it to track which conversions have been processed
Link it to your internal transaction IDs for audit trails
Important Notes:
Attribution percentages are calculated from
totalVolume(who influenced the sale)You can still use
totalVolume,netProfit, andcommissionfields in the API request for accurate attribution calculationThe API response includes all the data you need - no need to query the contract
Wallet addresses may be
null- plan for this in your distribution logicAttribution data is immutable once returned - store it securely for your records
Example Storage Schema:
3. Conversion Tracking (2-4 hours)
Required step: Call ReplyCorp's API whenever a conversion happens in your system.
CRITICAL: Financial Fields
⚠️ CRITICAL: Token Denomination
All financial data must be denominated in your reward token: If you're distributing rewards in a specific ERC20 token (e.g., USDC), all financial fields (
totalVolume,netProfit,commission) must be denominated in that same token. For example, if your contract uses USDC, all amounts should be in USDC units, not USD or other currencies. This ensures accurate attribution calculations and proper distribution amounts.
If using the fee router contract, you must provide three financial fields:
totalVolume: Gross revenue from the conversionnetProfit: Net profit (totalVolume minus all costs)commission: Amount you want to distribute to referrers
If NOT using the fee router contract, you can use the simpler amount field:
amount: The conversion amount (positive for purchases/locks, negative for refunds/unlocks)
Important Notes:
You determine your desired commission percentage - This is not fixed by our system. You have full control over how much commission you allocate for referral rewards, and you can vary this on a per-user or per-transaction basis before calling our API. This flexibility allows you to implement different commission structures (e.g., lower total fees on transactions from VIP users, promotional rates for specific campaigns, etc.) entirely within your own system.
Attribution percentages are calculated from
totalVolume(if provided) oramount(who influenced the sale)If using fee router: Commission amounts are distributed from
commission(the portion you allocate to referrers)If using fee router: ReplyCorp fee is calculated from
netProfitIf not using fee router: Store the attribution data from the API response and distribute fees later using your own system
What you must do (Fee Router Path):
Identify when conversions occur (purchases, token locks, etc.)
Calculate totalVolume, netProfit, and commission for each conversion
Get the user's Twitter/X ID
Make a single API call to record the conversion with all three financial fields
Extract the conversion ID and attributionHash from the response
Verify attribution data in contract matches the hash
Approve contract to spend tokens (for ERC20)
Call startDistribution with conversion ID and hash
Process batches using processBatch (for conversions with >200 recipients)
Call finalizeDistribution to complete the distribution
What you must do (Non-Fee Router Path):
Identify when conversions occur (purchases, token locks, etc.)
Get the user's Twitter/X ID
Make a single API call to record the conversion with
amountfield (ortotalVolume/netProfit/commissionif you want more detailed attribution)Store the complete API response (including
conversion.idandattribution.attributions[])Later, calculate payouts from stored attribution data and distribute using your own system (see section 2.5 for best practices)
Integration flow (Fee Router Path):
After a successful purchase → calculate totalVolume, netProfit, commission
Call conversion API with all three financial fields
ReplyCorp calculates attribution percentages from totalVolume
ReplyCorp calculates ReplyCorp fee from netProfit
ReplyCorp updates your smart contract with attribution data (percentages from totalVolume, amounts from commission)
ReplyCorp returns API response with conversion ID, attributionHash, and fee distribution amounts
You verify attribution hash matches contract data
You approve contract to spend tokens
You call startDistribution with conversion ID and hash (contract pulls tokens)
You process batches using processBatch (for conversions with >200 recipients)
You call finalizeDistribution to complete the distribution
Contract transfers ReplyCorp fee immediately, then distributes commission to referrers in batches
Integration flow (Non-Fee Router Path):
After a successful purchase → record conversion with
amountfieldCall conversion API with conversion data
ReplyCorp calculates attribution percentages from amount (or totalVolume if provided)
ReplyCorp returns API response with conversion ID and attribution data
Store the complete API response in your database
Later (weekly/monthly/on-demand), calculate payouts from stored attribution data
Distribute fees using your own payment system or smart contract
Code Example:
Code Example (Non-Fee Router Path):
What ReplyCorp handles automatically:
Attribution calculation (who influenced the conversion)
Contract updates with attribution data (before API response) - only when fee router contract is configured
Network graph tracking
EXAMPLE COMPLETE INTEGRATION FLOW: CEX SCENARIO
This example walks through a complete integration flow for a CEX (Centralized Exchange) scenario to illustrate how all the pieces fit together.
Scenario Setup:
User buys $100 of tokens on your platform (
totalVolume)Platform fees (2% transaction fee): $2
Net profit: $2 (platform fees = your revenue)
Commission: $0.40 (Assuming 20% commission of net profit = 20% × $2)
ReplyCorp fee: $0.10 (5% of net profit = 5% × $2)
Integration Flow:
When the transaction happens, you call our API with:
User's X ID
totalVolume= $100netProfit= $2commission= $0.40
ReplyCorp's API responds telling you to send $0.50 total to the fee router contract, which would then route $0.40 to referrers, and $0.10 to ReplyCorp.
You send the funds to the contract using
startDistribution(),processBatch(), andfinalizeDistribution()as described in section 2.
This example demonstrates how totalVolume represents the user's purchase amount, netProfit is your actual revenue (platform fees), commission is the portion you allocate for referral rewards, and how ReplyCorp calculates its fee from your net profit.
What You DON'T Need to Build
ReplyCorp handles all of this automatically:
✅ Twitter/X stream monitoring - We track mentions, replies, and engagement
✅ Network graph construction - We map who influenced whom
✅ Attribution calculations - We determine which referrers drove conversions
✅ Points distribution - We calculate and distribute points automatically
✅ Participant onboarding - Users join automatically when they engage on Twitter
Integration Checklist
Pre-Integration (Before Starting)
Integration Steps
Add conversion tracking API call (2-4 hours)
Identify conversion events in your codebase
Map users to Twitter IDs (if needed)
Implement net profit calculation (gross revenue minus all costs)
Add API call after each conversion with net profit amount
Extract conversion ID from response
Integrate contract distribution check and fee sending
Test end-to-end flow: API call → contract check → fee distribution
Post-Integration
Test with real conversions
Monitor attribution results
Adjust campaign settings as needed
Technical Requirements
What you must have:
Ability to make HTTP requests (any language/framework)
Access to user's Twitter/X ID when conversions occur
Basic understanding of REST APIs
Smart contract deployment capability
Web3 wallet/account for contract deployment
Ability to interact with smart contracts (send transactions, read state)
What you don't need:
Twitter API credentials (ReplyCorp handles that)
Database changes (ReplyCorp stores everything)
Background workers (ReplyCorp processes in real-time)
Complex infrastructure (ReplyCorp is the infrastructure)
Support & Resources
Documentation:
Full API docs: See
REPLYWEB_API_DOCUMENTATION.md(ReplyCorp API Documentation)Code examples: JavaScript, Python, PHP available
Support:
Account Setup & Access: Contact ReplyCorp
Technical Support: Email [email protected]
Response time: Typically within 24 hours
Getting Started:
Contact ReplyCorp with your organization name and use case
ReplyCorp sets up your account
Log into the admin panel to retrieve your API key and campaign ID
Enter contract parameters in the admin panel (ReplyCorp fee percentage is set by ReplyCorp)
Follow the integration steps above
Test with sample data
Go live!
Prerequisites
Before starting integration, ensure you have:
⚠️ CRITICAL Requirements:
Funded distribution wallet: The wallet that calls
startDistribution()must have sufficient ERC-20 token balance at the time of execution. The contract pulls tokens from this wallet to perform distributions. You can fund it in real time by routing conversion proceeds to it, or pre-fund it in advance and keep it topped up over time. See section 2 for details.Consistent token denomination: All financial data (
totalVolume,netProfit,commission) posted to the API must be denominated in the same ERC20 token you're using for rewards. For example, if distributing USDC, all amounts must be in USDC units.
Twitter IDs for your users - You must be able to map users to their Twitter/X IDs when conversions occur. If you don't have this, add 1-2 hours to build the mapping.
Smart contract deployment capability - You must be able to deploy contracts to your chosen blockchain network and interact with them programmatically.
Contract parameters - You must enter contract parameters in the admin panel before deployment:
Blockchain network (chain)
Token address for fee distribution
Revenue share percentage
ReplyCorp fee percentage (set by ReplyCorp when creating your account)
Net profit calculation capability - You must be able to calculate net profit for each conversion (gross revenue minus all costs). The
amountfield in conversion API calls must always be net profit, as this determines the referral fees that will be distributed.
Bottom Line: Most integrations take 6-8 hours of development time. The integration requires: (1) entering contract parameters in the admin panel (chain, token address, revenue share %) and deploying a smart contract, (2) calling the conversion API which automatically updates your contract with attribution data, and (3) checking the contract and sending fees for distribution. ReplyCorp handles all the complex parts (Twitter monitoring, attribution calculation, contract updates, fee percentage configuration). If you can deploy smart contracts, make HTTP requests, and have access to Twitter IDs, you're ready to integrate.
Last Updated: February 2026
Last updated

