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.
- Initialize the GraphQL client:
/src/queries/GetRecommendations.tsx
const client = new GraphQLClient(CYBERCONNECT_ENDPOINT);
- Write a query to get a list of recommended connections for a user, including their
address
,domain
, andrecommendationReason
:
/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!