Salesforce conga composer

From CraftOS-dev/craftbot-agent-bundles · View interactive version

Salesforce conga composer is an AI agent skill from the GitHub repository CraftOS-dev/craftbot-agent-bundles. Generate documents from Salesforce data using Conga Composer (the Salesforce AppExchange leader for doc gen) — merge Salesforce records into Word / Excel / PPT / PDF templates with conditional logic, loop over child records (opportunity → line items), and chain to Conga Sign or DocuSign. Fallback to

How to use this skill

Skill file

Salesforce-to-doc generation — Conga Composer + PandaDoc fallback

This skill ships the Salesforce-native doc generation pipeline. The dominant 2026 tool is Conga Composer (formerly Appextremes); the agent has the wiring for both Composer URL-based and Composer Direct REST.

When to use

User says:

Companion skills:

Setup

# Salesforce — REST API for record fetching + CPQ
# Required env: SF_INSTANCE_URL, SF_ACCESS_TOKEN (or use OAuth refresh token)
# Default skill: salesforce-api
pip install simple-salesforce

# Conga Composer — accessed via Composer URL pattern OR Composer Direct REST
# Required env (URL mode): SF session ID (Salesforce-issued) — auto in Lightning context
# Required env (REST mode): CONGA_API_KEY, CONGA_DC_BASE_URL (https://composer.congamerge.com or regional)

# Conga Sign (if e-sign via Conga)
# Required env: CONGA_SIGN_API_KEY

# Fallback: PandaDoc REST
# Required env: PANDADOC_API_KEY

Common recipes

Recipe 1: Pick the doc-gen path

| Option | Best when | Notes |

|---|---|---|

| Conga Composer (URL button on record) | Click-to-generate UX in SF | Renders in browser; supports Word/Excel/PPT/PDF |

| Conga Composer Direct (REST) | Server-side batch | No browser; raw REST |

| Conga CPQ Generate | Salesforce CPQ orgs | Native CPQ workflow |

| S-Docs | Free-tier alternative | Limited features |

| Nintex DocGen (formerly Drawloop) | Nintex shops | Workflow-heavy |

| PandaDoc + SF native | No Conga license | Less native, broader features |

| DocuSign Gen for Salesforce | DocuSign-only shop | Tightly bound to DocuSign |

| Mail merge (manual) | Edge / one-off | Not recommended |

Default: Conga Composer if licensed; PandaDoc otherwise.

Recipe 2: Build a Composer URL button

Composer URL pattern:

https://composer.congamerge.com/Composer8/index.html
  ?sessionId={!$Api.Session_ID}
  &serverUrl={!$Api.Partner_Server_URL_290}
  &id={!Opportunity.Id}
  &templateId=a0X1U000000XXXXUAJ
  &DefaultPDF=1
  &EmailToId={!Opportunity.Primary_Contact_Email__c}
  &OFN=Proposal-{!Opportunity.Name}

Create a Salesforce custom button on Opportunity → Behavior: Execute JavaScript (Classic) or Lightning Web Component action.

Recipe 3: Conga Composer template authoring (Word merge fields)

Inside the Word template, use Composer's merge syntax:

Customer: «Opportunity_Account_Name»
Deal value: «Opportunity_Amount»
Term length: «Opportunity_Term_Months__c»

«TableStart:LineItems»
 - «Product__r_Name» × «Quantity__c» @ «UnitPrice__c»  = «TotalPrice__c»
«TableEnd:LineItems»

«IF Opportunity_Tier__c="Enterprise"»
   This MSA is governed by Section 8 SLA.
«ENDIF»

Conga supports: simple fields, «TableStart» / «TableEnd» for child loops, «IF» / «ELSEIF» / «ENDIF» for conditionals.

Recipe 4: Composer Direct REST (server-side)

curl -X POST $CONGA_DC_BASE_URL/composer/api/v1/composer \
  -H "Authorization: Bearer $CONGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sessionId": "'"$SF_ACCESS_TOKEN"'",
    "serverUrl": "'"$SF_INSTANCE_URL"'/services/Soap/u/56.0",
    "templateId": "a0X1U000000XXXXUAJ",
    "recordId": "0061U000000abcdAAA",
    "outputFormat": "PDF",
    "queries": ["Conga_LineItems_Query"]
  }'

Returns the generated doc as base64 or as a URL pointer.

Recipe 5: Conga query — define a parent-child record pull

Create a Conga Query custom record:

SELECT Id, Product2.Name, Quantity, UnitPrice, TotalPrice
FROM OpportunityLineItem
WHERE OpportunityId = '{pv0}'
ORDER BY ListPrice DESC

Reference in Composer URL via &queryId=a0Q... or in REST via "queries":["Conga_LineItems_Query"].

Recipe 6: Conga Sign — send for signature

