Support handoff
Connecting Foldspace to Intercom: Automated Support Handoff
Overview
Section titled “Overview”By implementing this action, your Foldspace Agent can intelligently recognize when it has reached its limits and seamlessly transition the conversation to your human support team. This ensures that frustrated users or complex technical issues are always handled with the highest level of care.
There are two ways to hand off to Intercom. Pick based on how your team works:
| Handoff type | What happens | Use when |
|---|---|---|
| Live chat | The Agent opens the Intercom Messenger on the page, seeded with the conversation summary, then steps aside. | You staff the Intercom Inbox for live chat. |
| Email → conversation | The Agent emails the summary and context to your Intercom-connected support address, which opens a conversation in the Inbox. | You handle support asynchronously. |
Both are triggered the same way; only the destination differs. The steps below cover the live-chat handoff — the email option is at the end of this guide.
Prerequisites
Section titled “Prerequisites”- An active Intercom subscription with the Intercom Messenger installed on your site.
- Access to your Foldspace Dashboard.
- The Foldspace Web SDK integrated into your web application.
Step 1: Create the “Support Handoff” Action
Section titled “Step 1: Create the “Support Handoff” Action”First, we need to define the action inside the Foldspace App so the Agent knows how to “call” for human help.
- Log in to your Foldspace App.
- Navigate to the Actions section and click Create New Action.
- Fill in the fields below. Each one has a Copy button, so you can paste it straight into the form.
The Actions editor has a Foldspace assistant beside the form. Paste this prompt into it and it fills in every field below for you, then leaves the action as a draft for you to review before publishing.
Fields
Section titled “Fields”Logic & Instructions
Section titled “Logic & Instructions”Paste this into the Instructions field. It stops the Agent from escalating on ordinary questions:
User Input Configuration
Section titled “User Input Configuration”Create a required input field so the Support Agent receives context immediately upon handoff. Set Type to string and Required to yes.
Step 2: Code Implementation
Section titled “Step 2: Code Implementation”Once the action is defined in the dashboard, you must handle the execution on your front-end. Add the following code to your application where you initialize the Foldspace Agent:
window.foldspace("when", "ready", () => { const agent = window.foldspace.agent("planning-copilot");
agent.addActionHandlers({ support_handoff: { execute: async (params) => { try { const HANDOFF_DELAY_MS = 5000; // 5-second delay for smooth UX
// Verify Intercom is loaded on the page if (!window.Intercom) { return { message: "Sorry, I'm unable to connect to the Support Agent right now. How else can I assist you?", }; }
const message = params?.user_prompt?.trim() || "User requested human assistance.";
// Trigger the handoff sequence setTimeout(() => { window.Intercom("showNewMessage", message); agent.hide(); // Hide the Foldspace agent to let Intercom take over }, HANDOFF_DELAY_MS);
return { message: "Transferring you to a Support Agent now. One moment please.", }; } catch (error) { return { message: "Something went wrong while connecting to support. Please try again or reach out directly.", }; } }, }, });
agent.show();});Email handoff (opens an Intercom conversation)
Section titled “Email handoff (opens an Intercom conversation)”When you don’t staff live chat, the Agent can hand off by email instead. This isn’t a real-time transfer — Foldspace sends the conversation summary and context to your support address, and Intercom turns that email into a conversation in the Inbox.
No custom code required:
- Enable handoff in Style & Behavior → Data Access & Handoff (Style & Behavior).
- Set the destination to Email in Integrations.
- Point it at an address that reaches your Intercom Inbox. Intercom only receives mail sent to your workspace’s inbound address —
[app_id]@[workspace].intercom-mail.com— so either send there directly, or send to a support address you’ve configured to auto-forward to it (Settings → Channels → Email → Domains & addresses).
Don’t send to a plain mailbox. An address that doesn’t forward to your workspace’s inbound address never appears in the Intercom Inbox, so the escalation sits in someone’s email — unassigned, unrouted, and untracked.
Best Practices
Section titled “Best Practices”- User Expectations: The 5-second delay defined in
HANDOFF_DELAY_MSgives the user time to read the Agent’s confirmation message before the UI switches. - Fallback: If the Intercom script fails to load (e.g., due to an ad-blocker), the code includes a fallback message to ensure the user isn’t left in a “dead end.”
- Context is King: The
user_promptis automatically sent to Intercom, meaning your support team starts the conversation with a summary of the issue already in hand.
Related
Section titled “Related”- Connecting Foldspace to Zendesk — the same live-handoff pattern for Zendesk, plus an email-to-ticket option.
- Integrations — where handoff destinations (email, HubSpot, webhook) are configured.
Intercom references
Section titled “Intercom references”Official Intercom documentation for the APIs and setup this guide relies on:
- JavaScript API: Methods —
Intercom("showNewMessage", prePopulatedContent)and the other Messenger methods. - Installing the Intercom Messenger for web — get the Messenger snippet onto your page so
window.Intercomis available. - Get started with Intercom Inbox — the Inbox that handles inbound support email.
- Forward your email to your team inbox — the workspace inbound address and forwarding setup.