POST
/
integrations
/
{integrationType}
/
callback
{
  "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"
}
Complete the OAuth flow for a third-party integration.

URL Parameters

integrationType
string
required
The type of integration being connected. Valid values:
  • google-analytics
  • notion
  • slack
  • zoho
  • gmail

Request

code
string
required
The OAuth authorization code
state
string
required
The state parameter from the OAuth flow

Response

The response format varies by integration type:

Google Analytics

success
boolean
Whether the callback was successful
message
string
Success or error message
properties
array
List of available Google Analytics properties
{
  id: string
  name: string
  websiteUrl: string
}[]
temporaryAccessToken
string
Temporary token for property selection
passthroughRedirectUri
string
The redirect URI provided during connection

Notion

success
boolean
Whether the callback was successful
message
string
Success or error message
workspace
object
Connected Notion workspace details
{
  id: string
  name: string
  icon: string
}
passthroughRedirectUri
string
The redirect URI provided during connection

Slack

success
boolean
Whether the callback was successful
message
string
Success or error message
team
object
Connected Slack team details
{
  id: string
  name: string
  domain: string
}
passthroughRedirectUri
string
The redirect URI provided during connection

Zoho

success
boolean
Whether the callback was successful
message
string
Success or error message
organization
object
Connected Zoho organization details
{
  id: string
  name: string
  modules: string[]
}
passthroughRedirectUri
string
The redirect URI provided during connection

Gmail

success
boolean
Whether the callback was successful
message
string
Success or error message
passthroughRedirectUri
string
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

400
object
Invalid request
{
  "error": "Missing required parameters"
}
401
object
Invalid OAuth code or state
{
  "error": "Invalid OAuth code"
}
500
object
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