mailchimp/Firebase

Conditional member tags

nmazidi opened this issue · 4 comments

Is is possible to use conditional member tags with this extension? I would like to be able to subscribe a user to a tag if a boolean value is true.

Thanks

We'll have a look at how this can be done!

Is the request to have something like this:

{
  "conditionalTags": {
    "MY_TAG_VALUE": "field1"
 }
}

which would result in the tag MY_TAG_VALUE being added if field1 is "truthy", or would it be like this:

{
  "memberTagsV2": [{
    "field": "field1",
    "conditionField": "field2"
 }]
}

which would add a tag of the value of field1 if field2 is "truthy"?

I'm right now trying to figure out a creative way to do this with jmes, is there a better way? I have a field that has either null or a date and I want to give users a tag if it isnt null, but don't want to make the tag the actual date string lol.
Thank you for your help

@Zer0cool360 the best I can think of is re-mapping the "entries" into an array first, and then filtering out the null "values", and returning the keys. Example here: http://play.jmespath.org/?u=ab0390a9-e58b-4e03-a4fc-9d3d460a72bd

Given a body like

{
  "field1": "2020-02-01T01:01:01Z",
  "field2": null
}

A query like this will work:

[{ "key": 'field1', "value": @.field1 }, { "key": 'field2', "value": @.field2 }] | [?value!=null].key

But I understand this is a bit ugly!

Perfect, Thank you @barticus