Skip to content

Migrate to API 2.15#1

Merged
lborie merged 2 commits intov2from
215
Feb 12, 2026
Merged

Migrate to API 2.15#1
lborie merged 2 commits intov2from
215

Conversation

@lborie
Copy link
Copy Markdown
Member

@lborie lborie commented Feb 12, 2026

This pull request updates the Intercom Go client to support the latest API changes, with a particular focus on unifying Users and Leads into a single Contact model, modernizing documentation, and adding support for Articles and Collections. The README has been extensively rewritten to reflect these changes, and new code has been introduced to support Articles in the SDK.

Major updates include:

Contact Model & API Alignment

  • Unified Users and Leads into a single Contact model throughout the README and usage examples, reflecting Intercom API v2.15 changes. All user-related operations are now demonstrated using Contact methods, and references to Users/Leads have been removed or updated.
  • Updated company association and tag examples to use Contacts instead of Users, and clarified company-listing and tagging operations. [1] [2]

Article & Collection Support

  • Added new ArticleService, Article, and ArticleRepository types for managing Help Center articles, including list and find operations. [1] [2]
  • Documented new usage examples for listing and finding Articles and Collections, including support for hierarchical collections.

Documentation Modernization

  • Updated the installation instructions to use the new module path (github.com/karnott/intercom-go) and removed references to deprecated Docker images and old import paths.
  • Rewrote and reorganized the README for clarity, reflecting current API fields, method names, pagination, and error handling. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Admin Model Improvements

  • Added Avatar and TeamPriorityLevel fields to the Admin struct for richer admin representation.

Miscellaneous Fixes

  • Fixed a test in admin_test.go to properly check for email presence in admin addresses.
  • Corrected minor typos and improved consistency in code examples and comments. [1] [2] [3]

These changes bring the SDK up to date with Intercom's latest API structure and improve both usability and maintainability for future development.

@lborie lborie requested a review from Copilot February 12, 2026 14:53
@lborie lborie merged commit 178727f into v2 Feb 12, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request migrates the Intercom Go SDK from an older API version to v2.15, implementing significant architectural changes to align with Intercom's latest API structure. The migration unifies the previously separate User and Lead models into a single Contact model, adds support for Articles and Collections in the Help Center, modernizes authentication from AppID/APIKey to Access Token (Bearer), and updates all documentation and examples accordingly.

Changes:

  • Unified Users and Leads into a single Contact model with a role field, removing all User/Lead-specific code and updating all references throughout the codebase
  • Added complete support for Articles and Collections, including new service layers, repositories, API clients, tests, and example command-line tool
  • Modernized authentication to use Access Token (Bearer) instead of AppID/APIKey, updated HTTP client to include Intercom-Version header, and updated all documentation

Reviewed changes

Copilot reviewed 57 out of 59 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
go.mod Adds Go module definition with dependencies
go.sum Adds dependency checksums
intercom.go Updates client initialization to use AccessToken, adds Article and Collection services, removes User service
interfaces/http_client.go Updates authentication to Bearer tokens, adds Intercom-Version header, removes AppID/APIKey fields
contact.go, contact_api.go, contact_test.go, contact_api_test.go Updates Contact model with new API v2.15 fields, removes User-to-Contact conversion, adds merge/archive/unarchive operations
user.go, user_api.go, user_test.go, user_api_test.go Deleted - User model replaced by Contact
article.go, article_api.go, article_test.go, article_api_test.go New - Adds Article support with list and find operations
collection.go, collection_api.go, collection_test.go, collection_api_test.go New - Adds Collection support with hierarchical structure via ParentID
cmd/articles/main.go New - Example tool to export articles and collections to JSON
conversation.go Updates to use Contacts instead of User, adds new fields (Title, AdminAssigneeID, etc.)
message.go Updates to remove UserID from MessageAddress, renames NewUserMessage to NewContactMessage
notification.go Updates to handle contact-related webhook topics instead of user topics
company.go, company_api.go Updates Company model with new fields (Size, Website, Industry), renames ListUsers to ListContacts
request_company_mapper.go New - Replaces requestUserMapper.go with ContactCompany type and helpers
requestUserMapper.go Deleted - Replaced by request_company_mapper.go
page.go Adds CursorPages and StartingAfterParam for cursor-based pagination
reply.go Removes UserID field
admin.go, admin_test.go Adds Avatar and TeamPriorityLevel fields, fixes test to check Email properly
segment_api_test.go Updates test error handling to use t.Fatal instead of t.Fatalf(err.Error())
job_api.go, job_item.go, job_test.go, job_api_test.go Updates Job API to work with Contacts, renames NewUserJobItem to NewContactJobItem
tagging.go Keeps UserID field for tagging (API still uses this for backwards compatibility)
event.go Keeps UserID field (events still use user_id in API)
doc.go Updates documentation to reflect Contact model and AccessToken authentication
README.md Comprehensive rewrite with updated examples, API v2.15 changes, and current SDK usage patterns
fixtures/*.json Updates all fixtures to match API v2.15 response format

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/articles/main.go
Comment on lines +71 to +83
parentID := strconv.FormatInt(a.ParentID, 10)
articlesByParent[parentID] = append(articlesByParent[parentID], ea)
}

// Build the tree
tree := make([]ExportCollection, 0, len(topLevel))
for _, c := range topLevel {
ec := ExportCollection{
ID: c.ID,
Name: c.Name,
Description: c.Description,
URL: c.URL,
Articles: articlesByParent[c.ID],
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code converts Article.ParentID (int64) to string and uses it as a key in articlesByParent (line 71), then later uses Collection.ID (string) to look up articles (line 83). However, the Article fixture shows parent_id as an integer (100) while the Collection fixture shows id as a string ("1"). This type mismatch means the lookup at line 83 articlesByParent[c.ID] may not find articles correctly unless the Collection.ID strings match the string representation of Article.ParentID integers in the actual API data.

Copilot uses AI. Check for mistakes.
Comment thread README.md

```go
msg := intercom.NewEmailMessage(intercom.PERSONAL_TEMPLATE, intercom.Admin{ID: "1234"}, intercom.User{Email: "test@example.com"}, "subject", "body")
msg := intercom.NewEmailMessage(intercom.PERSONAL_TEMPLATE, &intercom.Admin{ID: "1234"}, &intercom.Contact{Email: "test@example.com"}, "subject", "body")
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Admin struct has ID field of type json.Number, but the README example shows constructing an Admin with a string literal: &intercom.Admin{ID: "1234"}. This would cause a compilation error. The example should use json.Number("1234") instead, or demonstrate using the Admin returned from the API.

Copilot uses AI. Check for mistakes.
Comment thread README.md

```go
msg := intercom.NewInAppMessage(intercom.Admin{ID: "1234"}, intercom.Contact{Email: "test@example.com"}, "body")
msg := intercom.NewInAppMessage(&intercom.Admin{ID: "1234"}, &intercom.Contact{Email: "test@example.com"}, "body")
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Admin struct has ID field of type json.Number, but the README example shows constructing an Admin with a string literal: &intercom.Admin{ID: "1234"}. This would cause a compilation error. The example should use json.Number("1234") instead, or demonstrate using the Admin returned from the API.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants