Guides

Peer to peer recommendations

Introducing the new peer-to-peer recommendation feature, designed to enhance connections and create a stronger community by peer-to-peer vetting. Users can now recommend or unrecommend peers, fostering a more interconnected and supportive network. Keep in mind, this feature is centralized for now, so there's no smart contract calls involved, and is only used for building customized features like favorite contacts etc. Here's how to leverage these mutations:

Peer to peer recommend

To recommend another profile, use the peerToPeerRecommend mutation. Ensure you're authorized with your profile, and specify the profile ID you wish to recommend.

  • If you have already recommended a given profile, nothing will happen.
  • If you try to recommend the authenticated profile, it will error out.
mutation PeerToPeerRecommend {
  peerToPeerRecommend(request: {profileId: "<TARGET_PROFILE_ID>"}) {
    // Mutation response (void in this case, so no specific fields to query)
  }
}

Peer-to-Peer Unrecommend

To undo a recommendation, use the peerToPeerUnrecommend mutation with the profile ID of the previously recommended peer.

  • If you try to call this mutation on a non-recommended profile, nothing will happen.
mutation PeerToPeerUnrecommend {
  peerToPeerUnrecommend(request: {profileId: "<TARGET_PROFILE_ID>"}) {
    // Mutation response (void in this case, so no specific fields to query)
  }
}

Getting recommendation status on profiles you recommended

As an authenticated user, you can use the peerToPeerRecommendedByMe field resolver on a Profile object to get the information of whether you have already recommended a queried profile. If unauthenticated, it will always return false.

query Profile {
  profile(request: {forProfileId: "<TARGET_PROFILE_ID>"}) {
    id   
    peerToPeerRecommendedByMe
  }
}
{
  id: "0x01",
  peerToPeerRecommendedByMe: true
}