Skip to content

Trigger Tags

Igor Balos edited this page Oct 3, 2018 · 3 revisions

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.

server_token = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
client = Postmark::ApiClient.new(server_token)

Create new trigger

api_client.create_trigger(:tags, :match_name => "my-tag", :track_opens => true)

# => {:id=>42, :match_name=>"my-tag", :track_opens=>true}

Get tag trigger details

api_client.get_trigger(:tags, 42)

# => {:id=>42, :match_name=>"my-tag", :track_opens=>true} 

To update a trigger by ID, use #update_trigger method.

Update existing trigger

api_client.update_trigger(:tags, 42, :match_name => "my-tag-renamed", :track_opens => true)

# => {:id=>42, :match_name=>"my-tag-renamed", :track_opens=>true}

Remove existing trigger

api_client.delete_trigger(:tags, 42)

# => {:error_code=>0, :message=>"Tag 42 removed."} 

List all triggers

api_client.triggers(:tags).take(20)

# => [{:id=>42, :match_name=>"my-tag-renamed", :track_opens=>true}]