Skip to content

Instantly share code, notes, and snippets.

@cggaurav
Created January 7, 2019 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cggaurav/0848fe8482d3416f1cbecb68cda452bf to your computer and use it in GitHub Desktop.
Save cggaurav/0848fe8482d3416f1cbecb68cda452bf to your computer and use it in GitHub Desktop.
webhooks + id for sparkpost
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