Webhook Calls
Info! Do you have any questions on our Email API?
Write to us at support@sendclean.com
/settings/addWebhook
Add a new Webhook
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.addWebhook(url="http://abc.com/wh1.php", event="open,click", description="this webhook for only open and click", store_log="Enable")
print result
'''
{
"status" : "success",
"message" : "Webhook Added"
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"message" : "Webhook Added"
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
url* string |
a valid url ,that always response 'God bless you, SendClean' |
event string |
a valid events string with comma separated like 'send,open,click,soft_bounce,hard_bounce,spam' |
description string |
description about webhook |
store_log string |
value is Either 'Enable' OR 'Disable' |
* compulsory field
Return Value: Success |
struct |
the results of newly created webhook
status string |
always success |
message string |
human readable message |
|
|
Return Value: Error |
struct |
the error results when attempt to create webhook
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
/settings/editWebhook
Edit Webhook
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.editWebhook(webhook_id="424353120757587577493", url="http://abc.com/wh1.php", event=None, description=None, store_log="Disable")
print result
'''
{
"status" : "success",
"message" : "Webhook Edited"
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"message" : "Webhook Edited"
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
webhook_id* string |
a valid webhook_id |
url* string |
a valid url ,that always response 'God bless you, SendClean' |
event string |
a valid events string with comma separated like 'send,open,click,soft_bounce,hard_bounce,spam' |
description string |
description about webhook |
store_log string |
value is Either 'Enable' OR 'Disable' |
* compulsory field
Return Value: Success |
struct |
the results of updated Webhook
status string |
always success |
message string |
human readable message |
|
|
Return Value: Error |
struct |
the error results when attempt to update webhook details
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
/settings/keyResetWebhook
Key Reset for Webhook
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.keyResetWebhook(webhook_id="424353120757587577493")
print result
'''
{
"status" : "success",
"message" : "Webhook key reseted",
"webhook_id" : "424353120757587577493",
"message" : "2fg345gy6r7"
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"message" : "Webhook key reseted",
"webhook_id" : "424353120757587577493",
"message" : "2fg345gy6r7"
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
webhook_id* string |
a valid webhook id |
* compulsory field
Return Value:Success |
struct |
the results of key reset for Webhook
status string |
always success |
message string |
human readable message |
webhook_id string |
webhook id |
key string |
new key |
|
|
Return Value: Error |
struct |
the error results when attempt to key reset for Webhook
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
/settings/listWebhook
List Webhooks
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.listWebhook()
print result
'''
{
"status" : "success",
"webhook_list" : [
{
"webhook_id" : "424353445757557577457",
"url" : "http://abc.com/wh1.php",
"event" : "open,click",
"key" : "cgvddgrsd",
"store_log" : "Enable",
"description" : "this webhook for only open and click",
"create_date" : 754453534
},
{
"webhook_id" : "424353120757587577493",
"url" : "http://abc.com/wh1.php",
"event" : "soft_bounce,click",
"key" : "sdfgdggdgd",
"store_log" : "Disable",
"description" : "this webhook for only soft_bounce and click",
"create_date" : 8350953531
}
]
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"webhook_list" : [
{
"webhook_id" : "424353445757557577457",
"url" : "http://abc.com/wh1.php",
"event" : "open,click",
"key" : "cgvddgrsd",
"store_log" : "Enable",
"description" : "this webhook for only open and click",
"create_date" : 754453534
},
{
"webhook_id" : "424353120757587577493",
"url" : "http://abc.com/wh1.php",
"event" : "soft_bounce,click",
"key" : "sdfgdggdgd",
"store_log" : "Disable",
"description" : "this webhook for only soft_bounce and click",
"create_date" : 8350953531
}
]
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
* compulsory field
Return Value: Success |
struct |
the results of List Webhook
status string |
always success |
message string |
human readable message |
webhook_list[]struct |
information of single webhook
webhook_id string |
webhook id |
url string |
url |
event string |
event string with comma separated like 'open,click' |
description string |
description about webhook |
store_log string |
value of status is Either 'Enable' OR 'Disable' |
key integer |
key |
create_date integer |
create date in seconds |
|
|
|
|
Return Value: Error |
struct |
the error results when attempt to List Webhook
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
/settings/deleteWebhook
Delete Webhook
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.deleteWebhook(webhook_id="424353120757587577493")
print result
'''
{
"status" : "success",
"message" : "Webhook Deleted"
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"message" : "Webhook Deleted"
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
webhook_id* string |
valid webhook id |
* compulsory field
Return Value: Success |
struct |
the results of Delete webhook
status string |
always success |
message string |
human readable message |
|
|
Return Value: Error |
struct |
the error results when attempt to Delete webhook
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
/settings/getWebhookInfo
Get info of any webhook
try:
import SendClean
SendClean_client = SendClean.SendClean('owner_id', 'token', 'SendCleanTES_APP_DOMAIN')
result = SendClean_client.settings.getWebhookInfo(webhook_id="424353120757587577493")
print result
'''
{
"status" : "success",
"webhook_data" : {
"webhook_id" : "405602261459333060372",
"url" : "http://xyz.com/webhook3.php",
"event" : "open",
"description" : "this is desctiptyioj......",
"store_log" : "Enable",
"key" : "aVLnPysvkKUU95AFrb47Zr",
"create_date" : 1459333060,
"last_success" : 1459366666,
"total_event" : 23
}
}
'''
except SendClean.Error, e:
# SendCleanerrors are thrown as exceptions
print 'A SendCleanerror occurred: %s - %s' % (e.__class__, e)
{
"status" : "success",
"webhook_data" : {
"webhook_id" : "405602261459333060372",
"url" : "http://xyz.com/webhook3.php",
"event" : "open",
"description" : "this is desctiptyioj......",
"store_log" : "Enable",
"key" : "aVLnPysvkKUU95AFrb47Zr",
"create_date" : 1459333060,
"last_success" : 1459366666,
"total_event" : 23
}
}
{
"status": "error",
"code": -1,
"name": "AuthenticationError",
"message": "Token MissMatch"
}
Parameters |
owner_id* string |
a valid SendCleanUser Id |
token* string |
a valid token |
SendCleanTES_APP_DOMAIN* string |
a valid SendCleanTES APP DOMAIN |
webhook_id* string |
valid webhook id |
* compulsory field
Return Value: Success |
struct |
the results of webhook info
status string |
always success |
webhook_data struct |
information of webhook
webhook_id string |
smtp webhook id |
url string |
webhook url |
event string |
events with comma separate |
description string |
description |
store_log string |
value of store_log is Either 'Enable' OR 'Disable' |
key string |
key |
create_date integer |
create date |
last_success integer |
last success time |
total_event integer |
total event sent on webhook url |
|
|
|
Return Value: Error |
struct |
the error results when attempt to get webhook info
status string |
error |
message string |
human readable message |
type string |
one of the error type as bellow table |
|
|
Error types |
ValidationError |
The parameters passed to the API call are invalid or not provided when required. |
GeneralError |
An unexpected errors occurred processing the request. SendCleanDevelopers will be notified. |
AuthenticationError |
Provided owner_id and token was not matched. |
[{
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "6f708632d96fe1cb0cb15eccc2676323b2615d5309a7896cf002c54d1a6ea4785",
"ts": 1465890656000,
"msg": {
"bounceDesc": "Requested action not taken: mailbox unavailable ",
"bounceCodeTrad": 550,
"bounceCodeEnh": "5.2.2"
},
"event": "hard_bounce"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "5H708632d96ty7ub0cb15eccc2676323b2615d87879a7896cf002c54d1a6ea4893",
"ts": 1465890656000,
"msg": {
"bounceDesc": "smtp; 552 5.2.2 Over quota ",
"bounceCodeTrad": 472,
"bounceCodeEnh": "4.2.2"
},
"event": "soft_bounce"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "5H708632d96ty7ub0cb15eccc2676323b2615d87879a7896cf002c54d1a6ea4893",
"ts": 1465890656000,
"msg": {},
"event": "send"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "5H708632d96ty7ub0cb15eccc2676323b2615d87879a7896cf002c54d1a6ea4893",
"ts": 1465890656000,
"msg": {},
"event": "delivered"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "",
"ts": 1465988183000,
"msg": {
"clicks": [{
"clickTs": 1465988314000,
"clickUrl": "http://example.com/",
"clickIp": "0.0.0.0",
"clickUa": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36"
}]
},
"event": "click"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "",
"ts": 1465988314000,
"msg": {
"opens": [{
"openTs": 1465988314000,
"openIp": "0.0.0.0",
"openUa": "Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)"
}]
},
"event": "open"
}, {
"_id": "14304056-C18956K3-AX7C-41E4-8A14-7E1G4HJYCBCD.129.1",
"smtp_name": "smtp87654321",
"x_unique_id": "5H708632d96ty7ub0cb15eccc2676323b2615d87879a7896cf002c54d1a6ea4893",
"ts": 1465890656000,
"msg": {
"feedbackReport": "Arrival-Date: Tue, 14 June 2016 07:50:56 +0000\r\nOriginal-Rcpt-To: b0df23337efdcda913f1e8888014812b@example.com\r\nOriginal-Mail-From: b-60821810-purchase=example.com@example.org\r\nReported-Domain: example.org\r\nSource-Ip: 0.0.0.0\r\nFeedback-Type: abuse\r\nAbuse-Type: complaint\r\nUser-Agent: ReturnPathFBL/2.0\r\n"
},
"event": "spam"
}]
Webhook Authentication