Campaigns
Here you find all available endpoints related to Swell CX campaigns. These endpoints are protected and you'll need an API Key.
In order to use the GET and POST requests, add to the header the following:
Key |
Value |
Content-Type |
application/json |
Accept |
application/json |
GET /api/v1/campaigns
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on swell platform. |
team_id |
Optional |
Filter campaigns to show only those from this team_id |
page |
Optional |
Specify the page you would like returned in a request. Minimum value: 1 |
per_page |
Optional |
Specify the number of records to return in one request, specified as an integer from 1 to 100. Default 15. |
Examples
Request Example
/api/v1/campaigns?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
"data": [
{
"id": 420,
"team_id": 1,
"name": "Review Invite ",
"type": "public",
"image": "http://swell.test/tmp/avBCj4wy57mPeVM4KGIO60rzvxFWAq5vmJddw4N0.jpeg",
"review_sites": [
"google",
"facebook"
],
"threshold": null,
"ask_for_recommend": false,
"ask_for_feedback": false,
"redirect_to_review_site": false,
"send_direct": false,
"allow_private_feedback": true
},
{
"id": 566,
"team_id": 1,
"name": "NPS + Review Invite",
"type": "nps",
"image": "http://swell.test/campaigns/zwDOCtNJFGXcZXiphT6ClDMUJ0jeMi6k6qH7HeDC.png",
"review_sites": [
"google",
"facebook"
],
"threshold": 7,
"ask_for_recommend": false,
"ask_for_feedback": true,
"redirect_to_review_site": true,
"send_direct": null,
"allow_private_feedback": true
}
],
"links": {
"first": "http://swell.test/api/v1/campaigns?page=1",
"last": "http://swell.test/api/v1/campaigns?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http://swell.test/api/v1/campaigns",
"per_page": 2,
"to": 2,
"total": 2
}
}
POST /api/v1/campaigns
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
name |
Required |
Name Campaign. Format: (String). |
location_id |
Required |
Locations ids Format: (Array or Integer). Required at least one location id. |
review_site |
Optional |
Review sites Format: (Array). ['google', 'facebook', 'yelp', 'trip advisor', 'capterra', 'software advice', 'g2 crowd', 'golf now', 'indeed', 'glassdoor', 'healthgrades', 'realself', 'golf advisor', 'zillow'] |
image |
Optional |
Image Campaign Format: (File). Acceptable extensions: jpeg, png, jpg, svg. Maximum size: 2Mb (megabyte). |
send_sms |
Optional |
Format: (Boolean). Default value: true . |
sms_preference |
Optional |
Sms preference. Format: (Array). |
sms_preference.message |
Optional |
Message sms. Format: (String). |
sms_preference.sms_image |
Optional |
Image Campaign SMS Format: (File). Acceptable extensions: jpeg, png, jpg, svg. Maximum size: 2Mb (megabyte). |
send_email |
Optional |
Format: (Boolean). Default value: true . |
email_preference |
Optional |
Required within the message follow-up object. Format: (Array). |
email_preference.from_address |
Optional |
From address email. Format: (String). |
email_preference.from_name |
Optional |
From name. Format: (String). |
email_preference.on_behalf_of |
Optional |
On behalf of. Format: (Email). |
email_preference.subject |
Optional |
Subject. Format: (String). |
email_preference.message |
Optional |
Message. Format: (String). |
email_preference.email_image |
Optional |
Image Campaign E-MAil Format: (File). Acceptable extensions: jpeg, png, jpg, svg. Maximum size: 2Mb (megabyte). |
follow_up |
Optional |
Format: (Boolean). Default value: false . |
follow_up_preference |
Optional |
Message follow-up object Format: (Array). |
delay_days |
Optional |
Required if follow_up = true . Format: (Integer). Value >= 0. |
statuses |
Optional |
Required if follow_up = true . Format: (Integer). ['sent', 'opened', 'shared', 'falled'] |
subject |
Optional |
Required if follow_up = true . Format: (String). |
message |
Optional |
Required if follow_up = true . Format: (String). |
Examples
Request Example
{
"token": "Y8vTgHzm5kUV1RzW2WOo2lFY0TKNhcG1mSavMZrBc1xXQ6FSzl634dIGV6tk",
"name": "name campaign",
"location_id": [1, 3],
"review_site": ["capterra", "trip advisor", "yelp"],
"image": {"metadata"},
"send_sms": false,
"sms_preference": {
"message": "message message message",
"image": {"metadata"}
},
"send_email": false,
"email_preference": {
"from_address": "user@swell.com",
"from_name": "User Swell",
"on_behalf_of": "Team",
"subject": "welcome",
"message": "welcome message",
"image": {"metadata"}
},
"follow_up": true,
"follow_up_preference": [
{
"delay_days": 1,
"statuses": ["sent", "opened", "shared", "falled"],
"subject": "subject follow up 1",
"message": "message follow up 1"
},
{
"delay_days": 30,
"statuses": ["sent", "shared"],
"subject": "subject follow up 2",
"message": "message follow up 2"
}
]
}
Response
{
"id": 1234,
"team_id": 123
"name": "name campaign",
"type": null,
"image": "http://swell.test/image",
"review_sites": [
"capterra",
"trip advisor",
"yelp"
],
"threshold": null,
"ask_for_recommend": null,
"ask_for_feedback": null,
"redirect_to_review_site": null,
"send_direct": null,
"allow_private_feedback": true
}
POST /api/v1/templates/text
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
page |
Optional |
Specify the page you would like returned in a request. Minimum value: 1 |
per_page |
Optional |
Specify the number of records to return in one request, specified as an integer from 1 to 100. Default 15. |
Examples
/api/v1/templates/text?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
[
{
"id": 1,
"name": "Template Example",
"text": "Thanks for choosing Swell!",
"locations": [
{
"id": 1,
"name": "Test Location",
"facebook_page": null,
"foreup_credential": null
},
{
"id": 2,
"name": "Location 2",
"facebook_page": null,
"foreup_credential": null
}
],
"type": "chat_template"
}
]