//native
type Kustomer = {
apiKey: string;
};
/**
* Create Knowledge Base
* Create a new Knowledge Base resource
*/
export async function main(
auth: Kustomer,
body: {
name: string;
brand: string;
noIndex?: false | true;
theme?: string;
baseUrl?: string;
subdomain: string;
logo?: string;
favicon?: string;
homepageTitle?: string;
includeAllData?: false | true;
defaultLanguage?: string;
languages?: {};
metaTags?: string[];
},
) {
const url = new URL(`https://api.kustomerapp.com/v1/kb/knowledge-bases`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago