Skip to content
Back to skills

Glean Core Workflow B

ASecurity

'Execute Glean secondary workflow: bulk document indexing, custom datasource connectors, and content lifecycle management via the Indexing API. Trigger: \"glean bulk index\", \"glean custom connector\", \"glean datasource\", \"glean indexing\". '

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 12, 2026
ai-agentstypescriptgobashgitapibackenddocumentation

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add thedixitjain/the-mega-skill-library --skill glean-core-workflow-b --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Glean Core Workflow B?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Glean Core Workflow B
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thedixitjain-glean-core-workflow-b/badge)](https://www.skillsdirectory.com/skills/thedixitjain-glean-core-workflow-b)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: glean-core-workflow-b
description: "'Execute Glean secondary workflow: bulk document indexing, custom datasource connectors, and content lifecycle management via the Indexing API. Trigger: \"glean bulk index\", \"glean custom connector\", \"glean datasource\", \"glean indexing\". '"
allowed-tools: "Read, Write, Edit, Bash(npm:*), Bash(curl:*), Grep"
category: backend-and-data
source_repo: jeremylongshore/claude-code-plugins-plus-skills
source_path: "plugins/saas-packs/glean-pack/skills/glean-core-workflow-b/SKILL.md"
source_url: https://github.com/jeremylongshore/claude-code-plugins-plus-skills/blob/HEAD/plugins/saas-packs/glean-pack/skills/glean-core-workflow-b/SKILL.md
---

# Glean Core Workflow B: Indexing & Connectors

## Overview

Build custom Glean connectors: set up datasources, bulk index documents, manage content lifecycle, and configure permissions.

## Instructions

### Step 1: Create Custom Datasource

```typescript
await fetch(`${GLEAN}/index/v1/adddatasource`, {
  method: 'POST', headers: idxHeaders,
  body: JSON.stringify({
    name: 'internal_docs',
    displayName: 'Internal Documentation',
    datasourceCategory: 'PUBLISHED_CONTENT',
    urlRegex: 'https://docs.internal.company.com/.*',
    isOnPrem: false,
  }),
});
```

### Step 2: Bulk Index Documents

```typescript
// Bulk indexing replaces ALL documents in the datasource
const uploadId = `upload-${Date.now()}`;

// Send documents in batches of 100
for (let i = 0; i < allDocs.length; i += 100) {
  const batch = allDocs.slice(i, i + 100);
  const isFirst = i === 0;
  const isLast = i + 100 >= allDocs.length;

  await fetch(`${GLEAN}/index/v1/bulkindexdocuments`, {
    method: 'POST', headers: idxHeaders,
    body: JSON.stringify({
      datasource: 'internal_docs',
      uploadId,
      isFirstPage: isFirst,
      isLastPage: isLast,
      documents: batch.map(doc => ({
        id: doc.id,
        title: doc.title,
        url: doc.url,
        body: { mimeType: 'text/html', textContent: doc.content },
        author: { email: doc.authorEmail },
        updatedAt: doc.updatedAt,
        permissions: { allowAnonymousAccess: true },
      })),
    }),
  });
  console.log(`Indexed batch ${i/100 + 1} (${batch.length} docs)`);
}
```

### Step 3: Set Document Permissions

```typescript
// Control who can see documents in search results
await fetch(`${GLEAN}/index/v1/indexdocuments`, {
  method: 'POST', headers: idxHeaders,
  body: JSON.stringify({
    datasource: 'internal_docs',
    documents: [{
      id: 'confidential-001',
      title: 'Board Meeting Notes',
      url: 'https://docs.internal.company.com/board/q1-2025',
      body: { mimeType: 'text/plain', textContent: '...' },
      permissions: {
        allowedUsers: [{ email: 'ceo@company.com' }, { email: 'cfo@company.com' }],
      },
    }],
  }),
});
```

### Step 4: Delete Documents

```typescript
// Remove specific documents from the index
await fetch(`${GLEAN}/index/v1/deletedocument`, {
  method: 'POST', headers: idxHeaders,
  body: JSON.stringify({
    datasource: 'internal_docs',
    objectType: 'Document',
    id: 'doc-to-delete',
  }),
});
```

## Error Handling

| Error | Cause | Solution |
|-------|-------|----------|
| `uploadId already used` | Reusing bulk upload ID | Generate unique uploadId per run |
| `document too large` | Content exceeds limit | Truncate body to ~100KB |
| `invalid permissions` | Malformed user/group | Use valid email addresses |

## Resources

- [Bulk Indexing](https://developers.glean.com/api-info/indexing/documents/bulk-indexing)
- [Document Permissions](https://developers.glean.com/api-info/indexing/documents/permissions)
- [Custom Datasources](https://docs.glean.com/connectors/custom/about)

## Next Steps

For common errors, see `glean-common-errors`.

---

**Source:** [`jeremylongshore/claude-code-plugins-plus-skills`](https://github.com/jeremylongshore/claude-code-plugins-plus-skills) → `plugins/saas-packs/glean-pack/skills/glean-core-workflow-b/SKILL.md`

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.