Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option mapping field for messageId in segment profiles #1942

Merged
merged 11 commits into from
Apr 23, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "cZE8HyAL0!BF#)WQb^",
"timestamp": "2021-02-01T00:00:00.000Z",
"traits": Object {
"testType": "cZE8HyAL0!BF#)WQb^",
Expand All @@ -33,6 +34,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "cZE8HyAL0!BF#)WQb^",
"timestamp": undefined,
"traits": Object {},
"type": "group",
Expand All @@ -54,6 +56,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "hIC1OAmWa[Q!&d%o",
"timestamp": "2021-02-01T00:00:00.000Z",
"traits": Object {
"testType": "hIC1OAmWa[Q!&d%o",
Expand All @@ -77,6 +80,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "hIC1OAmWa[Q!&d%o",
"timestamp": undefined,
"traits": Object {},
"type": "identify",
Expand Down Expand Up @@ -126,6 +130,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": undefined,
"traits": Object {},
"type": "identify",
Expand Down Expand Up @@ -175,6 +180,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": undefined,
"traits": Object {},
"type": "identify",
Expand All @@ -196,6 +202,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "[2uovRzxThJj",
"properties": Object {
"testType": "[2uovRzxThJj",
},
Expand All @@ -219,6 +226,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "[2uovRzxThJj",
"properties": Object {},
"timestamp": undefined,
"type": "track",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export const timestamp: InputField = {
}
}

export const message_id: InputField = {
type: 'string',
label: 'MessageId',
description: 'The Segment messageId.',
default: { '@path': '$.messageId' },
unsafe_hidden: true
}

export const event_name: InputField = {
label: 'Event Name',
description: 'Name of the action that a user has performed.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": "2023-09-26T09:46:28.290Z",
"traits": Object {
"industry": "Technology",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "tKaa(2A",
"timestamp": "2021-02-01T00:00:00.000Z",
"traits": Object {
"testType": "tKaa(2A",
Expand All @@ -33,6 +34,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "tKaa(2A",
"timestamp": undefined,
"traits": Object {},
"type": "group",
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
@@ -1,7 +1,7 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { user_id, anonymous_id, group_id, traits, engage_space, timestamp } from '../segment-properties'
import { user_id, anonymous_id, group_id, traits, engage_space, timestamp, message_id } from '../segment-properties'
import { MissingUserOrAnonymousIdThrowableError } from '../errors'

const action: ActionDefinition<Settings, Payload> = {
Expand All @@ -14,7 +14,8 @@ const action: ActionDefinition<Settings, Payload> = {
anonymous_id,
group_id: { ...group_id, required: true },
traits,
timestamp
timestamp,
message_id
},
perform: (_request, { payload, statsContext }) => {
if (!payload.anonymous_id && !payload.user_id) {
Expand All @@ -24,6 +25,7 @@ const action: ActionDefinition<Settings, Payload> = {
userId: payload?.user_id,
anonymousId: payload?.anonymous_id,
groupId: payload?.group_id,
messageId: payload?.message_id,
traits: {
...payload?.traits
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": "2023-09-26T09:46:28.290Z",
"traits": Object {
"email": "test-user@test-company.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "mV[ZQcEVgZO$MX",
"timestamp": "2021-02-01T00:00:00.000Z",
"traits": Object {
"testType": "mV[ZQcEVgZO$MX",
Expand All @@ -33,6 +34,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": "mV[ZQcEVgZO$MX",
"timestamp": undefined,
"traits": Object {},
"type": "identify",
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
@@ -1,7 +1,7 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { user_id, anonymous_id, group_id, traits, engage_space, timestamp } from '../segment-properties'
import { user_id, anonymous_id, group_id, traits, engage_space, timestamp, message_id } from '../segment-properties'
import { MissingUserOrAnonymousIdThrowableError } from '../errors'

const action: ActionDefinition<Settings, Payload> = {
Expand All @@ -15,7 +15,8 @@ const action: ActionDefinition<Settings, Payload> = {
anonymous_id,
group_id,
traits,
timestamp
timestamp,
message_id
},
perform: (_request, { payload, statsContext }) => {
if (!payload.anonymous_id && !payload.user_id) {
Expand All @@ -25,6 +26,7 @@ const action: ActionDefinition<Settings, Payload> = {
userId: payload?.user_id,
anonymousId: payload?.anonymous_id,
groupId: payload?.group_id,
messageId: payload?.message_id,
traits: {
...payload?.traits
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": "2023-10-10T07:24:07.036Z",
"traits": Object {
"email": "test-user@test-company.com",
Expand Down Expand Up @@ -113,6 +114,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": "2023-10-10T07:24:07.036Z",
"traits": Object {
"email": "test-user@test-company.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": undefined,
"traits": Object {},
"type": "identify",
Expand Down Expand Up @@ -128,6 +129,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"timestamp": undefined,
"traits": Object {},
"type": "identify",
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 @@ -15,7 +15,8 @@ import {
android_push_token,
android_push_subscription_status,
ios_push_subscription_status,
ios_push_token
ios_push_token,
message_id
} from './subscription-properties'
import {
InvalidSubscriptionStatusError,
Expand Down Expand Up @@ -278,7 +279,8 @@ const action: ActionDefinition<Settings, Payload> = {
ios_push_token,
ios_push_subscription_status,
traits,
timestamp
timestamp,
message_id
},
perform: (_request, { payload, statsContext }) => {
const statsClient = statsContext?.statsClient
Expand Down Expand Up @@ -308,6 +310,7 @@ const action: ActionDefinition<Settings, Payload> = {
// to any destinations which is connected to the Segment Profiles space
All: false
},
messageId: payload?.message_id,
type: 'identify'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,11 @@ export const subscription_groups: InputField = {
additionalProperties: true,
defaultObjectUI: 'keyvalue'
}

export const message_id: InputField = {
type: 'string',
label: 'MessageId',
description: 'The Segment messageId.',
default: { '@path': '$.messageId' },
unsafe_hidden: true
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Object {
"integrations": Object {
"All": false,
},
"messageId": undefined,
"properties": Object {
"plan": "Business",
},
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
@@ -1,7 +1,16 @@
import type { ActionDefinition } from '@segment/actions-core'
import type { Settings } from '../generated-types'
import type { Payload } from './generated-types'
import { user_id, anonymous_id, timestamp, event_name, group_id, properties, engage_space } from '../segment-properties'
import {
user_id,
anonymous_id,
timestamp,
event_name,
group_id,
properties,
engage_space,
message_id
} from '../segment-properties'
import { MissingUserOrAnonymousIdThrowableError } from '../errors'

const action: ActionDefinition<Settings, Payload> = {
Expand All @@ -14,7 +23,8 @@ const action: ActionDefinition<Settings, Payload> = {
timestamp,
event_name,
group_id,
properties
properties,
message_id
},
perform: (_, { payload, statsContext }) => {
if (!payload.anonymous_id && !payload.user_id) {
Expand All @@ -29,6 +39,7 @@ const action: ActionDefinition<Settings, Payload> = {
anonymousId: payload?.anonymous_id,
timestamp: payload?.timestamp,
event: payload?.event_name,
messageId: payload?.message_id,
integrations: {
// Setting 'integrations.All' to false will ensure that we don't send events
// to any destinations which is connected to the Segment Profiles space.
Expand Down
Loading