Skip to content

Latest commit

 

History

History
83 lines (70 loc) · 1.79 KB

README.md

File metadata and controls

83 lines (70 loc) · 1.79 KB

Webhooks

List all webhooks

Official Documentation


mailerlite.webhooks.get()
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });

Get a webhook

Official Documentation


mailerlite.webhooks.find("WEBHOOK_ID")
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });

Create a webhook

Official Documentation


const params = {
  name: "Test webhook",
  events: ["subscriber.updated"],
  url: "http://www.marvin.com/omnis-accusamus-est-rem-delectus-quaerat.html"
};

mailerlite.webhooks.create(params)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });

Update a webhook

Official Documentation


const params = {
  name: "Test webhook updated",
  enabled: false
};

mailerlite.webhooks.update(params)
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });

Delete a webhook

Official Documentation


mailerlite.webhooks.delete("WEBHOOK_ID")
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    if (error.response) console.log(error.response.data);
  });