|
1 | | -# Connect Webhooks |
| 1 | +# Connect Webhooks |
| 2 | + |
| 3 | +When you [generate a Connect token](/connect/quickstart/#generate-a-token), you can pass a `webhook_uri` parameter. Pipedream will send a POST request to this URL when the user completes the connection flow, or if an error occurs at any point. [See the API docs](/connect/api#create-a-new-token) for details. |
| 4 | + |
| 5 | +## Webhook events |
| 6 | + |
| 7 | +- `CONNECTION_SUCCESS` - Sent when the user successfully connects their account |
| 8 | +- `CONNECTION_ERROR` - Sent when an error occurs during the connection flow |
| 9 | + |
| 10 | +## Webhook payload |
| 11 | + |
| 12 | +### Successful connection |
| 13 | + |
| 14 | +Please note that user credentials are not sent in the webhook request. To retrieve credentials, use the [Connect API to fetch the account](/connect/api#retrieve-account-details-by-id) using the `account.id` provided in the webhook payload. |
| 15 | + |
| 16 | +```json |
| 17 | +{ |
| 18 | + "event": "CONNECTION_SUCCESS", |
| 19 | + "connect_token": "abc123", |
| 20 | + "environment": "production", |
| 21 | + "connect_session_id": 123, |
| 22 | + "account": { |
| 23 | + "id": "apn_abc123", |
| 24 | + "name": "My Slack workspace", |
| 25 | + "external_id": "U123456", |
| 26 | + "healthy": true, |
| 27 | + "dead": false, |
| 28 | + "app": { |
| 29 | + "id": "app_abc123", |
| 30 | + "name_slug": "slack", |
| 31 | + "name": "Slack", |
| 32 | + "auth_type": "oauth", |
| 33 | + "description": "Slack is a channel-based messaging platform", |
| 34 | + "img_src": "https://assets.pipedream.net/icons/slack.svg", |
| 35 | + "custom_fields_json": [], |
| 36 | + "categories": "Communication", |
| 37 | + }, |
| 38 | + "created_at": "2021-09-01T00:00:00Z", |
| 39 | + "updated_at": "2021-09-01T00:00:00Z", |
| 40 | + } |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +### Error |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "event": "CONNECTION_ERROR", |
| 49 | + "connect_token": "abc123", |
| 50 | + "environment": "production", |
| 51 | + "connect_session_id": 123, |
| 52 | + "error": "You've hit your limit on the number of external users you can connect." |
| 53 | +} |
| 54 | +``` |
0 commit comments