How integrations work
When a user connects your integration, Top.gg performs a one-time handshake with your service: it sends anintegration.create event to your configuration URL, and you respond with the webhook URL and event scopes you want to subscribe to. From that point on, Top.gg delivers signed webhook events to your endpoint just like any other webhook.
When a user disconnects, Top.gg sends an integration.delete event so you can clean up the connection on your side.
The handshake flow
1
User clicks Connect
A user visits your integration page on Top.gg and clicks the Connect button.
2
Top.gg sends integration.create to your config URL
Top.gg sends a
POST request to your integration’s configuration URL with an integration.create payload. This includes a connection_id that uniquely identifies this connection and a webhook_secret you’ll use to verify future webhook deliveries.3
Store the connection and respond with your webhook configuration
Persist the
connection_id and webhook_secret for this user. Then respond with the webhook URL you want Top.gg to deliver events to and the list of event scopes you’re subscribing to.4
Connection established
Top.gg confirms the connection. Going forward, Top.gg delivers webhook events for the subscribed scopes to your
webhook_url, signed with the webhook_secret from step 2. Verify signatures using the standard v1 signature verification process.Handling disconnections
When a user removes the managed webhook from their dashboard, Top.gg sends anintegration.delete event to your configuration URL. Use the connection_id to identify which connection to remove from your system.
2xx status to acknowledge the deletion.
Integration payload fields
The following table describes every field in theintegration.create payload.