Updating Segment condition for Campaign on the fly
Closed this issue · 1 comments
Im trying to write a script that takes Campaign and sends it multiple times to different recipients from the List based on Segment Condition. So, every time, I have to update condition (set different value), update FROM and Reply To field for campaign and send it. I'm not able to update condition. I tried to Update ListSegment (by selected SegmentId for Campaign), it updates condition for List, but not for Campaign:
await this.mailChimpManager.ListSegments.UpdateAsync(listId, segmentId, segment).ConfigureAwait(false);
When I'm changing Conditions in Campaign object and updating it, it updates Settings and other Campaign's properties, but doesn't update Segment Conditions.
Please, advise what is the best way to do it?
Thank you!
I found a solution. I need to set all changes to Campaign, get Segment by Id, update condition, save List Segment first and then save Campaign. In this case, everything works fine.
await this.mailChimpManager.ListSegments.UpdateAsync(listId, segmentId, segment).ConfigureAwait(false);
await mailChimpManager.Campaigns.UpdateAsync(id, campaign).ConfigureAwait(false);