Skip to content

Commit

Permalink
AAD-427 Fix group call: pass through userId and anonymousId (#2480)
Browse files Browse the repository at this point in the history
  • Loading branch information
accoilmj authored Oct 8, 2024
1 parent 8ca8741 commit 9138562
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`Testing snapshot for actions-accoil-analytics destination: group action - all fields 1`] = `
Object {
"anonymousId": "[t@95I7lqH",
"groupId": "[t@95I7lqH",
"timestamp": Any<String>,
"traits": Object {
Expand All @@ -13,6 +14,7 @@ Object {
"testType": "[t@95I7lqH",
},
"type": "group",
"userId": "[t@95I7lqH",
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`Testing snapshot for AccoilAnalytics's group destination action: all fields 1`] = `
Object {
"anonymousId": "x5]MKB8gueWVltH2",
"groupId": "x5]MKB8gueWVltH2",
"timestamp": Any<String>,
"traits": Object {
Expand All @@ -13,6 +14,7 @@ Object {
"testType": "x5]MKB8gueWVltH2",
},
"type": "group",
"userId": "x5]MKB8gueWVltH2",
}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ describe('AccoilAnalytics.group', () => {
const responses = await testDestination.testAction('group', {
settings: { api_key: 'apikey' },
event: createTestEvent({
userId: 'user1234',
anonymousId: 'anon1234',
groupId: 'group123',
traits: { mrr: 10, plan: 'starter', status: 'trial', createdAt: '2018-01-01T00:00:00.000Z', name: 'Group X' }
}),
Expand All @@ -20,6 +22,8 @@ describe('AccoilAnalytics.group', () => {
expect(responses.length).toBe(1)
expect(responses[0].status).toBe(200)
expect(responses[0].options.body).toMatch(/"type":\s*"group"/g)
expect(responses[0].options.body).toMatch(/"userId":\s*"user1234"/g)
expect(responses[0].options.body).toMatch(/"anonymousId":\s*"anon1234"/g)
expect(responses[0].options.body).toContain('group123')
expect(responses[0].options.body).toContain('Group X')
expect(responses[0].options.body).toContain('starter')
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ const action: ActionDefinition<Settings, Payload> = {
description: 'Identify Accounts (groups) in Accoil',
defaultSubscription: 'type = "group"',
fields: {
anonymousId: {
type: 'string',
description: 'Anonymous id',
label: 'Anonymous ID',
default: { '@path': '$.anonymousId' }
},
userId: {
type: 'string',
description: 'The ID associated with the user',
label: 'User ID',
default: { '@path': '$.userId' }
},
groupId: {
type: 'string',
description: 'The group id',
Expand Down Expand Up @@ -69,6 +81,8 @@ const action: ActionDefinition<Settings, Payload> = {
method: 'post',
json: {
type: 'group',
anonymousId: payload.anonymousId,
userId: payload.userId,
groupId: payload.groupId,
traits: traits,
timestamp: payload.timestamp
Expand Down

0 comments on commit 9138562

Please sign in to comment.