Skip to main content

Read Recommendations

tip

Install the GraphQL packages before starting this section.

In this section, we'll help you write a simple query to get recommended connections for a user from social graph.

  1. Initialize the GraphQL client:
/src/queries/GetRecommendations.tsx
const client = new GraphQLClient(CYBERCONNECT_ENDPOINT);
  1. Write a query to get a list of recommended connections for a user, including their address, domain, and recommendationReason:
/src/queries/GetRecommendations.tsx
export const GET_RECOMMENDATIONS = gql`
query($address: String!) {
recommendations(address: $address) {
result
data {
list {
address
domain
recommendationReason
}
}
}
}
`;

Make sure to check out the full list of fields available in the CyberConnect API.

Sandbox‚Äč

You can write your own query in the Playground or experiment with our code in the sandbox below!

Designed by