Skip to content

Commit 296aab6

Browse files
authored
Merge pull request #5171 from Ttian18/feat/tina/intercom-tool-4256
feat(tools): add Intercom tool integration (#4256)
2 parents ad3cec2 + 5e8a620 commit 296aab6

File tree

10 files changed

+1497
-0
lines changed

10 files changed

+1497
-0
lines changed

tools/src/aden_tools/credentials/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
- discord.py: Discord bot credentials
4141
- github.py: GitHub API credentials
4242
- hubspot.py: HubSpot CRM credentials
43+
- intercom.py: Intercom customer messaging credentials
4344
- slack.py: Slack workspace credentials
4445
- google_analytics.py: Google Analytics credentials
4546
- google_maps.py: Google Maps Platform credentials
@@ -75,6 +76,7 @@
7576
validate_integration_wiring,
7677
)
7778
from .hubspot import HUBSPOT_CREDENTIALS
79+
from .intercom import INTERCOM_CREDENTIALS
7880
from .llm import LLM_CREDENTIALS
7981
from .news import NEWS_CREDENTIALS
8082
from .postgres import POSTGRES_CREDENTIALS
@@ -106,6 +108,7 @@
106108
**GOOGLE_DOCS_CREDENTIALS,
107109
**GOOGLE_MAPS_CREDENTIALS,
108110
**HUBSPOT_CREDENTIALS,
111+
**INTERCOM_CREDENTIALS,
109112
**GOOGLE_CALENDAR_CREDENTIALS,
110113
**SLACK_CREDENTIALS,
111114
**SERPAPI_CREDENTIALS,
@@ -152,6 +155,7 @@
152155
"GOOGLE_DOCS_CREDENTIALS",
153156
"GOOGLE_MAPS_CREDENTIALS",
154157
"HUBSPOT_CREDENTIALS",
158+
"INTERCOM_CREDENTIALS",
155159
"GOOGLE_CALENDAR_CREDENTIALS",
156160
"SLACK_CREDENTIALS",
157161
"APOLLO_CREDENTIALS",

tools/src/aden_tools/credentials/health_check.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,16 @@ def _extract_identity(self, data: dict) -> dict[str, str]:
10581058
return identity
10591059

10601060

