Campaigns

Use this endpoint to manipulate and obtain details on Salesbox’s Campaigns.

Base Endpoint

https://segmentai.salesbox.com.br/api/campaigns

Get Campaign

GET /api/campaigns/{id}

Get Campaign’s data.

HTTP Request

GET /api/campaigns/ID

Response

Expected Response Code: 200

{
    "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

GET /api/campaigns

Get a list of campaigns.

Query Parameters

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

POST /api/campaigns/new

Create a new campaign.

Request Body

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

PATCH /api/campaigns/{id}/edit

Edit an existing campaign.

Request Body

Same fields as Create Campaign.

Delete Campaign

DELETE /api/campaigns/{id}/delete

Delete an existing campaign.

Add Contact to Campaign

POST /api/campaigns/{campaignId}/contact/{contactId}/add

Add a contact to a campaign.

Remove Contact from Campaign

POST /api/campaigns/{campaignId}/contact/{contactId}/remove

Remove a contact from a campaign.

Get Campaign Contacts

GET /api/campaigns/{id}/contacts

Get a list of contacts in a campaign.

Query Parameters

Same as List Contacts endpoint.