Webhooks
Index
Read-To-Use Script to break down assets by type
Automation Example 1: Using Webhooks to capture connection data in a spreadsheet (w/ Zapier)
Automation Example 2: Using Webhooks to update a CRM with connection data (w/ Zapier)
Automation Example 3: Using Webhooks to send notifications to Slack (w/ Zapier)
What can I do with Webhooks?
Webhooks can be used to trigger automation after you receive access to client assets.
Using our Webhook, you can connect Leadsie with automation tools such as Zapier, Pabbly Connect, Make (formerly Integromat) or your own application.
For example, you could send an email to a client that successfully connected their accounts with you or send an internal email to a team member.
Another example would be incorporating the accounts that your client has authorized you to access into a CRM.
How Can I Use Webhooks?
Once you have your Webhook URL, go to your Leadsie Dashboard > Settings > Webhooks & API
Here you can enter your Webhooks URL where a POST request will be sent every time one of your requests gets a new connection.
NOTE: You can specify the user Id by appending a parameter to the request URL ?customUserId=user123456
If this customUserId is left empty, then the response will not show a user Id.
Once a user completes a request, you will be sent a "post request" like the following to that webhook.
You can also set the userId by adding a customer parameter in the connection page URL:
?customUserId=SOME_UNIQUE_STRING
More specifically, it will have this structure:
{ user: String, // this will be set as the customUserId that was passed through to the page in the parameters requestUrl: String, // the url of the request requestName: String, // the name of the request if there is one - or else a specific id tied to that request clientName: String, // the name of the client clientSummaryUrl: String, // the url of a summary page to see all assets for this client accessLevel: "view" | "admin", status: 'SUCCESS'|'PARTIAL_SUCCESS'|'FAILED', connectionAssets: [{ type: "Ad Account" | "Page" | "Pixel" | "Instagram Account" | "Catalog", name: String, id: String, isSuccess: Boolean, message: String time: Date, }
For the full webhook payload example, see the bottom of this document.
Script to use in Zapier (or other tools) to get separate data for each asset
import json try: actual_payload = input.get('payload', {}) if isinstance(actual_payload, str): actual_payload = json.loads(actual_payload) output = { 'user_id': actual_payload.get('user', ''), # Use get to avoid KeyError if 'user' is not set 'requestUrl': actual_payload['requestUrl'], 'requestName': actual_payload['requestName'], 'clientName': actual_payload['clientName'], 'clientSummaryUrl': actual_payload.get('clientSummaryUrl', '') } # Loop through each item in connectionAssets for item in actual_payload['connectionAssets']: prefix = item['type'].lower().replace(' ', '_') # Create a prefix for output keys based on asset type # Add the relevant data to output with keys prefixed by asset type, aggregate if key already exists output[f"{prefix}_id"] = f"{output.get(f'{prefix}_id', '')}, {item['id']}".strip(', ') output[f"{prefix}_name"] = f"{output.get(f'{prefix}_name', '')}, {item['name']}".strip(', ') output[f"{prefix}_is_success"] = f"{output.get(f'{prefix}_is_success', '')}, {item['isSuccess']}".strip(', ') output[f"{prefix}_message"] = f"{output.get(f'{prefix}_message', '')}, {item.get('message', '')}".strip(', ') except KeyError as e: output = {'error': f"KeyError: The key {str(e)} is not present in the input data.", 'available_keys': list(actual_payload.keys()) if 'actual_payload' in locals() else []} except json.JSONDecodeError as e: output = {'error': f"JSONDecodeError: Could not decode the payload string. Error: {str(e)}", 'raw_payload': str(input.get('payload', ''))} return output
Automation Example 1: Using Webhooks to capture connection data in a spreadsheet (w/ Zapier)
Automation Example 2: Using Webhooks to update a CRM with connection data (w/ Zapier)
Automation Example 3: Using Webhooks to send notifications to Slack (w/ Zapier)
Full Webhook Payload Example
{ "user": "test-user-2025-08-28T14:03:57.010Z", "accessLevel": "admin", "requestName": "a7b91c51d853b609335044ef", "requestUrl": "https://app.leadsie.com/connect/test-agency/manage", "status": "SUCCESS", "clientName": "Test Success Ad Account", "connectionAssets": [ { "id": "178046477", "name": "Test Success Ad Account", "type": "Ad Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "581293397", "name": "Test Success Page", "type": "Page", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "601877191", "name": "Test Success Catalog", "type": "Catalog", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "312556001", "name": "Test Success Pixel", "type": "Pixel", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "101847607", "name": "Test Success Instagram Account", "type": "Instagram Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "424026827", "name": "Test Success Google Analytics Account", "type": "Google Analytics Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "150145609", "name": "Test Success Google My Business Location", "type": "Google My Business Location", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "sc-domain:example.com", "name": "example.com", "type": "Google Search Console", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "147620651", "name": "Test Success Google Merchant Center", "type": "Google Merchant Center", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "101951806", "name": "Test Success Google Tag Manager", "type": "Google Tag Manager", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "124840775", "name": "Test Success Google Ads Account", "type": "Google Ads Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "500691409", "name": "Test Success TikTok Advertiser Account", "type": "TikTok Advertiser Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "203724496", "name": "Example Company 1", "type": "LinkedIn Company Page", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "203724496", "name": "Example Company 2", "type": "LinkedIn Company Page", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "196454928", "name": "Example Ad Account 1", "type": "LinkedIn Ad Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "196454929", "name": "Example Ad Account 2", "type": "LinkedIn Ad Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z" }, { "id": "181738653", "name": "Test Success Shopify Store", "type": "Shopify Store", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z", "shopifyCollaboratorCode": "1234" }, { "id": "example.wordpress.com", "name": "example.wordpress.com", "type": "WordPress Site", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z", "userConfirmedCompletion": true }, { "id": "@example-channel", "name": "Example Channel", "type": "YouTube Channel", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.799Z", "userConfirmedCompletion": true }, { "id": "30426991", "name": "Test Success Microsoft Ads", "type": "Microsoft Ads", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.800Z" }, { "id": "192638612", "name": "Test Success Mailchimp Account", "type": "Mailchimp Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.800Z", "userConfirmedCompletion": true }, { "id": "118160293", "name": "Test Success Pinterest Ad Account", "type": "Pinterest Ad Account", "connectionStatus": "Connected", "wasInitialGrantSuccessful": true, "wasAlreadyConnected": false, "isSuccess": true, "time": "2025-08-28T10:47:01.800Z", "userConfirmedCompletion": true } ] }