> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suada.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration Callback

> Handle OAuth callback for an integration

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

```ts theme={null}
{
  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

```ts theme={null}
{
  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

```ts theme={null}
{
  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

```ts theme={null}
{
  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

```bash cURL theme={null}
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"
  }'
```

```typescript TypeScript theme={null}
import { Suada } from '@suada/node';

const suada = new Suada({
  apiKey: 'your-api-key'
});

const result = await suada.handleIntegrationCallback('notion', {
  code: 'oauth-code-from-provider',
  state: 'oauth-state-from-provider'
});

// Redirect user back to their application
window.location.href = result.passthroughRedirectUri;
```

```python Python theme={null}
from suada import Suada, SuadaConfig

suada = Suada(
    config=SuadaConfig(
        api_key="your-api-key"
    )
)

result = suada.handle_integration_callback(
    integration_type="notion",
    code="oauth-code-from-provider",
    state="oauth-state-from-provider"
)

# Redirect user back to result.passthrough_redirect_uri
```

```json theme={null}
{
  "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

```json theme={null}
{
  "error": "Missing required parameters"
}
```

**401** `object`

Invalid OAuth code or state

```json theme={null}
{
  "error": "Invalid OAuth code"
}
```

**500** `object`

Server error

```json theme={null}
{
  "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](https://docs.suada.ai/api-reference/integrations/select-property.md)
* After successful callback, redirect the user to the `passthroughRedirectUri` provided during connection
* The integration will be automatically enabled for the user after successful callback


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.