Created
January 7, 2019 09:27
-
-
Save cggaurav/0848fe8482d3416f1cbecb68cda452bf to your computer and use it in GitHub Desktop.
webhooks + id for sparkpost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client.inboundDomains.list() | |
.then((data) => { | |
console.log('List of all inbound domains', data) | |
}) | |
.catch((err) => { | |
console.log('Whoops! Something went wrong') | |
console.log(err) | |
}) | |
client.inboundDomains.create({ domain: 'test.gratefuldiary.co'}) | |
.then((data) => { | |
console.log('Created inbound domains', data) | |
}) | |
.catch((err) => { | |
console.log('Whoops! Something went wrong') | |
console.log(err) | |
}) | |
client.relayWebhooks.list() | |
.then((data) => { | |
console.log('List of all relayWebhooks', JSON.stringify(data)) | |
}) | |
.catch((err) => { | |
console.log('Whoops! Something went wrong') | |
console.log(err) | |
}) | |
client.relayWebhooks.delete('2819730587355881878') | |
.then((data) => { | |
console.log('Deleted relaywebhook', data) | |
}) | |
.catch(err => { | |
console.log('Whoops! Something went wrong') | |
console.log(err) | |
}) | |
client.relayWebhooks.create({ | |
name: 'All incoming webhooks', | |
target: 'https://gratefuldiary.co/email', | |
match: { | |
// protocol: "SMTP", | |
domain: "www.gratefuldiary.co", | |
}, | |
}) | |
.then((data) => { | |
console.log('Created incoming webhook') | |
console.log(data) | |
}) | |
.catch((err) => { | |
console.log('Whoops! Something went wrong') | |
console.log(err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment