2

I'm trying to create a segment based on a new merge field of type TEXT that I just created, by using condition_type = TextMerge since it seems to be the only option from their documentation that matches my field: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/#create-post_lists_list_id_segments

However, the description for TextMerge looks identical to EmailAddress. To be more specific they both apply only for the EMAIL / MERGE0 field.

TextMerge vs EmailAddress

I tried the following combinations for 'conditions':

{
    'condition_type': 'TextMerge',
    'field': 'EVENTS',
    'op': 'contains',
    'value': 'test'
}

and

{
    'condition_type': 'TextMerge',
    'field': 'EMAIL',
    'op': 'contains',
    'value': 'test'
}

The first one returns an error:

{
    "type":"http:\/\/developer.mailchimp.com\/documentation\/mailchimp\/guides\/error-glossary\/",
    "title":"Invalid Resource",
    "status":400,
    "detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
    "instance":"",
    "errors":
    [
        {
            "field":"options.conditions.item:0",
            "message":"Data did not match any of the schemas described in anyOf."
        }
    ]
}

The second one works.

My question is: how can I create a segment based on a custom merge field of type TEXT? To me this looks like a bug from their side. Did anyone else have this problem? Does anyone have a solution?

  • Can you add the complete error response? It should be a json with `errors` as an array. – ekad Jan 13 '17 at 16:20
  • Yes, I added it, but it doesn't contain any relevant information. – Gabriela Raducan Jan 16 '17 at 10:16
  • The only way I can get the exact same response as you is if `condition_type` or `op` has an invalid value, or both `condition_type` and `op` have invalid values. For example `condition_type` is `TextMerge2` or `op` is `contains2`. Based on your `conditions` parameter, looks like this is the problem: `'op: 'contains'`, are you sure it's not a typo? It should be `'op': 'contains'` (notice the quote after `op`). – ekad Jan 16 '17 at 11:22
  • :) I manually wrote that in here. No typos in the code. As I said, if I change the field to EMAIL it works. Did you successfully create a segment based on a text field? – Gabriela Raducan Jan 16 '17 at 12:07
  • Yes I actually did using c#. What technology are you using to make the request? curl, php, c#, python, or something else? – ekad Jan 16 '17 at 13:40
  • I envy you. I'm using PHP. – Gabriela Raducan Jan 16 '17 at 14:50
  • You should add your php code to your question and add [php] tag so hopefully other people with php skills could help. If you're using some kind of php wrapper, then it's possible that the wrapper messes the request body somehow since I could successfully create the segment using c#. You could also contact MailChimp support team, just to make sure that this is not a bug from their end. – ekad Jan 16 '17 at 15:01
  • Will do. Thank you. I already posted a question to the MC team. – Gabriela Raducan Jan 17 '17 at 14:37
  • @GabrielaRaducan Did you ever resolve this? – AlxVallejo Mar 15 '18 at 14:46
  • @AlxVallejo , no. I had to find another solution for my problem because MC team never answered and the bug was never fixed.. or at least not while I was working on that. – Gabriela Raducan Mar 16 '18 at 15:19

1 Answers1

0

I finally managed to solve my issue specific to TEXT fields in my mailchimp audience merge tags.

Apparently, when adding a TEXT field, it defaults to a maximum size of 25 characters. I was trying to put more text than that into it. It fails with the error:

@body={
  "title"=>"Invalid Resource",
  "status"=>400,
  "detail"=>"The resource submitted could not be validated. For field-specific details, see the 'errors' array.",
  "errors"=>[{"field"=>"merge_fields.MMERGE_16",
  "message"=>"Data did not match any of the schemas described in anyOf."}]
}

I increased the field size to 255 via Mailchimp's API.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
tolgap
  • 9,629
  • 10
  • 51
  • 65