feat: allow specifying channel roles for members in campaigns #1644
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CLA
Description of the changes, What, Why and How?
The CreateCampaign endpoint allows to specify a channel template that applies to newly create channels. This template can also contain a list of user IDs that should be added to these channels as members. A customer requested that they also want to be able to specify specific channel roles for these members, so they are not added with the default channel_member role.
I've been working on the corresponding changes on the backend, so that it accepts lists of user IDs as well as objects in a backward-compatible way to accommodate the existing usage of CreateCampaign:
This PR updates the types used in the
createCampaignandgetCampaignmethods to allow the new object array form, as well as the user ID array form.One concern I have is that this is in theory a breaking change for the
getCampaignmethod, as the type for members changes fromstring[]tostring[] | CampaignChannelMember[]. I implemented the backend changes in such a way that GetCampaign preserves the format of members that was supplied in CreateCampaign. A customer that passed a user ID array when creating the campaign, will still get an array back. However, it might still lead to breaking changes because the members property can now also beCampaignChannelMember[]. What's the best way to deal with this? Release this in the next major release? Implement the feature in a different way?Changelog