Skip to content

Salesforce CRM Integration

Overview

The Salesforce CRM integration allows your MyChatBot agent to create and manage leads, deals, and contacts directly in your Salesforce account. This enables your AI assistant to perform CRM operations without human intervention, streamlining your sales process and customer management.

Connected App Creation in Salesforce

  1. Log in to your Salesforce account as an administrator
  2. Navigate to Setup > App Manager Connected App Creation in Salesforce
  3. Click New Connected App
  4. Fill in the required information:
    • Connected App Name: MyChatBot Integration
    • API Name: MyChatBot_Integration_API
    • Contact Email: Your email address
    • Enable OAuth Settings: Check this box
    • Callback URL: https://app.mychatbot.app and https://app.mychatbot.app/integrationConnected App Creation in Salesforce
    • Selected OAuth Scopes: Select all necessary scopes, including:
      • Access and manage your data (api)
      • Perform requests at any time (refresh_token, offline_access) Connected App Creation in Salesforce
  5. Click Save and wait for your app to be created
  6. After creation click Manage Consumer DetailsConnected App Creation in Salesforce
  7. Note your Consumer Key (Client ID) and Consumer Secret (Client Secret) Connected App Creation in Salesforce
  8. For security, you may need to set IP relaxation to "Relax IP restrictions" and check Enable Token Echange FlowConnected App Creation in Salesforce

Creating Integration on MyChatBot

  1. Navigate to the Integrations tab in your MyChatBot dashboard - https://app.mychatbot.app/integration?integration=Salesforce

  2. Select the agent you want to connect to Salesforce Creating Integration on MyChatBot

  3. Scroll down to find Salesforce CRM in the integrations list

  4. Click the Connect button

  5. You'll need to provide the following credentials:

    • Domain: Your Salesforce domain (e.g., your-company.my.salesforce.com)
    • Client ID: The Consumer Key from your Salesforce connected app
    • Client Secret: The Consumer Secret from your Salesforce connected app Creating Integration on MyChatBot
  6. Click Submit to save your integration

Entities & Data Fields Configuration

After connecting your Salesforce 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 deal management
  2. For each entity type, you can select:
    • Standard fields from Salesforce
    • Custom fields that exist in your CRM
  3. Click Apply fields to save your configuration

Understanding Entity Types

Salesforce integration supports four main entity types:

  • Leads: Potential sales opportunities
  • Deals: Sales transactions (called Orders in Salesforce)
  • Contacts: Individual client information
  • Accounts: Organizations that contacts belong to

Field Types

Each entity has two types of fields:

  • Standard Fields: Default fields provided by Salesforce
  • 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
    • Common values include "New", "Working", "Qualified", "Converted"
    • Must match exactly with statuses defined in your Salesforce account
  2. LeadSource

    • Identifies where the lead originated
    • Automatically set to "AI-" + name of your assistant
    • This helps track which leads came from your AI assistant
  3. Order Start Date

    • Required when creating a deal (order)
    • Specifies when the order begins
  4. Products

    • Used in deal creation to specify products to be added to the order
    • Each product requires a name, quantity, and optionally a price

Working with Products

Deals in Salesforce can include products as order items:

  1. You can add products to deals using the products parameter in the create_crm_deal function
  2. Each product should include:
    • name: Product name (required)
    • quantity: Number of items (required)
    • price: Product price (optional, will use standard price if not specified)

Products must already exist in your Salesforce Pricebook for the order to be created successfully.

Available Tools

After connecting Salesforce CRM, 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
  • 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 and account are automatically created or found based on the full name and phone number
  • The lead is linked to this contact
  • The source is set to identify your AI assistant

2. edit_crm_lead

This tool enables your agent to update existing leads:

  • full_name: Update the contact's name
  • phone: Update the contact's phone
  • 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.

3. create_crm_deal

This tool allows your agent to create new deals (orders) with the following parameters:

  • full_name: Contact's full name (required)
  • phone: Contact's phone number (required)
  • Order Start Date: When the order begins (required)
  • Status: Order status (defaults to "Draft" if not specified)
  • products: Optional list of products to add to the order, each with:
    • name: Product name (required)
    • quantity: Number of items (required)
    • price: Unit price (optional override)
  • 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 deal is created:

  • A contact and account are automatically created or found based on the full name and phone number
  • The order is linked to this contact and account
  • Products are added to the order (if specified and found in the Pricebook)
  • 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)

When a contact is created:

  • If a lead already exists for the client, it's updated with this contact information
  • A new contact record is created in Salesforce
  • The client's information in MyChatBot is also updated

The client status is tracked by the internal MyChatBot system

Configuration in Agent Instructions

Creating Leads or Deals

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

When a customer expresses interest in our services, use create_crm_lead in Salesforce with the following information:
- Use their name as full_name
- Include their phone number
- Set Status to "New" 
- Add any relevant information to other fields

For deals:

When a customer confirms a purchase intention, use create_crm_deal in Salesforce:
- Use their full name
- Include their phone number
- Set Order Start Date to today's date in format YYYY-MM-DD
- Add products they're interested in:
  [
    {
      "name": "Product Name",
      "quantity": 1,
      "price": 99.99
    }
  ]
- Set Status to "Draft"

Updating Lead Status

Include these examples to enable status updates:

When a customer requests a call back:
1. Use edit_crm_lead to update the lead status to "Working"
2. Add any other important information to the relevant fields

When a customer confirms interest:
1. Use edit_crm_lead to update the lead status to "Qualified"
2. Update their contact information if needed

Adding Contacts

Include these examples to enable contact creation:

When interacting with a new customer:
1. Use add_crm_client_contact to create a new contact with:
   - Their full name
   - Their phone number
2. Let them know their information has been registered
3. Proceed with the conversation flow