curl -X POST $CONGA_SIGN_API/v1/transactions \
  -H "Authorization: Bearer $CONGA_SIGN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "MSA - Acme - 2026-Q2",
    "documents": [{"file_base64": "...", "name": "msa.pdf"}],
    "recipients": [{
      "email": "buyer@acme.com",
      "name": "Jane Smith",
      "role": "SIGNER",
      "routing_order": 1
    }],
    "salesforceRecordId": "0061U000000abcdAAA"
  }'

Recipe 7: Lightning Flow action — generate proposal on stage change

In Setup → Flows, create a record-triggered flow:

  1. Trigger: Opportunity StageName changes to "Proposal".
  2. Action: Apex callout (or external service) → Recipe 4 (Composer Direct).
  3. Action: Attach returned PDF to Opportunity as ContentDocument.
  4. Action: Update Opportunity field Proposal_Generated_At__c = NOW().

Recipe 8: PandaDoc fallback — Salesforce data → PandaDoc template

# 1) Fetch the opp + line items
curl "$SF_INSTANCE_URL/services/data/v56.0/sobjects/Opportunity/0061U.../$SF_LINE_ITEMS_QUERY" \
  -H "Authorization: Bearer $SF_ACCESS_TOKEN"

# 2) Create PandaDoc from template
curl -X POST https://api.pandadoc.com/public/v1/documents \
  -H "Authorization: API-Key $PANDADOC_API_KEY" \
  -H "Content-Type: application/json" \
  -d @<(cat <<EOF
{
  "name": "Proposal - Acme",
  "template_uuid": "abc...",
  "recipients": [
    {"email":"buyer@acme.com","first_name":"Jane","last_name":"Smith","role":"client"}
  ],
  "tokens": [
    {"name":"opp.amount","value":"240000"},
    {"name":"opp.term","value":"36"}
  ],
  "pricing_tables":[{
    "name":"Pricing",
    "data_merge": false,
    "sections":[{"title":"Subscription","rows":[
      {"options":{"qty_editable":false},"data":{"name":"Pro Plan","price":2000,"qty":120}}
    ]}]
  }]
}
EOF
)

Recipe 9: Salesforce CPQ → Conga Composer chain

Salesforce CPQ produces a Quote record + QuoteLineItem records; Conga Composer merges those into the proposal Word template. The Conga button can be placed on the Quote object — Composer pulls Quote + child QuoteLineItem automatically.

Recipe 10: DocuSign Gen for Salesforce (DocuSign-only shops)

Setup → DocuSign for Salesforce → Document Generation feature; tag Word templates with field merge tokens, attach to a Process Builder / Flow trigger. Generated PDFs flow into DocuSign Envelopes for signature.

Recipe 11: Auto-archive output to Files + sync to Drive

# After Composer returns PDF, attach as ContentVersion
curl -X POST "$SF_INSTANCE_URL/services/data/v56.0/sobjects/ContentVersion" \
  -H "Authorization: Bearer $SF_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "Title": "Proposal - Acme",
    "PathOnClient": "proposal-acme.pdf",
    "VersionData": "'"$(base64 -i proposal.pdf)"'",
    "FirstPublishLocationId": "0061U000000abcdAAA"
  }'
# Then mirror to Drive
gdrive upload --parent $DRIVE_FOLDER proposal.pdf

Recipe 12: Test in sandbox first

Conga URL parameters differ between Salesforce sandbox and prod base URLs:

Build sandbox test buttons + templates before flipping prod.

Examples

Example 1: Click-to-generate Enterprise MSA from Opportunity

Goal: AE clicks one button on an Opp → branded MSA pre-filled.

Steps:

  1. Recipe 3 — author MSA Word template with merge fields.
  2. Recipe 5 — Conga Query for OpportunityLineItem.
  3. Recipe 2 — build the URL button; place on Opportunity layout.
  4. AE clicks → PDF previewed → DocuSign send (via Conga Sign or DocuSign hand-off).
  5. Recipe 11 — attach to opp record.

Result: 30-second proposal create instead of 30-minute Word merge.

Example 2: Auto-generate proposal on stage change

Goal: When Opp moves to "Proposal", generate + email the doc automatically.

Steps:

  1. Recipe 7 — Lightning Flow on stage change.
  2. Recipe 4 — Composer Direct call from Apex.
  3. Recipe 11 — attach to record + email to primary contact.
  4. Slack notify the AE: "Proposal sent to <contact>".

Result: Hands-free proposal creation tied to pipeline progression.

Example 3: Non-Conga shop — Salesforce + PandaDoc fallback

Goal: Org doesn't have Conga; still needs proposal automation.

Steps:

  1. Recipe 8 — PandaDoc template authored in PandaDoc UI.
  2. AE creates PandaDoc directly inside Salesforce via the PandaDoc add-in.
  3. PandaDoc analytics + e-sign embedded.

Result: PandaDoc covers it; cheaper for sub-50-rep teams.

Edge cases / gotchas

Sources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.