Skip to main content
Article
customer-supportai-agentchatbotintercom-finautomationconversational-ailow-codesaas

Automate Customer Support with Intercom Fin

Deploy Intercom Fin, an AI agent that autonomously resolves customer queries using your help content. Configure its behavior, connect your knowledge base, and extend its skills with custom actions to provide instant, 24/7 support.

intermediate30 min5 steps
The play
  1. Activate Fin in Your Workspace
    Navigate to the 'Automation' section in your Intercom settings and select 'Fin'. Enable it to begin the setup process. This makes Intercom Fin available to manage conversations in your Intercom Messenger.
  2. Connect Your Knowledge Sources
    In the Fin settings, under 'Content sources', connect your Intercom Articles (Help Center). Fin uses this content to generate answers, so ensure your articles are comprehensive and up-to-date for the best performance.
  3. Configure Fin's Behavior and Tone
    Define how Intercom Fin interacts with users. Set a personality (e.g., professional, friendly), choose the languages it supports, and establish rules for when it should hand over a conversation to a human teammate. This ensures a consistent brand experience.
  4. Create a Custom Action for Real-Time Data
    Extend Fin's abilities beyond your knowledge base by creating Custom Actions. These are secure API calls to your own services. For example, create an action to 'Check Order Status' that fetches live data from your backend, allowing Fin to provide personalized answers.
  5. Test and Go Live
    Use the built-in 'Try it out' feature in the Fin settings to interact with your configured bot as a customer would. Test various questions and actions. Once satisfied, enable Fin for specific audiences and monitor its performance via Intercom's reports.
Starter code
import os
from flask import Flask, request, jsonify

# This is a sample backend service that Intercom Fin can call via a Custom Action.
# To run: 
# 1. pip install Flask
# 2. FLASK_APP=starter.py flask run
# 3. Use a tool like ngrok to expose this local server to the internet (ngrok http 5000)
# 4. Provide the ngrok URL to your Intercom Custom Action.

app = Flask(__name__)

# A mock database of orders
ORDERS_DB = {
    "user1@example.com": {"order_id": "ABC-123", "status": "Shipped"},
    "user2@example.com": {"order_id": "XYZ-789", "status": "Processing"}
}

@app.route('/check-order-status', methods=['POST'])
def check_order_status():
    """ 
    Endpoint for Fin's 'Check Order Status' Custom Action.
    Intercom sends a POST request with customer data.
    """
    data = request.get_json()
    print(f"Received request from Intercom: {data}")

    # The 'input_values' structure is defined by your Custom Action setup in Intercom
    customer_email = data.get('input_values', {}).get('customer_email')

    if not customer_email:
        return jsonify({'error': 'customer_email not provided'}), 400

    order_info = ORDERS_DB.get(customer_email.lower())

    if not order_info:
        # This response is sent back to Fin, which then formulates a message for the user.
        response_payload = {
            "output_values": {
                "found_order": False,
                "status_message": "Sorry, I couldn't find any recent orders for that email address."
            }
        }
    else:
        response_payload = {
            "output_values": {
                "found_order": True,
                "order_id": order_info['order_id'],
                "status_message": f"Your order {order_info['order_id']} is currently {order_info['status']}."
            }
        }

    return jsonify(response_payload)

if __name__ == '__main__':
    app.run(debug=True)
Automate Customer Support with Intercom Fin — Action Pack