Article
customer-serviceomnichannel-supportai-agentintercomragapi-integrationticket-automation
Deploy an Omnichannel Support Agent with Intercom
Set up Intercom's Omnichannel Support Agent to automate tier-1/2 support. Connect your knowledge base for RAG-powered resolutions and unify customer conversations from chat, email, and social media into a single, intelligent inbox.
intermediate30 min4 steps
The play
- Connect Your Knowledge BaseNavigate to 'Articles' in your Intercom workspace. Import existing help center content or create new articles. The Omnichannel Support Agent uses this content via Retrieval-Augmented Generation (RAG) to provide accurate, context-aware answers to customer questions.
- Configure Agent Behavior and RulesGo to the AI Agent's settings (e.g., 'Fin' by Intercom). Define its persona, conversation style, and escalation paths. Configure rules for when the Omnichannel Support Agent should attempt to resolve an issue versus when it should immediately route to a human agent.
- Activate Across ChannelsEnable the Omnichannel Support Agent on your desired customer-facing channels. In your Intercom settings, go to 'Messenger' to enable it for web chat, and 'Email' to connect your support inbox. This unifies all interactions for the agent.
- Monitor Agent Performance via APIUse the Intercom API to programmatically track the agent's conversations. This allows you to analyze resolution rates, CSAT, and identify areas for knowledge base improvement. The script fetches recent conversations handled by the AI.
Starter code
import requests
import json
# 1. Replace with your actual Intercom Access Token.
# Find it in your Intercom workspace under: Settings > Developers > Developer Hub > Your apps
ACCESS_TOKEN = "YOUR_INTERCOM_ACCESS_TOKEN"
# 2. Intercom's AI Agent (Fin) has a fixed admin ID.
AI_ADMIN_ID = "663322"
API_URL = "https://api.intercom.io/conversations/search"
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Accept": "application/json",
"Content-Type": "application/json",
"Intercom-Version": "2.10"
}
# 3. This query finds the 10 most recently updated conversations assigned to the AI agent.
query_payload = {
"query": {
"field": "admin_assignee_id",
"operator": "=",
"value": AI_ADMIN_ID
},
"sort": {
"field": "updated_at",
"order": "descending"
},
"pagination": {
"per_page": 10
}
}
def fetch_agent_conversations():
"""Fetches and prints recent conversations handled by the Omnichannel Support Agent."""
print("Fetching recent conversations handled by the AI agent...")
try:
response = requests.post(API_URL, headers=headers, data=json.dumps(query_payload))
response.raise_for_status() # Raises an HTTPError for bad responses (4xx or 5xx)
data = response.json()
conversations = data.get('conversations', [])
if not conversations:
print("No conversations found for the AI agent.")
return
print(f"\n--- Found {len(conversations)} Recent Agent Conversations ---")
for convo in conversations:
contact_name = convo.get('source', {}).get('author', {}).get('name', 'Unknown Contact')
state = 'closed' if convo.get('state') == 'closed' else 'open'
print(f"ID: {convo['id']} | Title: \"{convo['title']}\" | Contact: {contact_name} | State: {state}")
print("--------------------------------------------------")
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
print(f"Response body: {response.text}")
except Exception as err:
print(f"An other error occurred: {err}")
if __name__ == "__main__":
if ACCESS_TOKEN == "YOUR_INTERCOM_ACCESS_TOKEN":
print("Please replace 'YOUR_INTERCOM_ACCESS_TOKEN' with your actual token.")
else:
fetch_agent_conversations()