Campaigns ========= Use this endpoint to manipulate and obtain details on Salesbox's Campaigns. Base Endpoint ------------ .. code-block:: text https://segmentai.salesbox.com.br/api/campaigns Get Campaign ----------- .. code-block:: text GET /api/campaigns/{id} Get Campaign's data. **HTTP Request** ``GET /api/campaigns/ID`` **Response** ``Expected Response Code: 200`` .. code-block:: json { "campaign": { "id": 1, "name": "Welcome Campaign", "description": "Campaign to welcome new contacts", "type": "email", "status": "active", "createdAt": "2024-01-15T10:00:00+00:00", "modifiedAt": "2024-01-15T10:00:00+00:00", "startDate": "2024-01-16T00:00:00+00:00", "endDate": null } } List Campaigns ------------- .. code-block:: text GET /api/campaigns Get a list of campaigns. **Query Parameters** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``search`` - string - Text to search campaigns by * - ``page`` - int - Which page to display * - ``limit`` - int - How many records to return * - ``orderBy`` - string - Column to sort by * - ``orderByDir`` - string - Sort direction: asc or desc * - ``status`` - string - Filter by campaign status (active, inactive, completed) Create Campaign ------------- .. code-block:: text POST /api/campaigns/new Create a new campaign. **Request Body** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``name`` - string - Campaign name * - ``description`` - string - Campaign description * - ``type`` - string - Campaign type (email, sms, etc) * - ``status`` - string - Campaign status (active, inactive) * - ``startDate`` - string - Campaign start date (ISO 8601 format) * - ``endDate`` - string - Campaign end date (ISO 8601 format) Edit Campaign ----------- .. code-block:: text PATCH /api/campaigns/{id}/edit Edit an existing campaign. **Request Body** Same fields as Create Campaign. Delete Campaign ------------- .. code-block:: text DELETE /api/campaigns/{id}/delete Delete an existing campaign. Add Contact to Campaign -------------------- .. code-block:: text POST /api/campaigns/{campaignId}/contact/{contactId}/add Add a contact to a campaign. Remove Contact from Campaign ------------------------ .. code-block:: text POST /api/campaigns/{campaignId}/contact/{contactId}/remove Remove a contact from a campaign. Get Campaign Contacts ------------------ .. code-block:: text GET /api/campaigns/{id}/contacts Get a list of contacts in a campaign. **Query Parameters** Same as List Contacts endpoint.