Skip to content

Trigger Inbound Rules

Igor Balos edited this page Oct 29, 2018 · 1 revision

Inbound rules allow you to filter out email which is going to be processed. If it matches rules, it can be rejected.

For these API requests you will need to use a server API token. Once you obtain it, you will need to use server API client.

const serverToken = "xxxx-xxxxx-xxxx-xxxxx-xxxxxx"
let postmark = require("postmark")
let client = new postmark.ServerClient(serverToken);

Create an inbound rule.

client.createInboundRuleTrigger({Rule: "example.com"}).then(result => {
    console.log(result.Rule);
    console.log(result.ID);
});

Retrieve all inbound rules.

client.getInboundRuleTriggers().then(result => {
    console.log(result.TotalCount);
    console.log(result.InboundRules[0].Rule);
    console.log(result.InboundRules[0].ID);
});

Delete an inbound rule.

client.deleteInboundRuleTrigger(123456).then(result => {
    console.log(result.Message);
    console.log(result.ErrorCode);
});