Skip to content

Include customer conversations in the Gladly SUMMARIZE summary - #11

Open
eastagile-tracker wants to merge 1 commit into
osano:mainfrom
eastagile-tracker:agile-board/gladly-summarize-conversations
Open

eastagile-tracker wants to merge 1 commit into
osano:mainfrom
eastagile-tracker:agile-board/gladly-summarize-conversations

Conversation

@eastagile-tracker

Copy link
Copy Markdown

This PR proposes including customer conversations in the Gladly SUMMARIZE summary, as the sample's README describes. We include this PR work along with a full history of your repo at https://eastagiletracker.com/projects/1451. You can sign in with your GitHub ID to claim ownership of the project.

What changed and why

The Gladly sample's README says SUMMARIZE "retrieves customer profiles and conversations from Gladly and attaches a summary to the Osano action item", but summarizeData() in services/integration.js only calls getCustomerProfiles(). The conversations endpoint is never requested, so the summary attached to a subject-access request contains the profile records alone and silently leaves out the requester's support conversations. Since this sample is the reference that customers copy into their own Lambda, that gap carries straight into their access responses.

The fix fetches each profile's conversations with the existing getConversations() client (the same call the DELETE path already uses) and nests them under the profile, so the summary is still an array of profiles, each now carrying a conversations array. Because getConversations() already throws on Gladly-Limited-Data: true, a customer with more conversations than Gladly returns fails the request for manual processing instead of getting a partial summary, which matches how DELETE behaves.

Reproduction on current main (abf5dd7): calling index.handler with a SUMMARIZE payload and fetch stubbed to return one profile with one conversation produces these outbound requests and summary:

summary attached: [{"id":"cust-1","emails":[{"original":"jane@example.com"}]}]
handler: {"statusCode":200}
GET https://acme.gladly.com/api/v1/customer-profiles?email=jane%40example.com
POST https://api.osano.com/v1/subject-rights/action-items/42/summaries
PATCH https://api.osano.com/v1/subject-rights/action-items/42

With this change the same run adds GET .../v1/customers/cust-1/conversations and attaches [{"id":"cust-1",...,"conversations":[{"id":"conv-1","status":"CLOSED"}]}].

Verification: npx jest in sample-gladly-webhook-integration was 25/25 passing before the change and is 26/26 after, with no new failures. The updated summarize test asserts conversations are fetched for every profile and included in the attached summary, and a new test checks that when conversations cannot be retrieved nothing is attached and the action item is not marked completed. Both fail against main and pass with the fix. The existing no-profiles test is unchanged and still passes.

How this was managed

This work was tracked as https://eastagiletracker.com/projects/1451/stories/1555051 on https://eastagiletracker.com/projects/1451, a board imported from this repo's pull requests (10 stories) and used to manage this change.

board

If you'd rather not receive contributions like this, reply no-more-prs on this pull request and we won't open any further ones on your repositories.


Lawrence W. Sinclair
CEO / East Agile
linkedin.com/in/lwsinclair/
eastagile.com

summarizeData only fetched customer profiles, so the summary attached to the Osano action item never contained the requester's conversations even though the README describes SUMMARIZE as retrieving profiles and conversations. Fetch each profile's conversations and nest them under the profile in the summary.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yml
  • Review profile: QUIET
  • Plan: Advanced
  • Run ID: ed48e67e-9357-43e3-a1e8-c43361f92b68

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant