Complete the OAuth flow for a third-party integration.
URL Parameters
The type of integration being connected. Valid values:
google-analytics
notion
slack
zoho
gmail
Request
The OAuth authorization code
The state parameter from the OAuth flow
Response
The response format varies by integration type:
Google Analytics
Whether the callback was successful
List of available Google Analytics properties{
id: string
name: string
websiteUrl: string
}[]
Temporary token for property selection
The redirect URI provided during connection
Notion
Whether the callback was successful
Connected Notion workspace details{
id: string
name: string
icon: string
}
The redirect URI provided during connection
Slack
Whether the callback was successful
Connected Slack team details{
id: string
name: string
domain: string
}
The redirect URI provided during connection
Zoho
Whether the callback was successful
Connected Zoho organization details{
id: string
name: string
modules: string[]
}
The redirect URI provided during connection
Gmail
Whether the callback was successful
The redirect URI provided during connection
Example
curl -X POST https://suada.ai/api/public/integrations/notion/callback \
-H "Content-Type: application/json" \
-d '{
"code": "oauth-code-from-provider",
"state": "oauth-state-from-provider"
}'
{
"success": true,
"message": "Notion workspace connected successfully",
"workspace": {
"id": "workspace-id",
"name": "My Workspace",
"icon": "https://notion.so/icons/workspace.png"
},
"passthroughRedirectUri": "https://your-app.com/oauth/callback"
}
Error Codes
Invalid request{
"error": "Missing required parameters"
}
Invalid OAuth code or state{
"error": "Invalid OAuth code"
}
Server error{
"error": "Failed to complete OAuth flow"
}
Notes
- This endpoint should be called after receiving the OAuth callback from the integration provider
- The
state parameter is used to verify the OAuth flow and prevent CSRF attacks
- For Google Analytics, you’ll need to make an additional call to select a property
- After successful callback, redirect the user to the
passthroughRedirectUri provided during connection
- The integration will be automatically enabled for the user after successful callback