Unexpected conversion of array to object on message.to property of an "send" step in an automation template

Hi all,

Thanks for the forum! this is my first post, and a ask for help. :slight_smile:

I’m attempting to send a notification to a list of users returned on a fetch-data step. But I’m not getting the expected behavior.

After some testing I could reproduce the issue with a minimal automation template.

A template like this:

{
    "steps": [
        {
            "action": "send",
            "message": {
                "to": [
                    {
                        "user_id": "1"
                    },
                    {
                        "user_id": "2"
                    }
                ],
                "template": "1"
            }
        }
    ]
}'

will yield message invocations like this:

{
  "message": {
    "template": "1",
    "to": {
      "0": {
        "user_id": "1"
      },
      "1": {
        "user_id": "2"
      }
    }
  }
}

// instead of the expected format according to the documentation:

{
  "message": {
    "template": "1",
    "to": [
      { "user_id": "1" },
      { "user_id": "2" }
    ]
  }
}

Since on this documentation its pointing to the message format of the 2.0 API i expected it to make the proper type conversion. Since the message api supports a Recipient List as a parameter.

Questions:

  • Is this the expected behavior? If so, is there any other way to use the Automation Run Cache information to send a message to multiple users inside an automation template? ? If it’s not the expected behavior, where can I track the bug status?

Alternative solution ideas:

  • Synchronize a recipient list through lists endpoint. (wanting to avoid expending development resources on this for now)
  • Do not use automation triggers to run my automation and generate the template with one “send” step for recipient. (avoiding due to also expending resources)
  • Attempted to replace the entire “message” property for a $ref, but the template validation rejects this format with the error that “template” property is required.

to the team, thanks for the awesome product. to the forum, thanks to having me!

bonus: message ID for reference debugging: Kr6X4aypq5iGgNCBwC9Qg

bump

Hey there @pickachu

Thanks for reaching out and for waiting. Looks like this one slipped through the cracks, so I appreciate your patience.

My hunch on this is it could be a bug in how we pull things from automation step worker onto the send pipeline while converting.

I’ve escalated this issue internally with my team so we could take a closer look.

Side note, as our developer community grows, our Discord Community space now has a forum section for questions, bug reports, and any feedback users may have. Our Courier team will be available to help answer questions and update you on new updates as well as any upcoming hackathons. I invite you to join if you haven’t already. :slightly_smiling_face:

I’ll circle back once we pinpoint the cause of this issue. Thanks!