From 86112372cd213336764a4cae34ab303de0b6cf91 Mon Sep 17 00:00:00 2001 From: Veronika Zhukova Date: Mon, 29 Sep 2025 17:38:29 +0300 Subject: [PATCH 1/3] [COP-669] Contentful integration into Assist service --- _data/navigation.yml | 2 + contentful/contentful.md | 82 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 contentful/contentful.md diff --git a/_data/navigation.yml b/_data/navigation.yml index 956aeee..0028dba 100644 --- a/_data/navigation.yml +++ b/_data/navigation.yml @@ -224,6 +224,8 @@ url: /tutorial-observations - title: Project Stages url: /tutorial-project-stages + - title: Contentful integration into Assist + url: /contenful-integration-in-assist - title: Example Apps & SDKs items: diff --git a/contentful/contentful.md b/contentful/contentful.md new file mode 100644 index 0000000..0877b9d --- /dev/null +++ b/contentful/contentful.md @@ -0,0 +1,82 @@ +--- +permalink: /contenful-integration-in-assist +title: Contentful integration into Assist +layout: default +section_title: Contentful API Integration +--- + +## Overview + +This document describes the Contentful Content Delivery API (CDA) integration, which provides access to content stored in Contentful. + +The overall documentation for Contentful can be found [here](https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction). + +## General Contentful API Client + +The client is configured via environment variables (the values can be found [here](https://github.com/procore/copilot/blob/main/services/copilot/env.sample)): + +```bash +CONTENTFUL_SPACE_ID=your_space_id +CONTENTFUL_ACCESS_TOKEN=your_access_token +CONTENTFUL_HOST=https://cdn.contentful.com +CONTENTFUL_ENVIRONMENT=master # defaults to "master" +``` + +The default [content_type](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters) for the Assist is `copilotSampleQuestions`. + +The locale name styling can be found [here](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/locales). + +## API Endpoints + +### Get Copilot Sample Questions + +```http +GET /rest/v1.0/copilot/conversations/sample-questions +``` + +Fetches random `limit` sample questions for the copilot interface. + +**Parameters:** + +- `locale` (string): Content locale (default: "en-US") +- `limit` (integer): Maximum number of entries to return (default: 3) + +**Response:** + +```json +{ + "items": [ + "How do I create a project?", + "What is an RFI?" + ] +} +``` + +**Note:** The current implementation only provides the sample questions endpoint. + +### Copilot Usage Examples + +#### HTTP Requests + +```bash +curl -H "Authorization: Bearer YOUR_TOKEN" \ + "http://localhost:5067/rest/v1.0/copilot/conversations/sample-questions?company_id=123&project_id=456" + +# Get sample questions with specific locale and limit +curl -H "Authorization: Bearer YOUR_TOKEN" \ + "http://localhost:5067/rest/v1.0/copilot/conversations/sample-questions?company_id=123&project_id=456&locale=en-US&limit=5" +``` + +#### Python Service Usage + +```python +from copilot.utils.sample_questions_service import SampleQuestionsService + + +service = SampleQuestionsService() + +questions = await service.get_copilot_sample_questions( + locale="en-US", + limit=5 +) +``` From ef38a2f3d41bc40fa29257bb0d5fe0ccd62cf193 Mon Sep 17 00:00:00 2001 From: Nika Date: Mon, 29 Sep 2025 17:45:29 +0300 Subject: [PATCH 2/3] Update contentful/contentful.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- contentful/contentful.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contentful/contentful.md b/contentful/contentful.md index 0877b9d..3d6e4ca 100644 --- a/contentful/contentful.md +++ b/contentful/contentful.md @@ -1,5 +1,5 @@ --- -permalink: /contenful-integration-in-assist +permalink: /contentful-integration-in-assist title: Contentful integration into Assist layout: default section_title: Contentful API Integration From d9cb7f3f77fc4e951bf61c06d52c0ace4e9c87c7 Mon Sep 17 00:00:00 2001 From: Nika Date: Mon, 29 Sep 2025 17:45:44 +0300 Subject: [PATCH 3/3] Update _data/navigation.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- _data/navigation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_data/navigation.yml b/_data/navigation.yml index 0028dba..e01cfc9 100644 --- a/_data/navigation.yml +++ b/_data/navigation.yml @@ -225,7 +225,7 @@ - title: Project Stages url: /tutorial-project-stages - title: Contentful integration into Assist - url: /contenful-integration-in-assist + url: /contentful-integration-in-assist - title: Example Apps & SDKs items: