Invites
Here you find all available endpoints related to Swell CX invites. 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/invites
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
location_id |
Optional |
Filter invites to show only those from this location_id |
from_date |
*Required |
(*Required when using to_date field) Filter invites to show only those from from_date format: yyyy-mm-dd . |
to_date |
*Required |
(*Required when using from_date field) Filter invites to show only those up until to_date format: yyyy-mm-dd . |
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/invites?location_id=123&token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
"data": [
{
"id": 686428,
"token": "24338214-f695-4673-8c83-07e07f5a8651",
"origin": "swell",
"send_at": "2019-06-06 05:03:57",
"sent_at": "2019-06-06 05:04:01",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "tag_name2",
"created_at": "2020-12-17T22:26:30.000000Z",
"updated_at": "2020-12-17T22:26:30.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 473,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 1
},
{
"id": 686427,
"token": "04e8de43-2c52-415d-ba54-e268b17d6ae0",
"origin": "swell",
"send_at": "2019-06-06 04:42:50",
"sent_at": "2019-06-06 04:42:55",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [],
"twilio_message_id": null
}
],
"links": {
"first": "http://swell.test/api/v1/invites?page=1",
"last": "http://swell.test/api/v1/invites?page=6",
"prev": null,
"next": "http://swell.test/api/v1/invites?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 6,
"path": "http://swell.test/api/v1/invites",
"per_page": 2,
"to": 2,
"total": 11
}
}
POST /api/v1/invites
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
location_id |
Required |
Get in Locations. |
campaign_id |
Required |
Get in Campaigns. |
contact_id |
Required |
Get in Contacts. Format: (Array or Integer). |
scheduled |
Optional |
Format: (Boolean) true . Required when send_at is used. |
override |
Optional |
Format: (Boolean) true . Defaults to false when not specified. Used to force send invite when contact has already received an invite within the location's specified invite/review period. |
tags |
Optional |
Format: (Array) ['custom_tag'] . Add tag(s) to an invite. |
send_at |
Optional |
Format: yyyy-mm-dd H:i . Required when scheduled is used. Converted to Mountain Time. |
Examples
Request Example
/api/v1/invites?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
"id": 686428,
"token": "24338214-f695-4673-8c83-07e07f5a8651",
"origin": "swell",
"send_at": "2019-06-06 05:03:57",
"sent_at": "",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "queued",
"scheduled": true,
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "tag_name2",
"created_at": "2020-12-17T22:26:30.000000Z",
"updated_at": "2020-12-17T22:26:30.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 473,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 1
}
PUT /api/v1/invite/{invite_id}/cancel
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
invite_id |
Required |
ID of invite in status "scheduled", get in Invites. |
Examples
Request Example
/api/v1/invite/1/cancel?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
[]
}
PUT /api/v1/invite/update
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
tag_name |
Required |
Tag used when scheduling invitation. |
send_at |
Required |
Updated time to send invitation. Converted to Mountain Time. |
Examples
Request Example
{
"token": "Y8vTgHzm5kUV1RzW2WOo2lFY0TKNhcG1mSavMZrBc1xXQ6FSzl634dIGV6tk",
"tag_name": "1172880938223",
"send_at": "2021-09-06 13:45:00"
}
Response
{
"message":"Invite Updated"
}
GET /api/v1/invites/tag/{tag_name}
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
tag_name |
Required |
Invites to show only those from this tag name |
Examples
Request Example
/api/v1/invites/tag/office1?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
"data": [
{
"id": 686428,
"token": "24338214-f695-4673-8c83-07e07f5a8651",
"origin": "swell",
"send_at": "2019-06-06 05:03:57",
"sent_at": "2019-06-06 05:04:01",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "office1",
"created_at": "2021-03-30T21:53:51.000000Z",
"updated_at": "2021-03-30T21:53:51.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 217,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 2
},
{
"id": 686427,
"token": "04e8de43-2c52-415d-ba54-e268b17d6ae0",
"origin": "swell",
"send_at": "2019-06-06 04:42:50",
"sent_at": "2019-06-06 04:42:55",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "office1",
"created_at": "2021-03-30T21:53:51.000000Z",
"updated_at": "2021-03-30T21:53:51.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 217,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 1
}
]
}
GET /api/v1/contacts/{contact_id}/invites
Parameters
Param |
Required |
Description |
token |
Required |
The API token generated throught UI interface on Swell CX platform. |
contact_id |
Required |
Invites to show only those from this contact_id |
Examples
Request Example
/api/v1/contacts/1/invites?token=3lxeh7XMElKc97lbPNwWKNEBOw9Nzuur7ntfoKwBzh4UboVos0qU5qhFh4nT
Response
{
"data": [
{
"id": 686428,
"token": "24338214-f695-4673-8c83-07e07f5a8651",
"origin": "swell",
"send_at": "2019-06-06 05:03:57",
"sent_at": "2019-06-06 05:04:01",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "office1",
"created_at": "2021-03-30T21:53:51.000000Z",
"updated_at": "2021-03-30T21:53:51.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 217,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 2
},
{
"id": 686427,
"token": "04e8de43-2c52-415d-ba54-e268b17d6ae0",
"origin": "swell",
"send_at": "2019-06-06 04:42:50",
"sent_at": "2019-06-06 04:42:55",
"contact_id": 305583,
"location_id": 632,
"user_id": null,
"status": "sent",
"campaign_id": 663,
"tags": [
{
"id": 3,
"name": "office1",
"created_at": "2021-03-30T21:53:51.000000Z",
"updated_at": "2021-03-30T21:53:51.000000Z",
"team_id": 1,
"type": null,
"pivot": {
"taggable_id": 217,
"tag_id": 3,
"taggable_type": "invites"
}
}
],
"twilio_message_id": 1
}
]
}