---
availability: INSTALLABLE
installation_asset_uuid: 90f4899c-2a8d-4f3e-bb8f-369329bd45fe
description: A plugin that allows sales representatives and managers to instantly
  access a clear, summarized view of an opportunity's history, progress, and key milestones
  through the Moveworks AI Assistant. By surfacing details like stage transitions,
  recent activities, and ownership updates in seconds, saving time, improving deal
  visibility, and helping teams focus on strategic next steps.
name: Summarize Opportunity History
difficulty_level: INTERMEDIATE
time_in_minutes: 20
purple_chat_link: https://marketplace.moveworks.com/purple-chat?conversation=%7B%22messages%22%3A%5B%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22summarize+opportunity+history+in+salesforce%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Authenticating+your+access+to+Salesforce+and+verifying+permissions...%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Permissions+verified.+You+have+read+access+to+Opportunity+objects.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3ETo+summarize+a+Salesforce+opportunity%27s+history%2C+please+specify+which+one+you%27re+interested+in.+You+can+provide+the%3A%3C%2Fp%3E%3Col%3E%3Cli%3E%3Cp%3E%3Cstrong%3EOpportunity+Name%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EOwner%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAccount+Name%3C%2Fstrong%3E.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3ELifecycle+Stage%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3C%2Fol%3E%3Cp%3E%3C%2Fp%3E%3Cp%3EAlso%2C+please+provide+a+specific+%3Cstrong%3Edate+range%3C%2Fstrong%3E+for+analysis+%28e.g.%2C+%5C%22last+quarter%5C%22%2C+%5C%22this+year%5C%22%29.%3C%2Fp%3E%22%7D%5D%7D%2C%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22for+ACME%27s+opportunities%2C+last+quarter%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22%3Cp%3ESearching+Salesforce+for+opportunities+related+to+%27ACME%27...%3C%2Fp%3E%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Found+multiple+opportunities+matching+your+criteria.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3EI+found+a+few+opportunities+for+ACME.+Could+you+please+select+the+exact+deal+you%27d+like+me+to+summarize%3F%3C%2Fp%3E%3Col%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Corp+-+Software+Expansion%3C%2Fstrong%3E+%28Stage%3A+Negotiation%2FReview%2C+Amount%3A+%24120%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Inc.+-+Hardware+Upgrade%3C%2Fstrong%3E+%28Stage%3A+Prospecting%2C+Amount%3A+%2450%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Solutions+-+Consulting+Project%3C%2Fstrong%3E+%28Stage%3A+Closed+Won%2C+Amount%3A+%2475%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3C%2Fol%3E%3Cp%3Ewhich+opportunity+do+you+want+to+summarize%3F%3C%2Fp%3E%22%7D%5D%7D%2C%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22The+%27Acme+Corp+-+Software+Expansion%27+deal.%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22%3Cp%3ERetrieving+details%2C+history%2C+and+recent+activities+for+%27Acme+Corp+-+Software+Expansion%27+in+the+last+quarter...%3C%2Fp%3E%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Generating+a+concise+business+summary+based+on+the+retrieved+data.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3EThe+%3Cstrong%3EAcme+Corp+%E2%80%93+Software+Expansion%3C%2Fstrong%3E+opportunity+is+currently+in+the+%3Cstrong%3ENegotiation%2FReview%3C%2Fstrong%3E+stage+with+an+estimated+close+date+of+%3Cstrong%3EMarch+20%2C+2026%3C%2Fstrong%3E.+The+deal+value+is+%3Cstrong%3E%24120%2C000%3C%2Fstrong%3E.%3C%2Fp%3E%3Cp%3E%3Cstrong%3EStage+Progression+%28Last+Quarter%29%3A%3C%2Fstrong%3E%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EMoved+from+%3Cstrong%3EProspecting%3C%2Fstrong%3E+to+%3Cstrong%3EQualification%3C%2Fstrong%3E+on+January+5%2C+2026.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3EMoved+from+%3Cstrong%3EQualification%3C%2Fstrong%3E+to+%3Cstrong%3ENegotiation%2FReview%3C%2Fstrong%3E+on+February+10%2C+2026.%3C%2Fp%3E%3C%2Fli%3E%3C%2Ful%3E%3Cp%3E%3Cstrong%3EKey+Insights+%26amp%3B+Actionable+Next+Steps%3A%3C%2Fstrong%3E%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EThe+customer+has+confirmed+they+are+%3Cstrong%3Enot+actively+considering+other+competitors%3C%2Fstrong%3E+at+this+moment%2C+indicating+a+strong+preference+for+our+solution.+This+creates+a+significant+opportunity+to+push+for+a+close.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3ERecent+activity+includes+a+pricing+call+and+a+contract+review+meeting.+The+last+update+by+Jane+Doe+on+March+4+noted+pending+legal+revisions.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3ESuggested+Actions%3A%3C%2Fstrong%3E+%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EFollow+up+directly+with+the+customer%27s+legal+team+to+expedite+contract+review+and+address+any+remaining+concerns.+Leverage+the+lack+of+competitive+pressure+to+emphasize+value+and+accelerate+the+closing+process.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3EPrepare+a+final+proposal+with+clear+next+steps+and+a+defined+timeline+for+signature.%3C%2Fp%3E%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3C%2Ful%3E%22%7D%2C%7B%22citations%22%3A%5B%7B%22connectorName%22%3A%22salesforce%22%2C%22citationTitle%22%3A%22Acme+Corp+-+Software+Expansion%22%7D%5D%7D%5D%7D%5D%7D
solution_tags:
- Productivity
- Sales
systems:
- salesforce
---
## Introduction

