Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
feat: Use token-based auth with Intercom
Browse files Browse the repository at this point in the history
  • Loading branch information
bradhe committed Jun 23, 2020
1 parent aa4da11 commit ff10479
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions instrumentation/activities/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ type Delegate interface {

// NewIntercomDelegate instantiates a delegate for reporting
// activities to Intercom.
func NewIntercomDelegate(appID, apiKey string) Delegate {
return delegates.NewIntercom(appID, apiKey)
func NewIntercomDelegate(accessToken string) Delegate {
return delegates.NewIntercom(accessToken)
}
11 changes: 9 additions & 2 deletions instrumentation/activities/delegates/intercom.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ func (d *Intercom) Report(act activity.Activity) error {
})
}

func NewIntercom(appID, apiKey string) *Intercom {
func NewIntercom(accessToken string) *Intercom {
// Intercom has changed around how authentication works with their API.
// Historically, they've required an app ID and an API key. They have a new,
// improved system that only requires an access token. To not break the
// relevant interface, they've used this methodology for using an access
// token only.
client := intercom.NewClient(accessToken, "")

return &Intercom{
client: intercom.NewClient(appID, apiKey),
client: client,
}
}

Expand Down

0 comments on commit ff10479

Please sign in to comment.