Edits history of script submission #16566 for ' Get Cards (kustomer)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Kustomer = {
      apiKey: string;
    };
    /**
     * Get Cards
     * Fetches all installed cards for an organization.
    
    **Note**: Installed cards are the cards that will be displayed for a particular org using
    the app. They can be displayed on the customer, company, conversation, or kobject
    contexts.
     */
    export async function main(auth: Kustomer) {
      const url = new URL(`https://api.kustomerapp.com/v1/cards`);
    
      const response = await fetch(url, {
        method: "GET",
        headers: {
          Authorization: "Bearer " + auth.apiKey,
        },
        body: undefined,
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 235 days ago