Broadcasts
01. List broadcasts
Get a list of broadcasts, created by or shared with you. Items are return in reverse chronological order (newest first).
GET /int/v1/broadcast
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Query Parameters
| Name | Type | Description |
|---|---|---|
| limit | int | optional Maximum number of records to return. Default is 100. Maximium is 1000.Default value: 100 |
| minLiveDate | Date | optional Only return results with go-live later than specified date (ECMAScript Date Time String format). |
| maxLiveDate | Date | optional Only return results with go-live earlier than specified date (ECMAScript Date Time String format). |
| previousLastId | String | optional The last id value of previous return, use this to query more outside of limit |
| all | String | optional Return all platform broadcasts. Only works for Super Users. Mutually exclusive with onlyApi. |
| onlyApi | String | optional Only return broadcasts created by Public API. Mutually exclusive with all. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-X GET https://<url>/int/v1/broadcast?limit=10
Javascript Example:
(async (url, token) => {
try{
const response = await(
const params = new URLSearchParams({
limit: 10
});
await fetch(
`${url}/int/v1/broadcast?${params}`,
{
method: "GET",
headers: {
"Authorization": `Bearer ${token}`
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN);
Parameters examples
json - Request Page:
{
"limit": 10
}
json - Request Next Page:
{
"limit": 10,
"previousLastId": "65dff01ac8072756ac1b7947"
}
json - Request All:
{
"all": "1",
"limit": 1000
}
json - Request Created by Public API:
{
"onlyApi": "1",
"limit": 100
}
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| data | Array | optionalList of broadcast objects. Present when success is true. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true,
"data":[
{
"_id":"65dff01ac8072756ac1b7947",
"status":"1",
"liveDate": "2024-07-14T23:50:18.554Z",
"sender":{
"_id":"60f4aeb09279e27183c0a9da",
"email":"john@communic8.com",
"firstName":"John",
"lastName":"Smith",
"displayName":"John Smith"
},
"sharedUsers":[
{
"_id":"60f4aeb09279e27183c0a9da",
"email":"john@communic8.com",
"firstName":"John",
"lastName":"Smith",
"displayName":"John Smith"
}
],
"adminIds":[
"60f4aeb09279e27183c0a9da"
],
"recipientAmount":1,
"broadcastUrl":"https://test.communic8.com/admin/web/#/broadcasts/all/view/65dff01ac8072756ac1b7947"
}
]
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Illegal parameters"
}
02. Get a broadcast
Get the details of an individual broadcast.
GET /int/v1/broadcast/:id
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - URL Parameters
| Name | Type | Description |
|---|---|---|
| id | String | Broadcast _id value. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-X GET https://<url>/int/v1/broadcast/<id>
Javascript Example:
(async (url, token, id) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}`,
{
method: "GET",
headers: {
"Authorization": `Bearer ${token}`
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID);
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| data | Object | optionalBroadcast object. Present when success is true. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true,
"data":{
"_id":"65dff01ac8072756ac1b7947",
"status":"1",
"sender":{
"_id":"60f4aeb09279e27183c0a9da",
"email":"john@communic8.com",
"firstName":"John",
"lastName":"Smith",
"displayName":"John Smith"
},
"sharedUsers":[
{
"_id":"60f4aeb09279e27183c0a9da",
"email":"john@communic8.com",
"firstName":"John",
"lastName":"Smith",
"displayName":"John Smith"
}
],
"adminIds":[
"60f4aeb09279e27183c0a9da"
],
"recipientAmount":1,
"broadcastUrl":"https://test.communic8.com/admin/web/#/broadcasts/all/view/65dff01ac8072756ac1b7947"
}
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Not Found."
}
03. Create (and send) a new broadcast
Send a new broadcast message to one or more existing or new client recipients. Supply a list of email addresses or recipient group IDs to send to existing recipients. Supply a list of recipient objects to send to new recipients.
POST /int/v1/broadcast
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Request Body
| Name | Type | Description |
|---|---|---|
| title | String | The title of the broadcast. |
| message | String | The message content of the broadcast. |
| status | String | optional Broadcast status. By default the broadcast will be sent immediately (status "live"). If the value is "draft", the broadcast will not be sent immediately, but saved as draft.Default value: live Allowed values: "live","draft" |
| scheduledTime | Date | optional scheduled go-live time for broadcast in ISO 8601 format (only used if status is not already 'live' or 'draft'). |
| imageUrl | String | optional A public URL for an image to display on the broadcast. |
| emoji | String | optional The emoji used as an icon for the broadcast.Default value: 🔔 |
| requiredConfirm | Boolean | optional broadcast requires confirmation or not_Default value: false_ |
| actionLink | String | optional additonal link in broadcast |
| actionLinkText | String | optional The text for the action link button which appears in the broadcast email, which users can click on to view more details.Default value: More Detail |
| contentInEmail | Boolean | optional Will the broadcast content (message) appear in the email body?Default value: false |
| recipientEmails | String[] | optional Array of recipient emails. Mutually exclusive with recipientGroups and recipients. |
| recipientGroups | String[] | optional Array of recipient group IDs. Mutually exclusive with recipientEmails and recipients. |
| recipients | Object[] | optional Array of recipient object. Mutually exclusive with recipientEmails and recipientGroups. |
| recipients.email | String | recipient email |
| recipients.firstName | String | recipient first name |
| recipients.lastName | String | recipient last name |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-X POST https://<url>/int/v1/broadcast \
-d '{"title": "My new broadcast", "message": "Welcome to my broadcast", "recipientEmails": ["john@communic8.com"]}'
Javascript Example:
(async (url, token) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(
{
"title": "My new broadcast",
"message": "Welcome to my broadcast",
"recipientEmails": [
"john@communic8.com"
]
}
)
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN);
Parameters examples
json - Request Example:
{
"title": "New broadcast",
"message": "This is another new broadcast",
"imageUrl": "https://cf.communic8.com/dyzfiavco/image/upload/v1528258650/c8share/book.jpg",
"emoji": "📖",
"requiredConfirm": false,
"actionLink": "",
"actionLinkText": "More Detail",
"contentInEmail": false,
"recipientEmails": ["john@communic8.com"],
"recipientGroups": null,
"recipients": null
}
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| data | Object | optionalSubset of data from newly created broadcast object (i.e. id value and URL). Present when success is true. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true,
"data": {
"_id": "664163518ec4cb1c684b4b0c",
"broadcastUrl": "https://test.communic8.com/admin/web/#/broadcasts/all/view/664163518ec4cb1c684b4b0c"
}
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Title is mandatory"
}
04. Update a broadcast
Modify an existing broadcast.
PUT /int/v1/broadcast/:id
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - Parameter
| Name | Type | Description |
|---|---|---|
| id | String | Broadcast _id value. |
Request Body
| Name | Type | Description |
|---|---|---|
| status | String | Broadcast status is currently the only field that can be altered by this API. Modifying a scheduled broadcast to 'draft' status will cancel a scheduled send, returning the broadcast to a draft state.Allowed values: "draft" |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-X PUT https://<url>/int/v1/broadcast/<id> \
-d '{ "status": "draft" }'
Javascript Example:
(async (url, token, id) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}`,
{
method: "PUT",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ "status": "draft" })
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID);
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true,
"data": {
"_id": "664163518ec4cb1c684b4b0c",
"status": "0",
"broadcastUrl": "https://test.communic8.com/admin/web/#/broadcasts/all/view/664163518ec4cb1c684b4b0c"
}
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Invalid request parameters"
}
05. Delete a broadcast
Delete a draft, scheduled or archived/closed broadcast.
DELETE /int/v1/broadcast/:id
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - URL Parameters
| Name | Type | Description |
|---|---|---|
| id | String | (URL Query Parameter) Broadcast _id value. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-X DELETE https://<url>/int/v1/broadcast/<id>
Javascript Example:
(async (url, token, id) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}`,
{
method: "DELETE",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID);
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Broadcast not found"
}
06. Close a broadcast
Close an existing broadcast so that is inaccessible to recipients.
PUT /int/v1/broadcast/:id/close
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - URL Parameters
| Name | Type | Description |
|---|---|---|
| id | String | (URL Query Parameter) Broadcast _id value. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-X PUT https://<url>/int/v1/broadcast/<id>/close
Javascript Example:
(async (url, token, id) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}/close`,
{
method: "PUT",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID);
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| message | String | optionalError message. Present when success is false. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"Campaign already closed"
}
07. List broadcast files
Get a list of files linked to a broadcast. Items are return in alphabetical order by name.
GET /int/v1/broadcast/:id/file
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - URL Parameters
| Name | Type | Description |
|---|---|---|
| id | String | Broadcast _id value. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-X GET https://<url>/int/v1/broadcast/<id>/file
Javascript Example:
(async (url, token, id) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}/file`,
{
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID);
Success response
Success response - Success 200
| Name | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the operation was successful. |
| message | String | optionalError message. Present when success is false. |
| data | Array | optionalList of broadcast file objects. Present when success is true. |
Success response example
Success response example - Success:
HTTP/1.1 200 OK
{
"success":true,
"data": [
{
"_id": "664175738ec4cb1c684b5fb7",
"campaignId": "65dff01ac8072756ac1b7947",
"draftUsed": false,
"activeUsed": false,
"name": "Screenshot_2024-05-09_at_3.25.02 pm.png",
"type": "file",
"media": "image",
"ready": true,
"deleted": false,
"mime": "image/png",
"_type": "pb_c_campaign_file",
"size": 1121,
"width": 44,
"height": 42,
"format": "png",
"mDate": "2024-05-13T02:05:39.983Z",
"aDate": "2024-05-13T02:05:39.773Z",
"__v": 0,
"VersionId": "wxZ33s5PxQ9Z48eXsjEI4i6Vr.btVZ3M",
"lastVersionDate": "2024-05-13T02:05:39.972Z",
"storageId": "test/cmp/65dff01ac8072756ac1b7947/image/664175738ec4cb1c684b5fb7/Screenshot_2024-05-09_at_3.25.02 pm.png",
"url": "/file/664175738ec4cb1c684b5fb7/Screenshot_2024-05-09_at_3.25.02 pm.png"
}
]
}
Success response example - Error:
HTTP/1.1 200 OK
{
"success":false,
"message":"campaign Id is required"
}
08. Read broadcast file details by file id
Get the details of an individual broadcast file.
GET /int/v1/broadcast/:id/file/:fileId
Headers - Header
| Name | Type | Description |
|---|---|---|
| Authorization | String | Prefix with "Bearer ". Token value (either Access Key from Admin Console or access_token via OAuth result). |
Parameters - URL Parameters
| Name | Type | Description |
|---|---|---|
| id | String | Broadcast _id value. |
| fileId | String | File _id value. |
Examples
CURL Example:
curl -H "Authorization: Bearer <token>" \
-X GET https://<url>/int/v1/broadcast/<id>/file/<fileId>
Javascript Example:
(async (url, token, id, fileId) => {
try{
const response = await(
await fetch(
`${url}/int/v1/broadcast/${id}/file/${fileId}`,
{
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
}
}
)
).json();
console.log("API response:", response);
}catch(error){
console.error("API error:", error);
}
})(process.env.URL, process.env.TOKEN, process.env.BROADCAST_ID, process.env.FILE_ID);