In Pushwoosh I have to configure over 200 presets in 3 environments(test, UAT, and Production). Is there a way to export and import presets?
It would be too time-consuming if I have to manually create them in each environment.
There is a couple of ways to clone presets programmatically.
Open API
This way is preferrable if you'd like to clone presets across different accounts.
1.1. Obtain the list of presets via listPresets API
1.2. Filter the list (if needed)
1.3. For each preset that you'd like to clone, obtain preset information using getPreset API
1.4. Prepare mapping of properties as per the guide
1.5. Create new presets at target account using createPreset API
If your preferred scripting language is Python, you may use this library for easy access to these API methods.
Internal Browser API
If you want to simply clone presets between two apps/projects of the same account, you may opt to use Javascript macros from this Gist.
This is how you do it:
2.1. Log in to Pushwoosh account where you want to clone presets/events
2.2. Make sure that DESTINATION app has all platforms configured, that are selected in presets
2.3. Make sure the Max Presets limit of your account would allow the total number of presets to be created.
2.4. Open the Console of your browser where you logged in to your Pushwoosh account
Set up HOST variable to point to your dedicated server. E.g. if your dedicated server address is subdomain.pushwoosh.com, you should do the following:
type const HOST="subdomain"; and press Enter
If your account is on go.pushwoosh.com, set the HOST variable to "go".
2.5. Copy-paste contents of migrate-presets-events.js to Console and hit Enter.
2.6. Now launch command to migrate all presets from SRC to DST:
await migrate_presets('SRC_APP_CODE', 'DST_APP_CODE');
If either of methods looks challenging, feel free to contact our support for assistance: help@pushwoosh.com