Skip to content

KeyCRM Integration

Overview

The KeyCRM integration allows your MyChatBot agent to create and manage leads, orders, and contacts directly in your KeyCRM account. This enables your AI assistant to efficiently handle customer relationship management without human intervention, streamlining your sales process.

App Creation on KeyCRM

  1. Log in to your KeyCRM account as an administrator
  2. Navigate to SettingsGeneralCreating Integration on MyChatBot
  3. Click Create New API KeyCreating Integration on MyChatBot
  4. Click Save to save your API key

Creating Integration on MyChatBot

  1. Navigate to the Integrations tab in your MyChatBot dashboard - https://app.mychatbot.app/integration?integration=KeyCRM
  2. Select the agent you want to connect to KeyCRM Creating Integration on MyChatBot
  3. Scroll down to find KeyCRM in the integrations list
  4. Click the Connect button
  5. You'll need to provide the following credentials:
    • Access Token: Your KeyCRM API key Creating Integration on MyChatBot
  6. Click Submit to save your integration

Entities & Data Fields Configuration

After connecting your KeyCRM account, you'll need to configure which entities and fields your agent can access: Entities & Data Fields Configuration

  1. In the "Entities & Data Fields Configuration" section, you can:
    • Toggle Use Leads to enable lead management
    • Toggle Use Deals to enable order management
  2. For each entity type, you can select:
    • Standard fields from KeyCRM
    • Custom fields that exist in your CRM
  3. Click Apply fields to save your configuration
  4. If you need to sync the latest funnel statuses, use the Sync statuses button at the top

Understanding Entity Types

KeyCRM integration supports three main entity types:

  • Leads: Potential sales opportunities
  • Orders: Sales transactions in progress
  • Contacts: Individual client information

Field Types

Each entity has two types of fields:

  • Standard Fields: Default fields provided by KeyCRM
  • Custom Fields: User-defined fields specific to your CRM setup

Special Fields

Several special fields require specific attention:

  1. Status

    • For leads: Represents the current stage in the lead pipeline
    • Must match exactly with statuses defined in your KeyCRM account
    • Can be updated using the Sync statuses button
  2. Source

    • Identifies where the lead originated
    • Automatically set to the communication channel (e.g., "Telegram", "WhatsApp") or "AI" if not specified
    • This helps track which leads came from your AI assistant
  3. Chat Link

    • Automatically added to each lead or order
    • Contains a link back to the conversation that generated the lead
    • Stored in the manager comment field

Working with Pipelines

Leads in KeyCRM are organized into pipelines with multiple stages:

  1. Select the appropriate pipeline from the dropdown in the MyChatBot dashboard
  2. Your agent will use this pipeline when creating new leads
  3. The stages within the pipeline can be used to move leads through your sales process

Available Tools

After connecting KeyCRM, your agent will have access to four powerful tools:

1. create_crm_lead

This tool allows your agent to create new leads with the following parameters:

  • full_name: Contact's full name (required)
  • phone: Contact's phone number
  • Status: Current stage in the sales pipeline
  • Custom Fields: Any additional fields you've configured

All fields you select in the "Entities & Data Fields Configuration" section will be available as parameters for this function.

When a lead is created:

  • A contact is automatically created or found based on the phone number
  • The lead is linked to this contact
  • A chat link is automatically added to trace back to the conversation
  • The source is set to identify your AI assistant

2. edit_crm_lead

This tool enables your agent to update existing leads:

  • Lead ID: Automatically uses the lead associated with the client
  • full_name: Update the contact's name
  • phone: Update the contact's phone number
  • Status: Update the lead's status/stage
  • Custom Fields: Update any field values as needed

All fields you select in the "Entities & Data Fields Configuration" section will be available as parameters for this function.

When a lead is updated:

  • A contact is automatically created or found based on the phone number
  • The lead is linked to this contact
  • A chat link is automatically added to trace back to the conversation
  • The source is set to identify your AI assistant

3. create_crm_deal

This tool allows your agent to create new orders:

  • full_name: Contact's full name (required)
  • phone: Contact's phone number (required)
  • shipping: Shipping information (required)
    • shipping_address_city: City for delivery (required)
    • shipping_receive_point: Branch or address for pickup (required)
  • products: List of products (required)
    • sku: Product SKU
    • name: Product name
    • price: Product price
    • quantity: Product quantity
  • Custom Fields: Any additional fields you've configured

All fields you select in the "Entities & Data Fields Configuration" section will be available as parameters for this function.

When an order is created:

  • A contact is automatically created or found based on the phone number
  • The order is linked to this contact
  • Products are added to the order (matching existing products or creating new ones)
  • The order is added to your system with appropriate shipping information
  • The order information is tracked by MyChatBot internal system

4. add_crm_client_contact

This tool enables your agent to create or update contacts:

  • full_name: Contact's complete name (required)
  • phone: Primary phone number (required)

All fields you select in the "Entities & Data Fields Configuration" section will be available as parameters for this function.

When a contact is created:

  • If a lead already exists for the client, it's updated with this contact
  • The client's information in MyChatBot is also updated
  • Any related orders are updated with the contact information

The client status is tracked by the internal MyChatBot system

Configuration in Agent Instructions

Creating Leads

Include these examples in your agent's instructions to enable lead creation:

When a customer expresses interest in our services, use create_crm_lead to add them to KeyCRM with the following information:
- Use their name as the lead title
- Include their phone number
- Set status to "New"
- Add any relevant information to custom fields

Creating Orders

For orders:

When a customer confirms a purchase intention, use create_crm_deal to create an order in KeyCRM:
- Use their full name
- Include their phone number
- Add shipping information:
  - City for delivery
  - Branch or address for pickup
- Add the products they're interested in with:
  - Product name
  - SKU (if available)
  - Price
  - Quantity

Updating Lead Status

Include these examples to enable status updates:

When a customer requests a call back:
1. Use create_crm_lead if they're new
2. Use edit_crm_lead to update the lead status to "Callback Requested"
3. Add the preferred callback time to comments

When a customer confirms an appointment:
1. Use edit_crm_lead to update the lead status to "Appointment Scheduled"
2. Add appointment details to the comments field

Adding or Updating Contact Information

When a customer provides their contact details:
1. Use add_crm_client_contact to add their information to KeyCRM
2. Include their full name and phone number
3. Update any existing lead with this information