Working with the GraphQL API
Want to create custom workflows with your product? or create internal tools around customer feedback flows with UserVitals? Our API is the best way to do that. Push customer feedback from any platform
UserVitals's public API is built using GraphQL. If you're new to GraphQL, Apollo has resources for beginners. The official documentation is another good starting point.

Endpoint

UserVital's GraphQL endpoint is:
1
https://api.uservitalshq.com/v1/
Copied!
It supports introspection so you can query the whole schema.

Authentication

Right now we support API key authentication.

Personal API keys

A Personal API key is the easiest way to access the API. They can be created in Settings -> API. To authenticate your requests, you need to pass the newly created key as an Authorization header:
1
curl \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-H "authorization: Bearer <Replace this with your API Key>" \
5
-H "auth-provider: custom" \
6
--data '{"query":"query { me { id name email imageUrl} }"}' \
7
https://api.uservitalshq.com/
Copied!

Getting Started

We recommend using a GraphQL client to introspect and explore the schema.

Insomnia is a free HTTP client that supports GraphQL. GraphQL Playground from Prisma is a dedicated GraphQL client that also has a desktop app.
Point the GraphQL client to the API endpoint:
1
https://api.uservitalshq.com/
Copied!
Once you have your client installed, you can start making queries (read) and mutations (write) to the API.

Query the current user

To get information about the authenticated user, you can use the me query:
1
query {
2
me {
3
id
4
name
5
email
6
}
7
}
Copied!

Creating an Inbox message

To create a new message, we'll need to create a mutation:
1
mutation {
2
createMessage(input: {
3
title: "Mesage from API",
4
content: "Some content",
5
customerName: "Sarah Lee",
6
customerEmail: "[email protected]",
7
sourceUrl: "https://secure.helpscout.net/",
8
status: UNREVIEWED,
9
labels: ["Urgent"]
10
}) {
11
id
12
title
13
contact {
14
id
15
email
16
name
17
}
18
labels {
19
label {
20
name
21
}
22
}
23
status
24
content
25
}
26
}
Copied!
This mutation will create a new message and return it's requested fields if the call was successful. In this call - it will create a message, assigned to a customer called Sarah Lee, with the status of UNREVIEWED and assign a label called Urgent (A label that was already created from the settings page)
Only a title and content are required fields. If customerName or customerEmail is not provided then the message will be assigned to Anonymous. The status defaults to unreviewed if not specified. You can provide a list of labels that will be assigned to the message, provided the label already exists in your workspace.

Support

If you run into problems or have questions or suggestions, you can join our customer Slack or send us an email at [email protected]. Both options are available through the UserVitals app.
Last modified 2mo ago