Bahasa Indonesia
Get an API key

Guides

Google Sheets

Fill a spreadsheet with content data without running a server.

Store the key

Open the spreadsheet, choose Extensions, then Apps Script. In Project Settings, add a Script property named WEFLUENCE_API_KEY. Never put the key in a cell, because anyone who opens the file can read it.

Paste the script

Replace abc123 with your campaign ID.

Apps Script
function pullContent() {
  var key = PropertiesService.getScriptProperties().getProperty('WEFLUENCE_API_KEY');
  var id = 'abc123';
  var sheet = SpreadsheetApp.getActiveSheet();
  sheet.clearContents();
  sheet.appendRow(['Creator', 'Platform', 'Link', 'Status', 'Views']);
  var cursor = '';
  do {
    var url = 'https://api.wefluence.app/v1/campaigns/' + id + '/content?limit=100' +
      (cursor ? '&cursor=' + encodeURIComponent(cursor) : '');
    var res = UrlFetchApp.fetch(url, { headers: { Authorization: 'Bearer ' + key } });
    var page = JSON.parse(res.getContentText());
    page.data.forEach(function (c) {
      sheet.appendRow([c.creator.name, c.platform, c.url, c.status, c.views.verified]);
    });
    cursor = page.has_more ? page.next_cursor : '';
  } while (cursor);
}

Run it automatically

In Apps Script, open Triggers and create a daily trigger for the pullContent function.