1. Create Campaign
Post api/v1/createCampaign Use this API to Create a new Campaign in your project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
POST | title message link scheduled timings campaignExpiryTime buttons tags Segment userInteraction image icon | string string String boolean(true/false)(optional) object(optional) number(optional) list(optional) list(optional) segmentId(optional) boolean(optional)(true/false) URL(optional) URL(optional) |
| If scheduled true | "timings": { "date": "23-10-2020", `//dd-mm-yyyy` "time": "20:20" `//HH:MM` } |
| If campaignExpiryTime | number(that takes hours)campaignExpiryTime: 2 |
| If campaignExpiryTime | number(that takes hours)campaignExpiryTime: 2 |
| If buttons | “buttons”: [ { “text”: “button1”, “link”: “https://truepush.com” }, { “text”: “button2”, “link”: “https://google.co.in” } ] |
| If tags | “tags”: [“tag1”, “tag2”, “tag3”] |
| If segment | “segment”: “5f8d407ad11b5a2c2c524f63” |
Curl Request:
curl -X POST \
--include \
--header "Authorization: YOUR-REST-API-TOKEN \
--header "Content-Type: application/json" \
-d '{"title":"Notification with API","message": "Notification with API message","link": "http://www.gogole.com","image": "https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","icon": "https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","scheduled": true,"buttons": [{"text": "button1","link": "https://truepush.com"},{"text": "button2","link": "https://google.com"}]}' \
https://api.truepush.com/api/v1/createCampaign
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Campaign Created Successfully with id:5f8d407ad11b5a2c2c524f63",
"Data": "CAMPAIGN-CREATED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Campaign Creating failed",
"data": "CAMPAIGN-CREATING-FAILED"
}
|
400 |
{
"status_code": 400,
"status": "ERROR",
"message": "Invalid Data Message",
"data": "BAD-REQUEST"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
2. Cancel Campaign
Put api/v1/cancelCampaign/:id Use this API to Cancel Campaign in your project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
GET | :id | campaignId |
Curl Request:
curl -X PUT \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/cancelCampaign/5fca2051f5dcf4f88078e23a
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Campaign Cancelled Successfully",
"Data": "CAMPAIGN-CANCELLED-SUCCESFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Can't Cancel Because Already Sent or Cancelled",
"data": "ALREADY-SENT-OR-CANCELLED"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
3. Campaign Stats
GET api/v1/campaignStats/:id Use this API to see the stats of a particular campaign in your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
GET | :id | campaignId |
Curl Request:
curl -X GET \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/campaignStats/5fca2051f5dcf4f88078e23a
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Stats Fetched Successfully",
"data": {
Reach": 2,
"Sent": 2,
"Delivered": 1,
"Views": 1,
"Clicks": 1,
"Button0": 0,
"Button1": 0,
"Unsubscribers": 1
}
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "No Stats Found",
"data": "NO-STATS-FOUND"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
4. List Segments
GET api/v1/listSegment/:page Use this API to get list of all segments in ypur project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | authorization | string |
GET | :page | pageNumber |
Curl Request:
curl -X GET \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/listSegment/1
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Successfully fetched Segment data.",
"data": [
{
"_id": "5f8aed2a004e183c01199e9c",
"name": "Indian Windows Users"
},
{
"_id": "5f8aee042a8d683f9e63c39d",
"name": "Indian MAC users"
}
]
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Segments Not Found",
"data": "SEGMENTS-NOT-FOUND"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
5. Delete Segment
DELETE api/v1/deleteSegment/:id Use this API to delete the segments from your project
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
DELETE | :id | segmentId |
Curl Request:
curl -X DELETE \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/deleteSegment/5f89365f51e2766113d29fd6
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Segment Deleted Successfully",
"data": "SEGMENT-DELETED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "No Segment Found to Delete",
"data": "NO-SEGMENT-FOUND-TO-DELETE"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
6. Create Template
Post api/v1/createTemplate Use this API to create a new Template in your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
POST | name title message link buttons tags userInteractionRequired image icon | string string string String list(optional) list(optional) boolean(optional)(true/false) URL(optional) URL(optional) |
| If buttons | “buttons”: [ { “text”: “button1”, “link”: “https://truepush.com” }, { “text”: “button2”, “link”: “https://google.co.in” } ] |
| If tags | “tags”: [“tag1”, “tag2”, “tag3”] |
Curl Request:
curl -X POST \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
--header "Content-Type: application/json" \ -d '{"name":"Template created with API" ,"title":"Creating template with API","message": "Creating template with API Message","link": "http://www.gogole.com","image": "https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","icon": "https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png","scheduled": true,"buttons": [{"text": "button1","link": "https://truepush.com"},{"text": "button2","link": "https://google.com"}]}' \
https://api.truepush.com/api/v1/createTemplate
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Template Created Successfully with id:5f8d407ad11b5a2c2c524f63",
"Data": "TEMPLATE-CREATED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Template Creating failed",
"data": "TEMPLATE-CREATING-FAILED"
}
|
400 |
{
"status_code": 400,
"status": "ERROR",
"message": "Invalid Data Message",
"data": "BAD-REQUEST"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
7. Delete Template
DELETE api/v1/deleteTemplate/:id Use this API to Delete your existing templates from your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
DELETE | :id | templateId |
Curl Request:
curl -X DELETE \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/deleteTemplate/5fb8d81b8deea45b89458df9
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Template Deleted Successfully",
"data": "TEMPLATE-DELETED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "No Template Found to Delete",
"data": "NO-TEMPLATE-FOUND-TO-DELETE"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
8. List Template
GET api/v1/listTemplate/:page
Use this API to see the list of Templates in your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
GET | :page | pageNUmber |
Curl Request:
curl -X GET \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/listTemplate/1
Responses
Status | Response |
---|
200 |
{
"status_code": "SUCCESS",
"status": "SUCCESS",
"message": "Successfully fetched template data.",
"data": [
{
"_id": "5f8d550652c49342b6423fad",
"name": "Welcome to Truepush"
}
]
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
message": "No Templates Found",
"data": "TEMPLATES-NOT-FOUND"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
9.Create Trigger
Post api/v1/createTrigger/ Use this Campaign to a Create a new Trigger in your Project
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
POST | namenote segmentId templateId type timings | string(Unique name) string(optional) string(segmentId) string(templateId) string(once/repeated/multiple) Object |
| If type is once timings | timings :{ “hours” : number, “minutes” : number } |
| If type is multiple timings | timings: { “dates”:[ { “date”: date(dd/mm/yyyy), “time”: time(HH:MM) }, { “date”: date(dd/mm/yyyy), “time”: time(HH:MM) } ] } |
| If type is multiple timings | If sub_type is daily timings: { “sub_type”: string(daily), “hours”: number, “minutes”: number } (or) If sub_type is weekly timings: { “sub_type”: string(weekly), “week_days: list[0, 1, 2,..] 0 -sunday, 1-monday, 2-tuesday, … “hours”: number, “minutes”: number } (or) If sub_type is monthly timings: { “sub_type”: string(monthly), “dates”: list[1, 2, 3,.. 31], “hours”: number, “minutes”: number } (or) If sub_type id yearly timings: { “sub_type”: string(yearly), “months”: list[1, 2, …, 12] 1-January, 2-Febraury, ... 12-December “dates”: list[1, 2, 3,.. 31], “hours”: number, “minutes”: number }
|
Curl Request:
curl -X POST \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
--header "Content-Type: application/json" \
-d ' {"name": "Creating a trigger with API","note": "This is a trigger note","templateId": "5fb8cde682a1419035c8d981","type": "multiple","timings": {"dates":[ {"date": "24-10-2021","time": "17:50" }, {"date": "23-10-2021","time": "17:50" }] } }' \
https://api.truepush.com/api/v1/createTrigger
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Trigger Added successfully with
id:5f8ee892df5ff41f7f00694c",
"data": "TRIGGER-ADDED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Trigger adding failed",
"data": "TRIGGER-ADDING-FAILED"
}
|
400 |
{
"status_code": 400,
"status": "ERROR",
"message": "Invalid Data Message",
"data": "BAD-REQUEST"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
10. Delete Trigger
DELETE api/v1/deleteTrigger/:id Use this API to Delete Triggers from your project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
DELETE | :id | triggerId |
Curl Request:
curl -X DELETE \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/deleteTrigger/5fb2087c68e8e445158b7307
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Trigger Deleted Successfully",
"data": "TRIGGER-DELETED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "No Trigger Found to Delete",
"data": "NO-TRIGGER-FOUND-TO-DELETE"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
11. List Trigger
GET api/v1/listTrigger/:page Use this API to see the list of Triggers in your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
GET | :page | pageNUmber |
Curl Request:
curl -X GET \
--include \
--header "Authorization: YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/listTrigger/1
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Successfully fetched Trigger data.",
"data": [
{
"_id": "5f8d5d900db83d4f8cf35d79",
"name": "MAC and welcome",
"status": "inactive"
},
{
"_id": "5f8ee892df5ff41f7f00694c",
"name": "Test1 Once",
"status": "active"
}
]
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Triggers Not Found",
"data": "TRIGGERS-NOT-FOUND"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
12. Change Trigger Status
PUT api/v1/triggerStatus/:id
Change this API to change the Trigger status from existing triggers in your project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
PUT | :id status | triggerId string(active/inactive) |
Curl Request:
curl -X PUT \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
--header "Content-Type: application/json" \
-d '{"status":"active"}' \
https://api.truepush.com/api/v1/triggerStatus/5fae1887042f2bee7ef8aef9
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Trigger Updated Successfully",
"data": "TRIGGER-UPDATED-SUCCESSFULLY"
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "No Trigger Found to Update or already in given status",
"data": "NO-TRIGGER-FOUND-TO-UPDATE-OR-ALREADY-IN-GIVEN-STATUS"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|
13. List Campaigns
GET api/v1/listCampaign/:page Use this API to see the List of campaigns in your Project.
Request
Type | Params | Values |
---|
HEAD | authorization | string |
HEAD | content-type | application/json |
GET | :id :page | pageNUmber |
Curl Request:
curl -X GET \
--include \
--header "Authorization:YOUR-REST-API-TOKEN \
https://api.truepush.com/api/v1/listCampaign/1
Responses
Status | Response |
---|
200 |
{
"status_code": 200,
"status": "SUCCESS",
"message": "Successfully fetched Campaigns data.",
"data": [
{
"_id": "5f71b707ce17f26371ebc12e",
"title": "Campaign 1"
},
{
"_id": "5f71bfa5ce17f26371ebc130",
"title": "Campaign 2"
}
]
}
|
204 |
{
"status_code": 204,
"status": "ERROR",
"message": "Campaigns Not Found",
"data": "CAMPAIGNS-NOT-FOUND"
}
|
401 |
{
"status_code": 401,
"status": "ERROR",
"message": "No token provided.",
"data": "TOKEN-NOT-FOUND"
}
|
429 |
{
"status_code": 429,
"status": "ERROR",
"message": "API Usage Limit Exceeded",
"data": "API-LIMIT-EXCEEDED"
}
|
500 |
{
"status_code": 500,
"status": "ERROR",
"message": "Internal Server Error",
"data": "DB-ERROR"
}
|