Mailing list support for Loops
Re-do of #2171
@joe-ayoub-segment This includes your suggestion for a better mailing list data format.
- [x] Added unit tests for new functionality
- [x] Tested end-to-end using the local server
- [ ] [Segmenters] Tested in the staging environment
hi @danrowden the change looks fine to me.
CI checks are failing though. Perhaps you could merge our main branch back in to your branch and see if that fixes the issue?
Kind regards, Joe
@joe-ayoub-segment Done!
@joe-ayoub-segment any update here?
@joe-ayoub-segment any update here?
our bad, updating tests
Ok @joe-ayoub-segment we're running into a problem with this approach. We've defined the mailingLists as an array of objects. However, when using the action tester, its creating an object and not an array (of objects):
This works, but it generates an object, not an array of objects:
We're not sure if this is an artifact of the builder or a limitation in Segment where we cannot actually create an array of objects.
If we "fake" it by passing in an array as part of the test event, this also works and passes through an array of objects:
Is this a limitation of the tester or something with how Segment actually works? Will users be able to create an array of objects in the UI or not?
hi @danrowden this is working correctly.
The customer needs to pass an array in the main payload.
We can make this more explicity by adding a default to the field, like this:
mailingLists: {
label: 'Mailing Lists',
description:
'An an array of objects containing key-value pairs of mailing list IDs and true/false determining if the contact should be added to or removed from each list.',
type: 'object',
multiple: true,
required: false,
properties: {
list_id: {
label: 'List ID',
description: 'The ID of the mailing list.',
type: 'string',
required: true
},
value: {
label: 'value',
description:
'true indicates that the user is to be added to the list, false will remove the user from the list.',
type: 'boolean',
required: true
}
},
default: {
'@arrayPath': [
'$.properties.mailing_lists',
{
list_id: {
'@path': '$.id'
},
value: {
'@path': '$.value'
}
}
]
}
},
This will make the UI look something like this:
It makes the customer more aware that the item needs to be an array, and provides some defaults for how the items in the array should be named. The customer can change these mappings though, of course.
hi @danrowden the change looks good - however CI is now failing.
@joe-ayoub-segment I noticed today that we are modelling this on a "track" event but it should be for "identify" events, which don't have properties. I'll chat with @askkaz today about this
This is ready for another look @joe-ayoub-segment
hi @danrowden this PR has been deployed. Please confirm that the change works as expected.