Skip to content

Commit 9060c56

Browse files
authored
Merge pull request #17 from intercom/update/to-api-v2.4
Update/to api v2.4
2 parents 45f4bf8 + d45b416 commit 9060c56

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Circle CI](https://circleci.com/gh/intercom/intercom-node.png?style=shield)](https://circleci.com/gh/intercom/intercom-node)
44
[![npm](https://img.shields.io/npm/v/intercom-client)](https://www.npmjs.com/package/intercom-client)
5-
![Intercom API Version](https://img.shields.io/badge/Intercom%20API%20Version-2.3-blue)
5+
![Intercom API Version](https://img.shields.io/badge/Intercom%20API%20Version-2.4-blue)
66
![Typescript Supported](https://img.shields.io/badge/Typescript-Supported-lightgrey)
77

88
> Official Node bindings to the [Intercom API](https://api.intercom.io/docs)
@@ -11,7 +11,7 @@
1111

1212
### Maintenance
1313

14-
Current repository is a new WIP version of Node SDK, that supports latest API version (v2.3 as of 14/12/2021)
14+
Current repository is a new WIP version of Node SDK, that supports latest API version (v2.4 as of 14/01/2022)
1515

1616
## Installation
1717

@@ -70,7 +70,7 @@ We version our API (see the "Choose Version" section of the [API & Webhooks Refe
7070
const client = new Client({ token: 'my_token' });
7171
client.useRequestOpts({
7272
headers: {
73-
'Intercom-Version': 2.3,
73+
'Intercom-Version': 2.4,
7474
},
7575
});
7676
```

lib/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default class Client {
101101
initiateAxiosInstance(): Axios {
102102
// TO-DO: Revise the params
103103
const defaultHeaders = {
104-
'User-Agent': 'intercom-node-client/2.0.0',
104+
'User-Agent': 'intercom-node-client/3.0.0',
105105
Accept: 'application/json',
106106
};
107107

lib/company.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,20 @@ export default class Company {
5959
industry,
6060
customAttributes,
6161
}: UpdateCompanyData) {
62-
return this.create({
63-
createdAt,
64-
companyId,
62+
const data = {
63+
remote_created_at: createdAt,
6564
name,
66-
monthlySpend,
65+
monthly_spend: monthlySpend,
6766
plan,
6867
size,
6968
website,
7069
industry,
71-
customAttributes,
70+
custom_attributes: customAttributes,
71+
};
72+
73+
return this.client.put<CompanyObject>({
74+
url: `/${this.baseUrl}/${companyId}`,
75+
data,
7276
});
7377
}
7478
find({ companyId, name }: FindCompanyData) {

lib/contact/contact.types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ export interface ContactObject {
4545
tags: AddressableList;
4646
notes: AddressableList;
4747
companies: AddressableList;
48+
referrer: string;
49+
utm_campaign: string | null;
50+
utm_content: string | null;
51+
utm_medium: string | null;
52+
utm_source: string | null;
53+
utm_term: string | null;
4854
}
4955

5056
interface LocationObject {
5157
type: 'location';
5258
country: string;
5359
region: string;
5460
city: string;
61+
country_code: string;
62+
continent_code: string;
5563
}
5664

5765
interface SocialProfileObject {

lib/conversation/conversation.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,5 @@ enum AuthorType {
158158
USER = 'user',
159159
ADMIN = 'admin',
160160
BOT = 'bot',
161+
TEAM = 'team',
161162
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "intercom-client",
3-
"version": "2.11.2",
3+
"version": "3.0.0",
44
"description": "Official Node bindings to the Intercom API",
55
"homepage": "https://github.com/intercom/intercom-node",
66
"bugs:": "https://github.com/intercom/intercom-node/issues",

test/company.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ const dummyCompany = {
2828
custom_attributes: {},
2929
};
3030
describe('companies', () => {
31-
let client: Client;
32-
before(() => {
33-
client = new Client('foo', 'bar');
34-
});
31+
const client = new Client('foo', 'bar');
32+
3533
it('should be created', async () => {
3634
const requestBody = {
3735
remote_created_at: dateToUnixTimestamp(new Date()),
@@ -66,7 +64,6 @@ describe('companies', () => {
6664
it('should be updated', async () => {
6765
const company_id = '46029';
6866
const requestBody = {
69-
company_id,
7067
remote_created_at: dateToUnixTimestamp(new Date()),
7168
name: 'BestCompanyInc.',
7269
monthly_spend: 9001,
@@ -78,7 +75,7 @@ describe('companies', () => {
7875
};
7976

8077
nock('https://api.intercom.io')
81-
.post('/companies', requestBody)
78+
.put(`/companies/${company_id}`, requestBody)
8279
.reply(200, {});
8380

8481
const response = await client.companies.update({

0 commit comments

Comments
 (0)