Skip to content

Dynamic campaign audience - #2695

Open
adelowo wants to merge 6 commits into
mainfrom
feat-ISS-2676
Open

Dynamic campaign audience#2695
adelowo wants to merge 6 commits into
mainfrom
feat-ISS-2676

Conversation

@adelowo

@adelowo adelowo commented Aug 11, 2026

Copy link
Copy Markdown
Member

Dynamic audience

mutation($input: CreateAudienceInput!) {
  createAudience(input: $input) {
    audience {
      id
      audienceType
    }
  }
}

  {
    "input": {
      "name": "All Contacts with an existing email",
      "description": "All contacts with an email address",
      "audienceType": "DYNAMIC",
      "filters": {
        "selectors": [
          {
            "schema": "contact",
            "where": "target.email != ''"
          }
        ]
      }
    }
  }
  {
    "input": {
      "name": "Openlane and Google Contacts",
      "description": "Contacts at Openlane or Google Cloud",
      "audienceType": "DYNAMIC",
      "filters": {
        "selectors": [
          {
            "schema": "contact",
            "expression": "target.company == 'Openlane'"
          },
          {
            "schema": "contact",
            "expression": "target.company == 'Google Cloud'"
          }
        ]
      }
    }
  }

Manual audience where they are defined upfront


mutation($input: CreateAudienceMemberInput!) {
  createAudienceMember(input: $input) {
    audienceMember {
      id
    }
  }
}

{
  "input": {
    "audienceType" : "MANUAL" or dynamc,
    "name": "Employee group 1",
    "description" : "employees of fictional company"
  }
}

@github-actions github-actions Bot added the cli label Aug 25, 2026
@adelowo
adelowo marked this pull request as ready for review August 26, 2026 10:54
@adelowo
adelowo requested a review from a team as a code owner August 26, 2026 10:54
@adelowo adelowo changed the title Dynamic campagain audience Dynamic campaign audience Aug 26, 2026
@@ -26,6 +26,17 @@ extend type organization
define asset_creator: [group#member]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in roles, add audience to the campaign_manager role

Comment thread fga/model/automation/assessments.fga Outdated
Comment on lines +70 to +73
field.String("email").
Comment("the email address for this audience member").
NotEmpty().
Annotations(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doe this have to be not empty? Can't it be from one of the edges?

func HookAudienceValidateFilters() ent.Hook {
return hook.On(func(next ent.Mutator) ent.Mutator {
return hook.AudienceFunc(func(ctx context.Context, m *generated.AudienceMutation) (generated.Value, error) {
audienceTyp, err := getAudienceType(ctx, m)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to make sure this isn't a soft delete first and if so, skip the hook

filters map[string]any
}

func snapshotCampaignAudiences(ctx context.Context, db *generated.Client, camp *generated.Campaign) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to combine the trust center subscribers to use this code so we can follow the same pattern?

Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Lanre Adelowo <adelowomailbox@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
13.1% Coverage on New Code (required ≥ 20%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants