Guru Manual Sync

Overview

The Guru Sync platform connects Guru to external content sources. The feature enables Guru to extract content from an external source and populate that content into a read-only Collection within Guru. This way, Guru users can search both internal and external-facing content from one place.

This further improves team productivity by being able to search for important content without leaving Guru or changing your workflow. All content that is synced into Guru from an external source, i.e. Zendesk Guide, Salesforce Knowledge, custom, will be marked as read only and cannot be modified.

The rest of this document will detail how the Manual Sync API allows a large amount of content to be imported into Guru in an efficient and organized manner. The API involves uploading a zip file of structured content to a specified endpoint. All content is “synced” into a single collection. The full structure of the zip file represents all the content in a single Collection. Every card, board, board group, resource, etc. in this directory structure will be added to the same collection. Every file in the directory structure is considered to be referenceable within the Collection (more on this later when discussing Card content).

Directory Structure

mycollection.zip:

/
    cards/
        card1.yaml
        card1.md
        card2.yaml
        card2.html
    folders/
        folder1.yaml
        folder2.yaml
    resources/
        Image1.png
        mycoolsalesdeck.pdf
    collection.yaml

Root Directory

The root directory contains all of the content for the Collection.

A collection.yaml file in the root directory is used to define the items that belong at the top level of the Collection - these can be Cards or Folders. We also use it to define tags that are used on Cards throughout the Collection. It's also used to specify the version of the import framework to use. It's important to include Version: 2 in the collection.yaml file. Here is a sample of what the file should look like:

Version: 2
Items:
- ID: "ff62ad51-41d5-48a5-82c6-74c55c183406"
  Type: "card"
- ID: "2bf8cf82-d6f7-4a67-a13e-aa584b4289ab"
  Type: "folder"
- ID: "e6494f50-23d3-41b7-8061-d4e044283554"
  Type: "folder"
- ID: "cd9e3c25-417a-4f1e-a5e4-6d1186749def"
  Type: "folder"
Tags:
    - "Tag1"
    - "Category:Tag2"

Cards

Individual cards are saved in the cards directory with a unique file name. For each card, there is a metadata file and a content file which should have the same file name part with different file extensions. The metadata file is stored in .yaml format and contains the card’s title and any tags that should be on the card. The content file can either be markdown (using the .md file extension) or html (.html file extension). For the tags in the metadata file, both categorized and uncategorized tags are supported as described in the collection.yaml section above. It is important that any and all tags in the individual card files be listed in the collection.yaml file.

A sample card metadata and content is below:

card1.yaml:

Title: "Card Title"
Tags: 
    - "Category:Tag1"
    - "Tag2"
    - "Tag3"
ExternalId: "af133745-aef5-4184-8349-0825e02ffee2"
ExternalUrl: "https://mycoolsite.com/123"

card1.md:

# Markdown header

And whatever content you want
This is read
In
Raw
So all
Newlines
Are preserved
> ok
       Got it?

Folders

Folders can be represented with structured YAML listing cards and other folders that are contained in it. The order of the cards matters. Cards are referenced by their unique file identifier without the extension and Sections can be created at the top level that include a list of cards. The folder's Title is required and the Description is optional.

---
Title: "Folder 1"
Description: |
  Multi line
  Description
  here
Items:
- ID: "c76ed336-988d-4047-8f55-e0ebb51daa88"
  Type: "card"
- ID: "39da5092-2014-45ce-8368-91d357f89433"
  Type: "card"
- ID: "fdea89ed-eed0-4d5c-a983-82b5534a0383"
  Type: "card"
- ID: "e586a9ed-8f26-4b00-b3a9-552492a112a1"
  Type: "folder"
- ID: "af133745-aef5-4184-8349-0825e02ffee2"
  Type: "folder"
- ID: "6eff97c3-2c62-49ae-b00c-fd8bfb0afc13"
  Type: "folder"
ExternalId: "56020ddc-34e7-4fff-b22d-27e444678076"
ExternalUrl: https://mycoolsite.com/456

Resources

Images and resources can be saved to the resource/ directory and they will be uploaded to Guru. Images and resources can be linked within card content as described below.

Referencing Other Cards, Folders, and Resources

Folders, Resources and other Cards can be referenced in card markdown/html content by utilizing the regular link syntax, but using the appropriate directory name and card/folder/resource ID as the actual link. This allows the bulk importer to replace the unique cards/folders/resources in the content with the actual IDs during the import process.

To link to card1, reference cards/card1. To link to folder1, reference folders/folder1. To link to resources, use the resources/ folder and the full name of the resource (ie, image1.png, mycoolsalesdeck.pdf).

# Markdown

This is a [card link](cards/card1) and this is a [folder link](folders/folder1)

This is an image:

![Alt Text](resources/image1.png)

This is a PDF link
[PDF link](resources/mycoolsalesdeck.pdf)

API Implementation

In order to ensure that the Collection is set up for synced content, you first need to set up a target collection for your synced content whose collectionType is EXTERNAL. You can only set this value when creating the collection and you must use our API to do this.

This is done as a POST call to https://api.getguru.com/api/v1/collections with this payload:

{
  "name": "My Synced Collection",
  "collectionType": "EXTERNAL",
  "description": "",
  "color": "#F44336",
  "publicCardsEnabled": false,
  "syncVerificationEnabled": false,
  "initialAdminGroupId": "21c9dad5-71ae-41ad-84d6-334054894e44"
}

Once the collection and the directory structure is created with all of the content, the sync can be executed by simply zipping up the directory and POSTing the content to the manual sync endpoint https://api.getguru.com/app/contentsyncupload with the right credentials.

Sync File Upload Call

curl -u EMAIL:TOKEN https://api.getguru.com/app/contentsyncupload?collectionId=COLLECTION_ID -F "[email protected]" -D -

When POSTed, a job id will be created which can then be used to query the status of the import.

Status Check Call
Sample Request

curl -u EMAIL:TOKEN https://api.getguru.com/api/v1/import/{jobId}/status

Sample Response

{
  "status" : "IMPORTCOMPLETE"
}

status - Indicates the current state of the sync job.

"status" : "IMPORTCOMPLETE" - The sync has completed successfully
"status" : "REJECTED" - The content of the sync was invalid
"status" : "IMPORTHOME" - Indicates that the sync is transitioning on its way to completion. This status should leave that state and become "IMPORTCOMPLETE" fairly quickly. If you still see that the status of your sync is on "IMPORTHOME" for longer than an hour, that usually indicates that they collection.yaml file is either missing or improperly formatted.

If you need more help troubleshooting your collection.yaml formatting or your "REJECTED" status, please contact [email protected].

The sync process should go through all of the content, create the necessary resources, cards, folders, etc. and make sure that everything is referenced properly (card links, image links, etc.)

Details about how the Sync Works

A Sync will replicate the structure as well as the content of the external source, creating folders and cards that mirror the hierarchy in the source system being synced.

  • The Sync process will automatically remove any content that is no longer in the external content source. This applies to Cards and Folders. If a Card/Folder is synced into Guru and is absent from the zip file in a subsequent sync, it will be removed from Guru.
  • Tags that are synced into Guru are not removed if they are not in subsequent syncs.
  • If you need to deleted a synced Collection, please reach out to [email protected] and we will delete the Collection for you.