The **Summarize Opportunity History** plugin gives sales users instant **insights** into an opportunity’s key milestones, stage changes, and recent activity — all within the Moveworks AI Assistant. It helps users quickly understand deal progress, improve visibility, and focus on the next best actions without manually opening Salesforce.

This guide walks you through how to configure and customize the plugin within Agent Studio so you can deliver these insights in just a few minutes. Let’s get started!

## **Prerequisites**

- Access to Agent Studio

## What are we building?

### Agent Design

This [purple chat](https://marketplace.moveworks.com/purple-chat?conversation=%7B%22messages%22%3A%5B%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22summarize+opportunity+history+in+salesforce%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Authenticating+your+access+to+Salesforce+and+verifying+permissions...%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Permissions+verified.+You+have+read+access+to+Opportunity+objects.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3ETo+summarize+a+Salesforce+opportunity%27s+history%2C+please+specify+which+one+you%27re+interested+in.+You+can+provide+the%3A%3C%2Fp%3E%3Col%3E%3Cli%3E%3Cp%3E%3Cstrong%3EOpportunity+Name%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EOwner%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAccount+Name%3C%2Fstrong%3E.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3ELifecycle+Stage%3C%2Fstrong%3E%3C%2Fp%3E%3C%2Fli%3E%3C%2Fol%3E%3Cp%3E%3C%2Fp%3E%3Cp%3EAlso%2C+please+provide+a+specific+%3Cstrong%3Edate+range%3C%2Fstrong%3E+for+analysis+%28e.g.%2C+%5C%22last+quarter%5C%22%2C+%5C%22this+year%5C%22%29.%3C%2Fp%3E%22%7D%5D%7D%2C%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22for+ACME%27s+opportunities%2C+last+quarter%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Searching+Salesforce+for+opportunities+related+to+%27ACME%27+from+last+quarter...%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Found+multiple+opportunities+matching+your+criteria.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3EI+found+a+few+opportunities+for+ACME+from+last+quarter.+Could+you+please+select+the+exact+deal+you%27d+like+me+to+summarize%3F%3C%2Fp%3E%3Col%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Corp+-+Software+Expansion%3C%2Fstrong%3E+%28Stage%3A+Negotiation%2FReview%2C+Amount%3A+%24120%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Inc.+-+Hardware+Upgrade%3C%2Fstrong%3E+%28Stage%3A+Prospecting%2C+Amount%3A+%2450%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3EAcme+Solutions+-+Consulting+Project%3C%2Fstrong%3E+%28Stage%3A+Closed+Won%2C+Amount%3A+%2475%2C000%29%3C%2Fp%3E%3C%2Fli%3E%3C%2Fol%3E%3Cp%3Ewhich+opportunity+do+you+want+to+summarize%3F%3C%2Fp%3E%22%7D%5D%7D%2C%7B%22role%22%3A%22user%22%2C%22parts%22%3A%5B%7B%22richText%22%3A%22The+%27Acme+Corp+-+Software+Expansion%27+deal.%22%7D%5D%7D%2C%7B%22role%22%3A%22assistant%22%2C%22parts%22%3A%5B%7B%22reasoningSteps%22%3A%5B%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Retrieving+details%2C+history%2C+and+recent+activities+for+%27Acme+Corp+-+Software+Expansion%27...%22%7D%2C%7B%22status%22%3A%22success%22%2C%22richText%22%3A%22Generating+a+concise+business+summary+based+on+the+retrieved+data.%22%7D%5D%7D%2C%7B%22richText%22%3A%22%3Cp%3EThe+%3Cstrong%3EAcme+Corp+%E2%80%93+Software+Expansion%3C%2Fstrong%3E+opportunity+is+currently+in+the+%3Cstrong%3ENegotiation%2FReview%3C%2Fstrong%3E+stage+with+an+estimated+close+date+of+%3Cstrong%3EMarch+20%2C+2026%3C%2Fstrong%3E.+The+deal+value+is+%3Cstrong%3E%24120%2C000%3C%2Fstrong%3E.%3C%2Fp%3E%3Cp%3E%3Cstrong%3EStage+Progression+%28Last+Quarter%29%3A%3C%2Fstrong%3E%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EMoved+from+%3Cstrong%3EProspecting%3C%2Fstrong%3E+to+%3Cstrong%3EQualification%3C%2Fstrong%3E+on+January+5%2C+2026.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3EMoved+from+%3Cstrong%3EQualification%3C%2Fstrong%3E+to+%3Cstrong%3ENegotiation%2FReview%3C%2Fstrong%3E+on+February+10%2C+2026.%3C%2Fp%3E%3C%2Fli%3E%3C%2Ful%3E%3Cp%3E%3Cstrong%3EKey+Insights+%26amp%3B+Actionable+Next+Steps%3A%3C%2Fstrong%3E%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EThe+customer+has+confirmed+they+are+%3Cstrong%3Enot+actively+considering+other+competitors%3C%2Fstrong%3E+at+this+moment%2C+indicating+a+strong+preference+for+our+solution.+This+creates+a+significant+opportunity+to+push+for+a+close.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3ERecent+activity+includes+a+pricing+call+and+a+contract+review+meeting.+The+last+update+by+Jane+Doe+on+March+4+noted+pending+legal+revisions.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3E%3Cstrong%3ESuggested+Actions%3A%3C%2Fstrong%3E+%3C%2Fp%3E%3Cul%3E%3Cli%3E%3Cp%3EFollow+up+directly+with+the+customer%27s+legal+team+to+expedite+contract+review+and+address+any+remaining+concerns.+Leverage+the+lack+of+competitive+pressure+to+emphasize+value+and+accelerate+the+closing+process.%3C%2Fp%3E%3C%2Fli%3E%3Cli%3E%3Cp%3EPrepare+a+final+proposal+with+clear+next+steps+and+a+defined+timeline+for+signature.%3C%2Fp%3E%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3C%2Ful%3E%22%7D%2C%7B%22citations%22%3A%5B%7B%22connectorName%22%3A%22salesforce%22%2C%22citationTitle%22%3A%22Acme+Corp+-+Software+Expansion%22%7D%5D%7D%5D%7D%5D%7D) shows the experience we are going to build with this plugin.

## **Installation Steps**

We recommend setting up the Salesforce connector before installing this plugin. Please follow the [**Salesforce Connector**](https://marketplace.moveworks.com/connectors/salesforce#how-to-implement) guide to configure the connection.

**User Consent Authentication Benefits:**

With OAuth 2.0 User Consent Authentication enabled, users can securely access their own Salesforce data—such as opportunities, tasks, activities and related records—through Moveworks without sharing credentials. By authenticating once through Salesforce’s login page, users allow the bot to securely retrieve opportunity details on their behalf.

This ensures data privacy, role-based access control, and a seamless self-service experience where users only see the data they are authorized to view.

**Required Salesforce Permissions:**

To enable access to the Salesforce API endpoints used in this plugin, ensure your Salesforce connected app has the correct OAuth scope configured under:

- **Setup → App Manager → Connected Apps → [Your Connected App]**

**Required OAuth Scope:**

- **Access and manage your data (api)**

This scope is essential for retrieving Opportunities, Opportunity History, Tasks, Events, Notes, and related records via Salesforce REST APIs.

**Required Object Permissions:**

Ensure the integration user (via profile or permission sets) has **read access** to:

- **Opportunity**
- **Opportunity History**
- **Account**
- **Opportunity Contact Roles**
- **Tasks**
- **Events**
- **Products**

These permissions are required to retrieve opportunity details and generate accurate Next Best Action recommendations.

**Your Instance Configuration:**

All Salesforce API endpoints in this plugin use `{{YOUR_INSTANCE_DOMAIN}}` as a placeholder.

Follow the steps below to update it correctly after installation:

1. Go to your **Salesforce Setup**.
2. In the **Quick Find** box, search for **My Domain** and select it.
3. Locate your **Salesforce org’s My Domain URL** (e.g., `yourcompany.my.salesforce.com`).
4. Replace `{{YOUR_INSTANCE_DOMAIN}}` with your actual My Domain URL in all **action definitions** within the connector.
5. Ensure all API requests use **HTTPS** and leverage **OAuth 2.0 authentication**.
6. Save your configuration to ensure that all API requests are routed correctly and securely to your Salesforce instance.

After configuring the connector, refer to our [**plugin installation documentation**](https://help.moveworks.com/docs/ai-agent-marketplace-installation) for details on installing the plugin in Agent Studio.

### **API #1: Search Opportunities by Criteria**

```bash
curl --location 'https://{{YOUR_INSTANCE_DOMAIN}}/services/data/vXX.0/query/?q=SELECT%20Id%2C%20Name%2C%20StageName%2C%20Amount%2C%20AccountId%2C%20CloseDate%2C%20CreatedDate%2C%20LastActivityDate%2C%20Owner.Name%2C%20Owner.Email%2C%20Account.Name%2C%20Type%2C%20LeadSource%2C%20Probability%2C%20ForecastCategory%20FROM%20Opportunity%20WHERE%20IsClosed%20%3D%20FALSE%20AND%20{{filter_query}}%20ORDER%20BY%20CreatedDate%20DESC%20LIMIT%20200' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{ACCESS_TOKEN}}'
```

**Query Parameters**

- **`filter_query`** — A dynamic **SOQL WHERE filter**, built based on the user’s search input
- **`opportunity_name`** — Filters opportunities by partial/full name
- **`account_name`** — Filters opportunities by the account name
- **`owner_name`** — Filters opportunities by the opportunity owner
- **`stage_name`** — Filters opportunities by sales stage
- **`from_date / to_date`**— Filters by **CreatedDate** range
- **`IsClosed`** — Always fixed to **FALSE** to get active opportunities
- **`limit`**: Maximum number of opportunities to return.
- **`order_by`**: Defines the field used to sort results (e.g., `CreatedDate DESC`).
- **`fields`**: Comma-separated list of Opportunity fields to return: `Id, Name, Description, NextStep,AccountId, Account.Name,StageName, Amount, CloseDate, Type, LeadSource, Probability, ForecastCategory,CreatedDate, LastModifiedDate, LastActivityDate`

**SOQL Filtering Notes:**

- Use **SOQL syntax** in the `filter_query` parameter to filter opportunities based on different criteria
- Common examples:
    - **Opportunity Name:** `Name LIKE '%{{opportunity_name}}%'`
    - **Account Name:**  **`Account.Name LIKE '%{{account_name}}%'`**
    - Owner Name: `Owner.Name LIKE '%{{owner_name}}%'`
    - **Stage Name:** `StageName LIKE '%{{stage_name}}%'`
    - **Created Date Range:** `CreatedDate >= {{from_date}} AND CreatedDate <= {{to_date}}`
    - Active Opportunities: `IsClosed = FALSE`
- Filters can be **combined** using:
    - `AND` → both conditions must be true
    - `OR` → either condition can be true

**Example of a Compound SOQL Filter:**

```bash
Account.Name LIKE '%{{Account_Name}}%' AND CreatedDate >= {{from_date.$SPLIT("T")[0]}}T00:00:00Z AND CreatedDate <= {{to_date.$SPLIT("T")[0]}}T23:59:59Z
```

**Example Response:**

```bash
{
  "totalCount": 1,
  "results": [
    {
      "id": "{{opportunity_id}}",
      "general": {
        "name": "{{opportunity_name}}",
        "amount": "{{amount}}",
        "stageName": "{{stage_name}}",
        "closeDate": "{{close_date}}",
        "createdDate": "{{created_date}}",
        "type": "{{opportunity_type}}",
        "leadSource": "{{lead_source}}",
        "probability": "{{probability}}",
        "forecastCategory": "{{forecast_category}}"
      },
      "owner": {
        "name": "{{owner_name}}",
        "email": "{{owner_email}}"
      },
      "account": {
        "id": "{{account_id}}",
        "name": "{{account_name}}"
      }
    }
  ]
}
```

**Notes:**

- This single API endpoint supports **flexible searches** by **Opportunity Name, Account, Owner, Stage, CreatedDate, and active/open state**

### API #2: Get Opportunity Details by Opportunity ID and Related Records

```bash
curl --location 'https://{{YOUR_INSTANCE_DOMAIN}}/services/data/vXX.0/composite' \
--header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
  "allOrNone": false,
  "compositeRequest": [
    {
      "method": "GET",
      "url": "/services/data/vXX.0/sobjects/Opportunity/{{opportunity_id}}",
      "referenceId": "Opportunity"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/sobjects/Account/{{account_id}}",
      "referenceId": "Account"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/query/?q=SELECT+OpportunityId,StageName,CreatedDate,CreatedBy.Name+FROM+OpportunityHistory+WHERE+OpportunityId='\''{{opportunity_id}}'\''+ORDER+BY+CreatedDate+ASC",
      "referenceId": "OpportunityHistory"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/query/?q=SELECT+Id,Contact.Id,Contact.Name,Contact.Email,Contact.Phone,Contact.Title,Role,IsPrimary+FROM+OpportunityContactRole+WHERE+OpportunityId='\''{{opportunity_id}}'\''",
      "referenceId": "ContactRoles"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/query/?q=SELECT+Id,Product2.Name,Product2.Family,Quantity,UnitPrice,TotalPrice+FROM+OpportunityLineItem+WHERE+OpportunityId='\''{{opportunity_id}}'\''",
      "referenceId": "Products"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/query/?q=SELECT+Id,Subject,Status,ActivityDate,CreatedDate,Owner.Name,Description+FROM+Task+WHERE+WhatId='\''{{opportunity_id}}'\''+ORDER+BY+CreatedDate+DESC+LIMIT+50",
      "referenceId": "Tasks"
    },
    {
      "method": "GET",
      "url": "/services/data/vXX.0/query/?q=SELECT+Id,Subject,StartDateTime,EndDateTime,CreatedDate,Owner.Name,Description+FROM+Event+WHERE+WhatId='\''{{opportunity_id}}'\''+ORDER+BY+StartDateTime+DESC+LIMIT+50",
      "referenceId": "Events"
    }
  ]
}'

```

**Request Body Parameters:**

- `opportunity_id` – The Salesforce Opportunity ID selected by the user.
- `account_id` – The Account ID associated with the Opportunity.
- `LIMIT:` Maximum number of records returned

**Composite Components Returned:**

- **`Opportunity`** – Core Opportunity details (Id, Name, Amount, StageName, Owner, Account, CreatedDate).
- **`Account`** – Account details associated with the Opportunity (Id, Name).
- **`OpportunityHistory`** – Historical stage changes for the Opportunity (OpportunityId, StageName, CreatedDate, CreatedBy.Name).
- **`ContactRoles`** – Contacts linked to the Opportunity (ContactId, Contact Name, Contact Email, Contact Phone, Title, Role, IsPrimary).
- **`Products`** – Products associated with the Opportunity (Product Name, Family, Quantity, UnitPrice, TotalPrice).
- **`Tasks`** – Tasks related to the Opportunity (Id, Subject, Status, ActivityDate, Owner, Description, CreatedDate).
- **`Events`** – Events linked to the Opportunity (Id, Subject, StartDateTime, EndDateTime, Owner, Description, CreatedDate).

**Notes:**

- `allOrNone: false` ensures if one subrequest fails, others still succeed.
- Each request uses a **referenceId** to correlate responses.