GraphQL Query to Fetch Generated Webhook for Connectors

Hello Everybody.

Introduction

This article shows you how a GQL Query can be used to fetch the Webhook URL generated by Harness when a Git Connector is created for Bi-directional syncing.

Summary

When a Connected is currently created we are provided the chance to copy the Generated Webhook in a small modal but lets say a user wants to fetch the Webhook details of all the connectors the below query can be used.

query{
  connectors(filters: [
    {
      connectorType: {
        operator: EQUALS,
        values: [GIT]
      }
    }
  ],
  limit: 10){
    nodes{
      id
      name
      ...on GitConnector {
        branch
        webhookUrl
      }
    }
  }
}

The output for this query will return the Name of the Connector, the Branch it is configured to and most importantly the Webhook URL.

1 Like