Setup Campaign from Microplan

Overview

The "Setup Campaign" feature facilitates the creation of a campaign using an approved microplan. It ensures that only authorized users can initiate the setup process, generates required campaign data, and integrates with external APIs to fetch user, facility, and target data.

. User Role Validation

  • Role Required: MICROPLAN_CAMPAIGN_INTEGRATOR

  • Validation Logic:

    • Only users with the above role can select an approved microplan to initiate the campaign setup.

    • If the user lacks the role, access to the feature is denied with a proper error message.

Campaign Object Creation

  • Input: Approved microplan object.

  • Steps:

    1. Extract the base campaign object from the selected microplan.

    2. Create a new campaign object by cloning the base campaign object with the following updates:

      • Add unique identifiers (campaignId, createdBy).

      • Set the campaign status to draft.

    3. Save the new campaign object to the backend.

Generate Empty Templates

  • Trigger: After updating the campaign object with selected boundaries, it gets auto-generated from Backend

  • Steps:

    1. Automatically generate empty templates for the campaign, including:

      • User assignments.

      • Facility data placeholders.

      • Target data placeholders.

Fetch Data from Microplan API

  • API Endpoint: project-factory/v1/project-type/fetch-from-microplan

  • Steps:

    1. Call the Microplan API to fetch:

      • User data.

      • Facility data.

      • Target data.

    2. Populate the empty templates with the fetched data.

    3. Save the updated templates back to the backend.

Campaign Search Polling

  • Purpose: Monitor the progress of data population and transition to the next step once completed.

  • Steps:

    1. The UI triggers a periodic call to the campaignSearch endpoint:

      • API Endpoint: /campaign-search

      • Parameters: campaignId.

    2. Check the status of the campaign:

      • If Completed:

        • Navigate the user to the Setup Campaign page.

      • If In Progress:

        • Re-trigger the data fetch from Microplan API to ensure completion.

        • Continue polling.

  • Steps:

    1. Transition the user to the Setup Campaign page.

    2. Pass the necessary campaign data as route parameters or via state management.

API Details:

Action (Api details)
Role

project-factory/v1/project-type/fetch-from-microplan

MICROPLAN_CAMPAIGN_INTEGRATOR

project-factory/v1/project-type/search

CAMPAIGN_MANAGER

project-factory/v1/project-type/create

CAMPAIGN_MANAGER

project-factory/v1/project-type/update

CAMPAIGN_MANAGER

project-factory/v1/data/_download

CAMPAIGN_MANAGER

Last updated

All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.