Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions api/feedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const HUBSPOT_PORTAL_ID = '47435488'
const HUBSPOT_FORM_ID = '80c7a6ab-9b96-412f-9469-aa2bc14faa18'
const HUBSPOT_SUBMIT_URL = `https://api.hsforms.com/submissions/v3/integration/submit/${HUBSPOT_PORTAL_ID}/${HUBSPOT_FORM_ID}`

function isValidEmail(value: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
Comment thread
ocandocrypto-uniswap marked this conversation as resolved.
}

export default async function handler(req: any, res: any) {
if (req.method !== 'POST') {
return res.status(405).json({ success: false, error: 'Method not allowed' })
}

try {
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body || {}
const { email, feedbackType, issue, followUp, challenges, docsUsefulness, pageUrl, website } = body

if (website) return res.status(200).json({ success: true }) // honeypot
if (!email || !isValidEmail(email)) return res.status(400).json({ success: false, error: 'Invalid email' })
if (!feedbackType || !issue) return res.status(400).json({ success: false, error: 'Missing required fields' })

const fields = [
{ name: 'email', value: String(email) },
{ name: 'type_of_feedback', value: String(feedbackType) },
{ name: 'whats_the_issue_idea_or_question', value: String(issue) },
Comment thread
ocandocrypto-uniswap marked this conversation as resolved.
{ name: 'can_we_follow_up_with_you_about_your_feedback', value: followUp ? 'Yes' : 'No' },
...(challenges?.trim()
? [{ name: 'what_has_been_the_most_challenging_part_of_building_on_or_integrating_with_uniswap', value: challenges.trim() }]
Comment thread
ocandocrypto-uniswap marked this conversation as resolved.
: []),
...(docsUsefulness?.trim()
? [{ name: 'have_you_found_uniswap_docs_to_be_useful', value: docsUsefulness.trim() }]
: []),
]

const payload = {
fields,
legalConsentOptions: {
consent: {
consentToProcess: true,
text: 'By submitting, I agree to Uniswap Labs Terms of Service and Privacy Policy.',
},
},
context: {
pageUri: pageUrl || '',
pageName: 'Feedback | Uniswap Docs',
},
}

const hsRes = await fetch(HUBSPOT_SUBMIT_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
})

if (!hsRes.ok) {
const hsText = await hsRes.text()
return res.status(502).json({ success: false, error: 'HubSpot submission failed', details: hsText })
}

return res.status(200).json({ success: true })
} catch {
return res.status(500).json({ success: false, error: 'Internal server error' })
}
}
23 changes: 7 additions & 16 deletions docs/api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@ id: overview
sidebar_position: 1
title: Overview
---

## Uniswap APIs

Welcome to the Uniswap API documentation. Uniswap provides several APIs and data sources to help developers integrate with and build on top of the Uniswap protocol.
Uniswap provides several APIs and data sources to help developers integrate with and build on top of the Uniswap protocol.

## Available APIs

### Trading API
The Uniswap Trading API provides quote generation and transaction building for token swaps across 25+ chains.

- **[Trading API Overview](./trading/overview)** - Get started with the Trading API
- **[Integration Guide](./trading/integration-guide)** - Complete implementation guide with schemas and best practices
- **[Integration Guide](https://api-docs.uniswap.org/guides/integration_guide)** - Complete implementation guide with schemas and best practices
- **Quote & Swap Endpoints** - Generate quotes and build unsigned transactions
- **Permit2 Support** - Gasless approvals via EIP-712 signatures
- **Cross-Chain Swaps** - Multi-step cross-chain swap support
Expand Down Expand Up @@ -44,10 +43,10 @@ Get real-time and historical price data for tokens on Uniswap.

### For Developers
If you're building applications that need to:
- Execute token swaps Use the **[Trading API](./trading/overview)**
- Query historical trading data Use the **Subgraph API**
- Get optimal swap routes Use the **Routing API**
- Display token prices Use the **Price APIs**
- Execute token swaps - Use the **[Trading API](https://developers.uniswap.org/dashboard/)**
- Query historical trading data - Use the **Subgraph API**
- Get optimal swap routes - Use the **Routing API**
- Display token prices - Use the **Price APIs**

### For Data Analysis
The Subgraph API is perfect for:
Expand All @@ -60,12 +59,4 @@ The Subgraph API is perfect for:

- **Subgraph API**: Generous rate limits via The Graph
- **Routing API**: Production-ready with caching
- **Price APIs**: Real-time updates with historical data

## Support and Resources

- **Discord**: Join the Uniswap developer community
- **GitHub**: Explore code examples and integrations
- **Documentation**: Comprehensive guides and references

Ready to start building? Choose the API that fits your needs from the navigation menu.
- **Price APIs**: Real-time updates with historical data
Loading
Loading