ClearFeed Help Center
ChangelogSign Up
  • Getting Started
    • Integrate Slack
    • For Customer Support
      • ClearFeed Helpdesk
      • Slack <> Ticketing Integration
    • For Internal Support
      • ClearFeed Helpdesk
      • Slack <> Ticketing Integration
    • GPT-Powered Answers
    • Security
  • ACCOUNT SETUP
    • Collections
      • For External Helpdesk
      • For Internal Helpdesk
      • For Integrations
    • Manage Request Channels
    • Setup Triage Channel
    • Teams Setup
    • Email Setup
    • Customer Portal
    • Web Chat
    • Child Accounts
    • Manage Users
    • Login Methods
    • Personal Preferences
  • Create Requests
    • Slack Channels
    • Private Tickets
    • DMs on Slack
    • Email
    • Web Chat
    • From Triage Channel
    • Web Dashboard
    • API
  • Manage Requests
    • Triage Channels
      • For External Helpdesk
      • For Internal Helpdesk
      • For Integrations
    • Web Dashboard
    • ClearFeed Slack App
    • Request Fields
  • Helpdesk Features
    • Tickets
    • Tasks
    • Custom Fields
    • Forms
    • Emoji Rules
    • Insights
    • Quick Replies
    • Customers
    • Automations
    • Workflows
    • Business Schedule & SLA
    • Assignment Rules
    • Team Assignment
    • CSAT Survey
    • Announcements
    • Welcome Messages
    • AI Fields
    • Digests
    • Notifications
    • Importing Insights Data into Google Sheets
  • ClearFeed AI
    • GPT-Powered Answers
      • Virtual Agent & Agent Assistant
      • Testing GPT-Powered Answers
      • Personalize GPT-Powered Answers Name & Logo
    • Knowledge Sources
      • Private Knowledge Sources
        • Confluence
        • Zendesk
        • Freshdesk
        • Notion
        • Slack Channels
        • Slack Canvas
        • Coda
        • Google Drive
        • Other Supported KS
      • Public Knowledge Sources
      • Managing Knowledge Sources
      • FAQs
    • Prompt Customization
    • Search Using Natural Language
    • Bot Interactions
    • ClearBot Assist
    • AI Agents
  • Integrations
    • Task & Ticketing Systems
    • Zendesk
      • Forms
    • Freshdesk
      • Forms
    • Intercom
      • Forms
    • ClickUp
      • Lists
    • HubSpot
      • Forms
    • Salesforce Service Cloud
    • Jira Service Management
    • Jira
    • Linear
    • Asana
    • GitHub
    • FAQs
  • Account Settings
    • Whitelabel ClearFeed
    • Additional Settings
      • Bot Whitelisting
      • Notification Settings
      • Data Retention
      • Pausing Resolution Time
      • Account Management
    • Plans & Billing
    • Developer Settings
  • Pricing and Billing
    • Pricing
    • Billing
      • External Helpdesk
      • Internal Helpdesk
      • Integrations
  • Changelog
    • ClearFeed Release Changelog
Powered by GitBook
On this page
  • 📋 Prerequisites
  • 🚀 Overview
  • 🛠️ Step-by-Step Instructions
  • 1. Open the Script Editor
  • 2. Add the Script
  • 3. Replace the Token
  • 4. Run the Script
  • ✅ Result
  • 🧠 Notes
  • ⏰ Optional: Automate with a Trigger
  • 🔐 API Token Security Reminder
  • 💬 Support

Was this helpful?

Edit on GitHub
  1. Helpdesk Features

Importing Insights Data into Google Sheets

PreviousNotificationsNextGPT-Powered Answers

Last updated 1 day ago

Was this helpful?

This guide shows how to import insights data from the ClearFeed API into Google Sheets using Google Apps Script.


📋 Prerequisites

  • A ClearFeed API token (see )

  • A Google Sheet to import the data into


🚀 Overview

You will:

  1. Open a Google Sheet and add a bound script

  2. Use Apps Script to call the ClearFeed API

  3. Populate the sheet with data from the API


🛠️ Step-by-Step Instructions

1. Open the Script Editor

In your Google Sheet:

  • Go to Extensions > Apps Script


2. Add the Script

function fetchClearfeedInsights() {
  const token = 'your-api-token-here';  // Replace with your actual token
  const url = 'https://api.clearfeed.app/v1/rest/insights/query';

  const payload = {
    query: {
      measures: [
        "Requests.count",
        "Requests.first_response_time_avg"
      ],
      time_dimensions: [
        {
          dimension: "Requests.created_at",
          date_range: "Last week",
          granularity: "day"
        }
      ],
      dimensions: [
        "Requests.priority"
      ],
      filters: [
        {
          member: "Requests.state",
          operator: "equals",
          values: ["in_progress"]
        }
      ]
    }
  };

  const options = {
    method: "post",
    contentType: "application/json",
    headers: {
      Authorization: "Bearer " + token
    },
    payload: JSON.stringify(payload)
  };

  const response = UrlFetchApp.fetch(url, options);
  const result = JSON.parse(response.getContentText());

  const data = result.insights || [];

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  sheet.clear(); // Clear previous content

  if (data.length === 0) {
    sheet.getRange(1, 1).setValue("No data found");
    return;
  }

  // Extract headers
  const headers = Object.keys(data[0]);
  sheet.getRange(1, 1, 1, headers.length).setValues([headers]);

  // Write data rows
  const rows = data.map(rowObj => headers.map(h => rowObj[h]));
  sheet.getRange(2, 1, rows.length, headers.length).setValues(rows);
}

3. Replace the Token

Replace the line:

const token = 'your-api-token-here';

With your actual ClearFeed API token.


4. Run the Script

  • Save the script.

  • Click the ▶️ Run button

  • Authorize the script when prompted


✅ Result

After running, your sheet will be populated with insights data like:

Requests.priority
Requests.created_at.day
Requests.count
Requests.first_response_time_avg

normal

2025-05-13T00:00:00.000

1

87.0000000000000000

high

2025-05-18T00:00:00.000

1

240.0000000000000000


🧠 Notes

  • The script clears the sheet each time before writing new data

  • If no data is returned, the message "No data found" is placed in cell A1

  • The script writes all keys from the API response as column headers


⏰ Optional: Automate with a Trigger

To run this automatically (e.g. daily):

  1. Open the script editor

  2. Click the clock icon ("Triggers")

  3. Add a trigger for fetchClearfeedInsights

  4. Choose "Time-driven" and select your schedule


🔐 API Token Security Reminder

For convenience, this example uses a hardcoded API token. In production or multi-user environments, consider using secure methods such as PropertiesService or Google Secrets Manager.


💬 Support

Replace the default code with the following. The script below populates a simple report based on the example in the Documentation. It can be tailored to your requirements subsequently:

For help with API queries or customizations, reach out to ClearFeed Support ().

Personal Access Token
Insights API Documentation
support@clearfeed.ai