marcoh
May 19, 2025, 2:37pm
41
Would love to be one of the testers
Hi there marcoh, thanks for your response, I’ll send you a PM with the details
Thanks, David
Hi all, quick update for everyone. We are very close to completing the campaign import and export features now. All the bug fixes have now been completed and we are awaiting final reviews and the code to be merged into version 7 of Mautic. If you’d like to keep track of what we are doing on the project please have a look at my weekly updates here: https://community.mautic.org/assemblies/campaign-library/f/96/posts
As always I’m happy to answer questions here or via PM.
Thanks
David
Hi everyone!
The PR for this feature is in the final stages of review, we’d love a couple of reviews if you have time.
7.x
← levente999:campaign-library-CL-34
opened 12:21PM - 27 Jan 25 UTC
| Q | A
| --------------------------------… ------ | ---
| Bug fix? (use the a.b branch) | 🔴
| New feature/enhancement? (use the a.x branch) | 🟢
| Deprecations? | 🔴
| BC breaks? (use the c.x branch) | 🔴
| Automated tests included? | 🔴
| User documentation | https://github.com/mautic/user-documentation/pull/361
| Developer documentation | https://github.com/mautic/developer-documentation-new/pull/242
## Description
This proof of concept (PoC) implements the Campaign Library feature, focusing on the export and import of a single campaign entity without involving the UI. The goal is to demonstrate the core functionality of exporting and importing campaign data in a streamlined manner.
---
### 📋 Steps to test this PR:
#### 1. **Exporting Campaigns**
Use the following commands to export campaigns:
- Export campaign data in JSON format only:
```bash
ddev exec bin/console mautic:entity:export --entity=campaign --id=1,2,3 --json-only
```
- Export campaign data as a ZIP file:
```bash
ddev exec bin/console mautic:entity:export --entity=campaign --id=1,2,3 --zip-file
```
- Export campaign data as a JSON file:
```bash
ddev exec bin/console mautic:entity:export --entity=campaign --id=1,2,3 --json-file
```
- File name: campaign_data.zip, campaign_data.json
The output files will be stored in the Docker container's temporary directory (`/tmp`). To access these files on your system, use the following commands to copy them to a local directory:
```bash
docker cp ddev-mautic-web:/tmp/campaign_data.zip ../mautic/campaign_data.zip
docker cp ddev-mautic-web:/tmp/campaign_data.json ../mautic/campaign_data.json
```
#### 2. **Importing Campaigns**
To import the exported campaign data, use the following command:
```bash
ddev exec bin/console mautic:entity:import --entity=campaign --file=campaign_data.zip --user=1
```
**Note:** Before running the import command, the required files must be copied to the Docker container's temporary directory. Use the following commands to copy the files into the container:
```bash
docker cp ./campaign_data.zip ddev-mautic-web:/tmp/campaign_data.zip
docker cp ./campaign_data.json ddev-mautic-web:/tmp/campaign_data.json
```
#### 3. **Verification**
- Verify that the campaign data is correctly exported by inspecting the JSON and ZIP files in the system directory.
- Ensure that the imported campaign data is successfully reflected in Mautic.
### 🚀 Expected Results:
- Export commands generate the appropriate files in the Docker container's temporary directory.
- Import commands successfully import the exported campaign data into the system.
- No errors are encountered during the export or import process.
### 🚀 Jira Ticket:
https://mautic.atlassian.net/browse/CL-34
Thanks!
2 Likes