Skip to content

Commit

Permalink
[Iterable Lists] - STRATCONN-4357 - Fixing "Additional traits or iden…
Browse files Browse the repository at this point in the history
…tifiers must be a string but it was an object." error in Iterable Lists. (#2541)

* Fixing "Additional traits or identifiers must be a string but it was an object." error in Iterable Lists.

* Updating generated types.

* Updating data fields description.

* updating generated types

---------

Co-authored-by: Joe Ayoub <[email protected]>
  • Loading branch information
seg-leonelsanches and joe-ayoub-segment authored Nov 12, 2024
1 parent 987ad64 commit 491ae8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.

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 @@ -35,9 +35,9 @@ const action: ActionDefinition<Settings, Payload, AudienceSettings> = {
dataFields: {
label: 'Additional traits or identifiers',
description:
'Comma delimited list containing names of additional traits or identifiers to sync to Iterable. You will need to ensure these traits or obects are included via Event Settings >> Customized Setup.',
'Additional traits or identifiers to sync to Iterable. You will need to ensure these traits or objects are included via Event Settings > Customized Setup.',
required: false,
type: 'string'
type: 'object'
},
traitsOrProperties: {
label: 'Traits or Properties',
Expand All @@ -55,7 +55,7 @@ const action: ActionDefinition<Settings, Payload, AudienceSettings> = {
},
segmentAudienceKey: {
label: 'Segment Audience Key',
description: 'Segment Audience Key. Maps to the "Name" of the Segment node in Yahoo taxonomy',
description: 'Segment Audience Key. Maps to the Iterable List "Name" when the list is created in Iterable.',
type: 'string',
unsafe_hidden: true,
required: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export class IterableListsClient {
if (payload.traitsOrProperties[payload.segmentAudienceKey] === true) {
const subscriber = {
email: payload?.email ?? undefined,
dataFields: payload?.dataFields?.split(',').reduce((acc: { [key: string]: unknown }, item: string) => {
acc[item.trim()] = payload.traitsOrProperties[item.trim()]
return acc
}, {}),
userId: payload?.userId ?? undefined,
preferUserId: true
} as Subscriber

if (payload?.dataFields) {
subscriber.dataFields = payload.dataFields as Record<string, null | boolean | string | number | object>
}

if (subscribersGroup.has(listId)) {
subscribersGroup.get(listId)?.push(subscriber)
} else {
Expand Down

0 comments on commit 491ae8d

Please sign in to comment.