Skip to main content

Creating Expert Records

To automate the configuration of your users, you can manage expert records with the API.

Ensure expert records exist

Before a user can initiate a conversation, they need to have an expert record created for themselves. The expert record includes the name they'd like to be shown to customers and other details about them. A safe approach to ensure expert records exists is two parts. First, list experts and see if one already exists. Second, if no expert exists, create an expert. In either case, store the expert ID for later use.

Listing existing experts

The experts associated with the current users can be listed with the following GraphQL query:

fragment ExpertDetails on Expert {
id
user
name
}

query GetAllExperts {
allExperts {
edges {
node {
...ExpertDetails
}
}
}
}

Creating new experts

If no expert records exist, a new expert can be created with the following mutation:

input ExpertInput {
name: String!
phoneNumber: String!
bio: String
}

mutation CreateExpert($expert: ExpertInput!) {
createExpert(expert: $expert) {
id
}
}