Message service
List groups
Retrieve a list of all SMS groups.
POST
https://api.coupontools.com/v3/smstool/grouplist
Authentication:
API KeysExample
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({}); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/smstool/grouplist", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "amount_of_groups": 2, "group": [ { "ID": "gro_123456", "name": "Subscribers keyword pizza" }, { "ID": "gro_1243434", "name": "Subscribers keyword burger" } ] }
Possible errors
103: Your account is not connected with the Coupontools SMS services
List contacts
Retrieve a list of all contacts from an SMS group.
POST
https://api.coupontools.com/v3/smstool/userlist
Authentication:
API KeysParameters
Required
smsgroup SMS group ID (gro_XXXXXX)
Can be found in the 'List groups' API response
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ smsgroup: "gro_123456" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/smstool/userlist", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "group_id": "gro_123456", "group_name": "Subscribers to keyword pizza", "amount_of_contacts": "2", "contact": [ { "ID": "con_123456", "phone": "123456789012", "first_name": "John", "last_name": "Doe", "unsubscribed": "1", "unsubscribedate": "13/07/2018 19:47 UTC" }, { "ID": "con_1234567", "phone": "441234567890", "first_name": "Jeff", "last_name": "Jefferson", "unsubscribed": "0" } ] }
Possible errors
103: Your account is not connected with the Coupontools SMS services
200: Missing parameter: smsgroup
301: Invalid character in parameter: smsgroup
514: Group ID not found
Create group
Create an SMS group.
POST
https://api.coupontools.com/v3/smstool/addgroup
Authentication:
API KeysParameters
Required
group_name String
Name of the group
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ group_name: "Example" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/smstool/addgroup", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "result": "saved_successfully", "groupid": 119251 }
Possible errors
103: Your account is not connected with the Coupontools SMS services
Add contact
Add a contact to an SMS group.
POST
https://api.coupontools.com/v3/smstool/addcontact
Authentication:
API KeysParameters
Required
smsgroup SMS group ID (gro_XXXXXX)
Can be found in the 'List groups' API response
Required
phone Phone number
Phone number. International E.164 notation
Optional
first_name First name
Optional
last_name Last name
Optional
customfield1 - customfield7 String
Add data to custom field 1 through 7
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ smsgroup: "gro_12345", phone: "+123456789" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/smstool/addcontact", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "group_id": "gro_123456", "phone": "1234566778899", "first_name": "Bill", "last_name": "Jackson", "result": "saved_successfully", "contact_id": "con_12345678" }
Possible errors
103: Your account is not connected with the Coupontools SMS services
200: Missing parameter: phone
200: Missing parameter: smsgroup
301: Invalid character in parameter: smsgroup
303: incorrect format in birthday field, must be yyyy-MM-dd
514: Group ID not found
Email service
List groups
Retrieve a list of all email groups.
POST
https://api.coupontools.com/v3/emailtool/grouplist
Authentication:
API KeysExample
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({}); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/emailtool/grouplist", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "amount_of_groups": 2, "group": [ { "ID": "gro_123456", "name": "Subscribers keyword pizza" }, { "ID": "gro_1243434", "name": "Subscribers keyword burger" } ] }
Possible errors
103: Your account is not connected with the Coupontools Email services
List contacts
Retrieve a list of all contacts from an email group.
POST
https://api.coupontools.com/v3/emailtool/userlist
Authentication:
API KeysParameters
Required
emailgroup Email group ID (gro_XXXXXX)
Can be found in the 'List groups' API response
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ emailgroup: "gro_12345" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/emailtool/userlist", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "group_id": "gro_123456", "group_name": "Subscribers to pizza coupon", "amount_of_contacts": "2", "contact": [ { "ID": "con_123456", "phone": "123456789012", "first_name": "John", "last_name": "Doe", "unsubscribed": "1" }, { "ID": "con_1234567", "phone": "441234567890", "first_name": "Jeff", "last_name": "Jefferson", "unsubscribed": "0" } ] }
Possible errors
103: Your account is not connected with the Coupontools Email services
200: Missing parameter: emailgroup
301: Invalid character in parameter: emailgroup
514: Group ID not found
Create group
Create an email group.
POST
https://api.coupontools.com/v3/emailtool/addgroup
Authentication:
API KeysParameters
Required
group_name String
Name of the group
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ group_name: "Example" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/emailtool/addgroup", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "result": "saved_successfully", "group_id": "gro_119251" }
Possible errors
103: Your account is not connected with the Coupontools Email services
Add contact
Add a contact to an email group.
POST
https://api.coupontools.com/v3/emailtool/addcontact
Authentication:
API KeysParameters
Required
emailgroup Email group ID (gro_XXXXXX)
Can be found in the 'List groups' API response
Required
email Email address
Valid email address
Optional
first_name First name
Optional
last_name Last name
Optional
custom1 - custom10 String
Add data to custom field 1 through 10
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ emailgroup: "gro_12345", email: "john@doe.com" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v3/emailtool/addcontact", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "group_id": "gro_123456", "email": "test@test.com", "first_name": "Bill", "last_name": "Jackson", "result": "saved_successfully", "contact_id": "con_12345678" }
Possible errors
103: Your account is not connected with the Coupontools Email services
200: Missing parameter: email
200: Missing parameter: emailgroup
301: Invalid character in parameter: emailgroup
303: incorrect format in birthday field, must be yyyy-MM-dd
514: Group ID not found
Webhooks
Click here for more information
about webhooks.
Example webhooks for coupon, coupon edit, subaccount and, landing page.
Coupon
{ "id": "evt_6paDkhIBCpWrUK8ne7rT", "datetime": "2022-01-14 10:40:38", "livemode": "0", "type": "coupon_claimed", "coupon_code": "2e8g45wmyawppwubnk5r7", "session": "2e8g45wmyawppwubnk5r7", "campaign": "cam_12345", "coupon_url": "https://www.digicpn.com/p/u3s3dg/2e8g45wmyawppwubnk5r7", "coupon": { "coupon_code": "u3s3dg", "friendly_name": "Here comes your campaign name", "title": "The coupon title comes here", "subtitle": "The coupon subtitle comes here", "tags": "Here comes the coupon tags", "coupon_value": "Discount value", "custom_validation_code": "your custom validation code, if this method was used", "customid": "", "timezone": "UTC" }, "status": { "social_login": "0", "scratched": "0", "scratched_date": "", "claimed": "1", "claimed_date": "2022-01-14 10:40:38", "claimed_type": "db", "validated": "0", "validated_date": "" }, "customer": { "gender": "Male", "first_name": "First Name", "last_name": "Last Name", "email": "info@email.com", "phone": "11234567890", "address": "Address", "zip": "10000", "city": "City", "birthday": "1980-01-01", "custom_field_1": "Custom field 1", "custom_field_2": "Custom field 2", "custom_field_3": "Custom field 3", "custom_field_4": "Custom field 4", "custom_field_5": "Custom field 5", "custom_field_6": "Custom field 6", "custom_field_7": "Custom field 7", "question_1": "Answer 1" } }
Coupon edit
{ "id": "evt_rmGqtgKU7zvLppIYUKN5", "datetime": "2022-01-14 10:40:38", "type": "coupon_created", "coupon": "cam_1026090", "subaccount": "sub_3427" }
Subaccount
{ "id": "evt_rmGqtgKU7zvLppIYUKN5", "datetime": "2022-01-14 10:40:38", "type": "subaccount_created", "subaccount": "sub_3427", "data": { "email": "john@doe.com", "company_name": "Company name", "first_name": "John", "last_name": "Doe", "phone": "+1234567890", "country": "US" } }
Web Loyalty (legacy)
{ "id": "evt_5J3MQMbTTdu3a0VgS8rqD", "datetime": "2022-01-14 10:40:38", "type": "loyalty_complete", "subaccount": "sub_3427", "loyaltycard": "loy_1037746", "statcode": "97raebv4nkcpjj1i444zh" }
Wallet Loyalty
{ "id": "evt_OWZw15hCxSP1iCWhtQwC", "datetime": "2024-03-21 13:13:06", "type": "loyalty_v3_created", "loyalty_id": 1, "user": { "id": 1, "code": "zeexxegfjqz5r8fspglmd", "first_name": "John", "last_name": "Doe", "address": "Generic Road 956", "zip": "123456", "city": "Generic City", "phone": "+18606231754", "email": "John@Doe.com", "custom_1": "custom value 1", "custom_2": "custom value 2", "custom_3": "custom value 3", "custom_4": "custom value 4", "custom_5": "custom value 5", "custom_6": "custom value 6", "custom_7": "custom value 7", "custom_8": "custom value 8", "download_url": "https://loyalty.coupontools.com/6epyy9/zeexxegfjqz5r8fspglmd" } }
Landing page
{ "id": "evt_okhTzyxLUxldgcpgec6X", "datetime": "2021-05-06 13:24:48", "type": "lp_submission", "landing_id": "lp_12345", "target_coupon": "cam_1234567", "target_statcode": "2e8g45wmyawppwubnk5r7", "target_url": "https://www.digicpn.com/p/u3s3dg/2e8g45wmyawppwubnk5r7", "data": { "E-mail": "info@email.com", "phone": "11234567890" }, "utm_tags": { "utm_source": "examplesource", "utm_medium": "examplemedium", "utm_campaign": "examplecampaign", "utm_term": "examplekeyword", "utm_content": "examplecontent", "custom1": "customexamplevalue1", "custom2": "customexamplevalue2", "custom3": "customexamplevalue3", "custom4": "customexamplevalue4", "custom5": "customexamplevalue5", "custom6": "customexamplevalue6", "custom7": "customexamplevalue7", "custom8": "customexamplevalue8" } }
Directory page
{ "id": "922", "datetime": "2023-02-16 08:11:31", "type": "directory_registration", "data": { "userId": "5025", "first_name": "test", "last_name": "test", "birthday": "1953-02-02", "email": "test@test.test", "phone": "+32000000000", "created_at": "2023-02-16 08:11:31" } }
Verification
Get important information about a webhook which can be used as verification.
POST
https://api.coupontools.com/v4/webhook/verification
Authentication:
API KeysParameters
Required
webhook Webhook id (evt_XXXXXXXXXXXXXXXXXXXX)
Can be found in the "id" property of a webhook payload
Example
const https = require("https"); const client_id = "XXX"; // Your API client ID (required) const client_secret = "YYY"; // Your API client secret (required) const data = JSON.stringify({ webhook: "evt_01234567890123456789" }); const options = { hostname: "api.coupontools.com", port: 443, path: "/v4/webhook/verification", method: "POST", headers: { "X-Client-Id": client_id, "X-Client-Secret": client_secret, "Content-Type": "application/json", "Content-Length": data.length }, }; const req = https.request(options, (res) => { console.log(`statusCode: ${res.statusCode}`); res.on("data", (d) => { process.stdout.write(d); }); }); req.write(data); req.end();
Response
{ "status": { "status": "OK" }, "webhook": "evt_01234567890123456789", "datetime": "2020-12-01 01:23:45", "type": "coupon_claimed", "coupon": "cam_12345", "statcode": "012345678901234567890" }
Possible errors
200: Missing parameter: webhook
509: Webhook not found