1061+
class IntercomHealthChecker(OAuthBearerHealthChecker):
1062+
"""Health checker for Intercom access tokens."""
1063+
1064+
def __init__(self):
1065+
super().__init__(
1066+
endpoint="https://api.intercom.io/me",
1067+
service_name="Intercom",
1068+
)
1069+
1070+
10611071
# Registry of health checkers
10621072
HEALTH_CHECKERS: dict[str, CredentialHealthChecker] = {
10631073
"discord": DiscordHealthChecker(),
@@ -1070,6 +1080,7 @@ def _extract_identity(self, data: dict) -> dict[str, str]:
10701080
"google_maps": GoogleMapsHealthChecker(),
10711081
"anthropic": AnthropicHealthChecker(),
10721082
"github": GitHubHealthChecker(),
1083+
"intercom": IntercomHealthChecker(),
10731084
"resend": ResendHealthChecker(),
10741085
"stripe": StripeHealthChecker(),
10751086
"exa_search": ExaSearchHealthChecker(),
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
"""
2+
Intercom tool credentials.
3+
4+
Contains credentials for Intercom customer messaging integration.
5+
"""
6+
7+
from .base import CredentialSpec
8+
9+
INTERCOM_CREDENTIALS = {
10+
"intercom": CredentialSpec(
11+
env_var="INTERCOM_ACCESS_TOKEN",
12+
tools=[
13+
"intercom_search_conversations",
14+
"intercom_get_conversation",
15+
"intercom_get_contact",
16+
"intercom_search_contacts",
17+
"intercom_add_note",
18+
"intercom_add_tag",
19+
"intercom_assign_conversation",
20+
"intercom_list_teams",
21+
],
22+
required=True,
23+
startup_required=False,
24+
help_url=(
25+
"https://developers.intercom.com/docs/build-an-integration/learn-more/authentication"
26+
),
27+
description=(
28+
"Intercom access token (Settings > Integrations"
29+
" > Developer Hub > Your App > Authentication)"
30+
),
31+
# Auth method support
32+
aden_supported=False,
33+
direct_api_key_supported=True,
34+
api_key_instructions="""To get an Intercom access token:
35+
1. Go to https://app.intercom.com
36+
2. Navigate to Settings > Integrations > Developer Hub
37+
3. Click "New app" (or select an existing app)
38+
4. Go to the "Authentication" tab
39+
5. Copy the access token
40+
6. Required scopes: Read and write conversations, \
41+
Read contacts, Read and write tags, Read admins""",
42+
# Health check configuration
43+
health_check_endpoint="https://api.intercom.io/me",
44+
health_check_method="GET",
45+
# Credential store mapping
46+
credential_id="intercom",
47+
credential_key="access_token",
48+
),
49+
}

tools/src/aden_tools/tools/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from .google_maps_tool import register_tools as register_google_maps
6060
from .http_headers_scanner import register_tools as register_http_headers_scanner
6161
from .hubspot_tool import register_tools as register_hubspot
62+
from .intercom_tool import register_tools as register_intercom
6263
from .news_tool import register_tools as register_news
6364
from .pdf_read_tool import register_tools as register_pdf_read
6465
from .port_scanner import register_tools as register_port_scanner
@@ -115,6 +116,7 @@ def register_all_tools(
115116
# Gmail inbox management (read, trash, modify labels)
116117
register_gmail(mcp, credentials=credentials)
117118
register_hubspot(mcp, credentials=credentials)
119+
register_intercom(mcp, credentials=credentials)
118120
register_apollo(mcp, credentials=credentials)
119121
register_bigquery(mcp, credentials=credentials)
120122
register_calcom(mcp, credentials=credentials)
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Intercom Tool
2+
3+
Customer messaging, conversations, and support automation via the Intercom API (v2.11).
4+
5+
## Setup
6+
7+
### 1. Get an Access Token
8+
9+
1. Log in to your [Intercom Developer Hub](https://app.intercom.com/a/apps/_/developer-hub)
10+
2. Create or select an app
11+
3. Go to **Authentication** and copy the access token
12+
4. Ensure the app has the required scopes for the tools you need (e.g., `Read and List conversations`, `Manage conversations`, `Read and Write contacts`)
13+
14+
### 2. Configure the Token
15+
16+
Set the environment variable:
17+
18+
```bash
19+
export INTERCOM_ACCESS_TOKEN="your-access-token-here"
20+
```
21+
22+
Or configure via the Hive credential store.
23+
24+
## Tools (8 Total)
25+
26+
### Conversations (2)
27+
28+
| Tool | Description |
29+
|------|-------------|
30+
| `intercom_search_conversations` | Search conversations with filters (status, assignee, tag, date) |
31+
| `intercom_get_conversation` | Get full conversation details including message history |
32+
33+
### Contacts (2)
34+
35+
| Tool | Description |
36+
|------|-------------|
37+
| `intercom_get_contact` | Get a contact by ID or email |
38+
| `intercom_search_contacts` | Search contacts by email, name, or custom attributes |
39+
40+
### Notes, Tags & Assignment (3)
41+
42+
| Tool | Description |
43+
|------|-------------|
44+
| `intercom_add_note` | Add an internal note to a conversation |
45+
| `intercom_add_tag` | Add a tag to a conversation or contact |
46+
| `intercom_assign_conversation` | Assign a conversation to an admin or team |
47+
48+
### Teams (1)
49+
50+
| Tool | Description |
51+
|------|-------------|
52+
| `intercom_list_teams` | List available teams for conversation routing |
53+
54+
## Usage Examples
55+
56+
```python
57+
# Search open conversations
58+
intercom_search_conversations(status="open", limit=10)
59+
60+
# Get full conversation details
61+
intercom_get_conversation(conversation_id="12345")
62+
63+
# Find a contact by email
64+
intercom_get_contact(email="jane@example.com")
65+
66+
# Add an internal note
67+
intercom_add_note(conversation_id="12345", body="Escalating to engineering")
68+
69+
# Tag a conversation
70+
intercom_add_tag(name="VIP", conversation_id="12345")
71+
72+
# Assign to a team
73+
intercom_assign_conversation(
74+
conversation_id="12345",
75+
assignee_id="67890",
76+
assignee_type="team",
77+
body="Routing to billing team"
78+
)
79+
80+
# List available teams
81+
intercom_list_teams()
82+
```
83+
84+
## Error Handling
85+
86+
All tools return error dictionaries on failure:
87+
88+
```python
89+
{"error": "Intercom credentials not configured", "help": "Set INTERCOM_ACCESS_TOKEN..."}
90+
{"error": "Invalid or expired Intercom access token"}
91+
{"error": "Insufficient permissions. Check your Intercom app scopes."}
92+
{"error": "Resource not found"}
93+
{"error": "Intercom rate limit exceeded. Try again later."}
94+
{"error": "Request timed out"}
95+
```
96+
97+
## References
98+
99+
- [Intercom API Documentation](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""
2+
Intercom Tool - Manage conversations, contacts, and tags via Intercom API v2.11.
3+
4+
Supports access token authentication.
5+
"""
6+
7+
from .intercom_tool import register_tools
8+
9+
__all__ = ["register_tools"]

0 commit comments

Comments
 (0)