Ui componentsTools

Detect Sales Signals

Copy page

Identify and respond to purchasing signals in user questions

Overview

The "Detect Sales Signals" tool pattern helps identify when users express potential interest in making a purchasing or action related to sales. This is useful for embedding call to actions to:

  • Schedule a sales meeting
  • Triggering in-app logic to make an upgrade
  • Guiding users to relevant pricing or sales content
Note
Note

Tools are available for the Enterprise tier. Please contact sales@inkeep.com for details.

Book a meeting

This example provides a demo scheduling link when a sales signal is detected.

import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
import type { ToolFunction } from "@inkeep/cxkit-react";
import { salesSignalType, detectedSalesSignal } from "./common-tool-schemas.ts";
 
const validSalesSignalTypes: string[] = salesSignalType.options.map(
  (option) => option.value
);
 
const aiChatSettings = {
  getTools: () => [
    {
      type: "function",
      function: {
        name: "detectSalesSignal",
        description:
          "Identify when users express interest in potentially purchasing a product.",
        parameters: zodToJsonSchema(detectedSalesSignal),
      },
      renderMessageButtons: ({ args }) => {
        // If any valid sales signal is detected, show a demo scheduling option
        if (args.type && validSalesSignalTypes.includes(args.type)) {
          return [
            {
              label: "Schedule a Demo",
              icon: { builtIn: "LuCalendar" },
              action: {
                type: "open_link",
                url: "/schedule-demo",
              },
            },
          ];
        }
        return [];
      },
    } as ToolFunction<{ type: string }>,
  ],
};

Use the following styles if you would like to make the button larger and on it's own line:

Example of the escalate to sales tool
import type { InkeepBaseSettings } from "@inkeep/cxkit-react";
const baseSettings: InkeepBaseSettings = {
  // ...rest of baseSettings
  theme: {
    styles: [
      {
        key: "custom-style",
        type: "style",
        value: `
          .ikp-ai-chat-message-toolbar {
            flex-wrap: wrap;
            justify-content: flex-end;
          }
          .ikp-ai-chat-message-tool-actions {
            width: 100%;
          }
          .ikp-ai-chat-message-tool-action {
            background: var(--ikp-color-gray-950);
            color: white;
            font-size: 15px;
            border: none;
            margin: 0px auto;
            margin-bottom: 8px;
            padding: 12px 24px;
            gap: 12px;
            display: flex;
            height: auto;
          }
          .ikp-ai-chat-message-tool-action > .ikp-icon {
            font-size: 18px;
          }
          .ikp-ai-chat-message-tool-action:hover:not([disabled]) {
            background: var(--ikp-color-gray-800);
            color: white;
          }
          [data-theme="dark"]  .ikp-ai-chat-message-tool-action {
            background: var(--ikp-color-inkeep-expanded-primary-400);
            color: var(--ikp-color-gray-950);
          }
          [data-theme="dark"]  .ikp-ai-chat-message-tool-action:hover:not([disabled]) {
            background: var(--ikp-color-inkeep-expanded-primary-200);
            color: var(--ikp-color-gray-950);
          }
        `,
      },
    ],
  },
};

Signal-Based Actions

This example provides different actions based on the specific type of sales signal detected.

Example of the escalate to sales tool
import { z } from "zod";
import type { InkeepAIChatSettings, ToolFunction } from "@inkeep/cxkit-react";
import { zodToJsonSchema } from "zod-to-json-schema";
import { detectedSalesSignal } from "./common-tool-schemas.ts";
 
const aiChatSettings: InkeepAIChatSettings = {
  getTools: () => [
    {
      type: "function",
      function: {
        name: "detectSalesSignal",
        description:
          "Identify when users express interest in potentially purchasing a product.",
        parameters: zodToJsonSchema(detectedSalesSignal),
      },
      renderMessageButtons: ({ args }) => {
        const signalType = args.type;
 
        // Different actions based on specific signal type
        if (
          [
            "requested_sales_contact",
            "enterprise_features",
            "implementation_services",
          ].includes(signalType)
        ) {
          return [
            {
              label: "Talk to Sales",
              icon: { builtIn: "FaUserTie" },
              action: {
                type: "open_link",
                url: "/contact-sales",
              },
            },
          ];
        }
 
        if (signalType === "pricing_inquiry") {
          return [
            {
              label: "View Pricing",
              icon: { builtIn: "FaTag" },
              action: {
                type: "open_link",
                url: "/pricing",
              },
            },
          ];
        }
 
        if (signalType === "upgrade_inquiry") {
          return [
            {
              label: "Upgrade Account",
              icon: { builtIn: "LuSparkles" },
              action: {
                type: "invoke_callback",
                callback: ({ conversation }) => {
                  // Custom logic to show an upgrade modal in your application
                  showUpgradeModal();
                },
              },
            },
          ];
        }
 
        return [];
      },
    } as ToolFunction<{ type: string }>,
  ],
};

On this page