Kustomer typescript API client
Missing something? Create feature request!
Read documentation 📘 or API reference 📕
# NPM
npm install kustomer-client
# Yarn
yarn add kustomer-client
import { createKustomerClient, KustomerApi } from 'kustomer-client'
const client = createKustomerClient({
subdomain: 'subdomain', // https://{subdomain}.api.kustomerapp.com
auth: 'api key',
})
const conversations = await KustomerApi.getConversations({
client,
query: {
page: 1,
pageSize: 5,
},
}).then((v) => v.data.data)
for (const conversation of conversations) {
const messages = await KustomerApi.getMessagesByConversation({
client,
path: {
id: conversation.id,
},
}).then((v) => v.data.data)
for (const message of messages) {
console.log(message)
}
await KustomerApi.updateConversation({
client,
path: {
id: conversation.id,
},
body: {
name: 'My new name',
},
})
}