Campaign Resource

The Campaigns Resource endpoint helps you perform operations on campaigns. Create campaign, publish a campaign, or delete a campaign.

Endpoint

https://propagate.at/api/v1/campaigns


GET /

Returns an array of all the campaigns the authenticated user created.

note

Make sure your request body is sent in the JSON Format.

Example Request

curl
-X GET
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
https://propagate.at/api/v1/campaigns

Example Response

{
"data": {
"campaigns": [
{
"_id": "5f9978784e7e710d1e1fd37e",
"creator": "5f72e09e613a120856e80da7",
"name": "Black Friday Campaign",
"status": "DRAFT",
"message": "<p>hello world</p>\n",
"shouldRemoveWatermark": false,
"groups": [
"5f97f8963de2575b7888301c"
],
"createdAt": "2020-10-28T13:56:08.796Z",
"updatedAt": "2020-10-28T13:56:08.796Z"
},
...
]
}
}

POST /create

Creates a Campaign.

Body Parameters

name string required

The name of the campaign. If you are sending emails, this will be the subject of your emails.

emailMessage string depends

The Email Message in HTML format. For eg. <p>Hello World!</p>

whatsappMessage string depends

The WhatsApp Message, that gets sent to only WhatsApp Subscribers only if you have a WhatsApp integration. You can use **bold**, _italic_ and such WhatsApp Text Message formats.

smsMessage string depends

The SMS Message, that gets sent to only SMS Subscribers only if you have an SMS integration.

shouldRemoveWatermark boolean default: false

Whether the footer credits in the emails should be removed or not. Credits can only be removed if you are on an upgraded propagate.at account.

groups [string] required

An array of Group IDs that you want this campaign to reach. You can select multiple groups and multiple subscribers using this array. You can get the Group IDs using the /groups resource.

isStarted boolean default: false

Decides whether the campaign should immediately start or not. If isStarted=false, then the campaign created will be of DRAFT type. If isStarted=true, campaign will be published to all the selected group members. Use this option wisely. You can keep isStarted=false, and use /campaigns/publish endpoint later to publish the draft campaign.

Example Request

curl
-X POST
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"name":"test", "groups":["5f97f8963de2575b7888301c"], "emailMessage":"<p>Hello World!</p>", "shouldRemoveWatermark":false, "isStarted":false}'
https://propagate.at/api/v1/campaigns/create

Example Response

{
"data": {
"createCampaign": {
"name": "test",
"creator": "5f72e09e613a120856e80da7",
"status": "DRAFT",
"message": "<p>Hello World!</p>",
"shouldRemoveWatermark": false,
"groups": [
"5f97f8963de2575b7888301c"
],
"createdAt": "2020-10-28T14:20:10.393Z",
"updatedAt": "2020-10-28T14:20:10.393Z",
"_id": "5f997e1a4e7e710d1e1fd37f"
}
}
}

POST /publish

Publishes a Draft Campaign.

Body Parameters

campaignId string required

ID of the Draft Campaign that you wanna publish.

Example Request

curl
-X POST
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"campaignId":"5f997e1a4e7e710d1e1fd37f"}'
https://propagate.at/api/v1/campaigns/publish

Example Response

{
"data": {
"publishCampaign": {
"_id": "5f997e1a4e7e710d1e1fd37f",
"name": "test",
"creator": "5f72e09e613a120856e80da7",
"status": "SENDING",
"message": "<p>Hello World!</p>",
"shouldRemoveWatermark": false,
"whatsappMessage": null,
"smsMessage": null,
"groups": [
"5f97f8963de2575b7888301c"
],
"createdAt": "2020-10-28T14:20:10.393Z",
"updatedAt": "2020-10-28T14:27:44.690Z"
}
}
}

DELETE /

Deletes multiple campaigns by their IDs.

Body Parameters

campaignIds [string] required

An array of Campaign IDs. The array consists IDs of the campaigns to be deleted.

Example Request

curl
-X DELETE
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"campaignIds": ["5f97f9163de2575b7888301d", "5f97f9163de2575b7888301f"]}'
https://propagate.at/api/v1/campaigns

Example Response

{
"data": {
"deleteCampaigns": {
"result": {
"n": 2,
"ok": 1
},
"deletedCount": 2,
"ids": [
"5f97f9163de2575b7888301d",
"5f97f9163de2575b7888301f"
]
}
}
}

Ending note

If you got any questions, feel free to drop us those at hey[at]propagate.at. We will help!