Skip to Content
Uncodie Market Fit está disponible 🎉
Rest APIAgentsGrowthCreate Marketing Campaigns Command

Create Marketing Campaigns Command

Creates a command object to generate optimized marketing campaigns based on monthly budget, business goals, and target audience.

Endpoint

POST /api/agents/growth/campaigns

Request Body

ParameterTypeRequiredDescription
siteIdstringYesID of the website to create campaigns for
agent_idstringNoID of the agent to handle campaign creation
userIdstringNoID of the user creating the campaigns
campaignDataobjectYesObject containing all campaign-specific data

campaignData Object

ParameterTypeRequiredDescription
segmentIdsarrayNoArray of target audience segment IDs

Example Request

{ "siteId": "site_456", "agent_id": "agent_growth_123", "userId": "user_789", "campaignData": { "segmentIds": ["seg_123", "seg_456"] } }

Try It

You can test this API directly using our API Tester interface. The API tester allows you to generate optimized marketing campaigns based on your business parameters.

Required fields:

  • Site ID: The ID of the website to create campaigns for

Optional fields:

  • Agent ID: ID of the agent to handle campaign creation
  • User ID: ID of the user creating the campaigns
  • Segment IDs: Array of target audience segment IDs

API Tester

Este componente te permite probar diferentes endpoints de API.

Generated Command Structure

The system generates a command object with the following structure to control the campaign creation process:

{ "task": "create marketing campaigns", "userId": "user_789", "agentId": "agent_growth_123", "site_id": "site_456", "description": "Generate marketing campaigns for the specified site", "targets": [ { "campaigns": [ { "title": "B2B Lead Generation Campaign", "description": "High-performance search campaign focusing on decision-makers in the B2B software sector", "type": "inbound' | 'outbound' | 'branding' | 'product' | 'events' | 'success' | 'account' | 'community' | 'guerrilla' | 'affiliate' | 'experiential' | 'programmatic' | 'performance' | 'publicRelations" } ] } ], "context": "Campaign Creation Context:\n{\n \"segments\": [\n {\n \"title\": \"B2B Decision Makers\"\n },\n {\n \"title\": \"Enterprise Software Users\"\n }\n ]\n}", "supervisor": [ { "agent_role": "growth_marketer", "status": "not_initialized" }, { "agent_role": "budget_optimizer", "status": "not_initialized" } ] }

Response

Success Response

{ "success": true, "data": { "command_id": "cmd_abc123", "site_id": "site_456", "campaigns": [ { "id": "camp_123abc" }, { "id": "camp_456def" }, { "id": "camp_789ghi" }, { "id": "camp_012jkl" } ], "saved_to_database": true } }

Error Response

{ "success": false, "error": { "code": "INVALID_REQUEST", "message": "Invalid request parameters" } }

Error Codes

CodeDescription
INVALID_REQUESTThe request parameters are invalid
SITE_NOT_FOUNDThe specified site does not exist
SEGMENT_NOT_FOUNDThe specified segment does not exist
USER_NOT_FOUNDThe specified user does not exist
SYSTEM_ERRORInternal system error occurred

Campaign Database Structure

FieldTypeRequiredDescription
iduuidYesUnique identifier for the campaign
titletextYesTitle of the campaign
descriptiontextNoDescription of the campaign
statustextNoCurrent status of the campaign
typetextNoType of campaign
site_iduuidYesID of the website (foreign key to sites.id)
user_iduuidNoID of the user (foreign key to users.id)
created_attimestamptzAutoCreation timestamp (default: now())
updated_attimestamptzAutoLast update timestamp (default: now())
due_datedateNoDue date for the campaign
assigneesint4NoNumber of assignees
issuesint4NoNumber of issues

Campaign Types

TypeDescription
search_adsSearch engine advertising campaigns
social_adsSocial media advertising campaigns
display_adsDisplay network advertising campaigns
email_marketingEmail marketing campaigns and sequences
content_creationContent marketing and thought leadership
video_marketingVideo content and advertising campaigns
affiliateAffiliate and partnership marketing programs
retargetingRetargeting/remarketing campaigns

Notes

  • The command executes asynchronously
  • The generated command controls the campaign planning process with:
    • campaigns: An array of objects defining campaigns with title, description, and type
    • context: Provides business information and segments to guide campaign creation
    • supervisors: Defines which agent roles can provide additional input
    • task: Specifies the high-level objective for the agent
    • description: Contains the detailed prompt instructions for the agent
  • The system automatically selects the most appropriate segments for each campaign
  • All created campaigns are saved to the database with the structure shown above
Last updated on