Quick Overview
This workflow receives Salesforce Quote events via a webhook, enriches them with Salesforce Opportunity and Account data, benchmarks the deal against historical outcomes stored in Google Sheets, uses Groq (LangChain agent) to generate a pricing recommendation, then updates the Quote in Salesforce and notifies a Slack user.
How it works
- Receives a POST webhook request containing a Salesforce Quote payload (including the Opportunity ID and Quote ID).
- Retrieves the related Opportunity and Account records from Salesforce and normalizes key deal attributes like amount, stage, segment, industry, and deal size.
- Loads historical deal records from Google Sheets and selects the most similar past deals based on deal size, segment, and industry.
- Computes pricing benchmarks from the matched history, including win rate, average discounts for won vs. lost deals, and a recommended discount range.
- Sends the current deal context and benchmark metrics to a Groq-hosted LLM (via a LangChain agent) to produce a structured JSON recommendation with discount, final price, win probability, confidence, risk level, and justification.
- Updates the Salesforce Quote via the Salesforce REST API with the recommended fields and posts a detailed pricing summary to a Slack user.
Setup
- Configure the webhook endpoint URL in your Salesforce Quote event source so it sends POST requests with the required fields (at minimum quoteId and opportunityId).
- Add Salesforce OAuth2 credentials and replace {DOMAIN_NAME} in the Salesforce REST API URL with your Salesforce instance domain.
- Add Google Sheets OAuth2 credentials and ensure the referenced spreadsheet contains the expected columns (e.g., DealSize, Segment, Industry, Outcome, DiscountGiven, FinalPrice).
- Add a Groq API credential for the LLM used by the LangChain agent and adjust the model if needed.
- Add Slack OAuth2 credentials and set the target user/channel for the pricing notification.