Retrieve created connections for the current user
Parameters
slug
:string
(optional)
The URL slug of the connector as configured in the Xkit developer portal to filter the returned connections by service.
Returns
Promise<Connection[]>
A Promise
that resolves to an array of Connection
s.
listConnections
retrieves all of the connections for the current user. If the user has connected the same connector multiple times (e.g. through addConnection
) then multiple connections to the same connector will appear here.
const connectors = await xkit.listConnections()
console.log(connections)
// [
// {
// id: "unique-id",
// enabled: true,
// authorization: {
// status: "active",
// }
// connector: {
// name: "Slack",
// slug: "slack"
// },
// {
// id: "unique-id-2",
// enabled: true,
// authorization: {
// status: "active",
// }
// connector: {
// name: "Google Calendar",
// slug: "google-calendar"
// }
// ]
const connectors = await xkit.listConnections("slack")
console.log(connections)
// [
// {
// id: "unique-id",
// enabled: true,
// authorization: {
// status: "active",
// }
// connector: {
// name: "Slack",
// slug: "slack"
// }
// ]