banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Cloud

banshee/cloud-collection/cloud/mandrill/https/

account

The reputation, the hourly quota and the emails held by the quota of a Mailchimp Transactional (Mandrill) account, by its API.

  • cloud
  • mailchimp
  • mandrill
  • transactional
  • email
  • reputation
  • quota
  • https
  • api

by banshee0 installations1 version

v1Latest

Published on October 27, 2026. First version.

Keen 1.0.0 · 36 lines
// The account of Mailchimp Transactional (formerly Mandrill), by its API with an API key: the reputation of the
// account, its hourly quota, and the emails held back because the quota is reached.
// Reads POST https://mandrillapp.com/api/1.4/users/info.
need('protocol:http');
$key = need('protocol:http:token');

output('reputation', 'number', array('label' => 'Reputation'));
output('hourly-quota', 'number', array('label' => 'Hourly quota', 'unit' => 'emails/h'));
output('backlog', 'number', array('label' => 'Held by the quota', 'unit' => 'emails'));

watch.below('low-reputation', 'Reputation low', 'reputation', array('warning' => 75, 'critical' => 50));
watch.below('low-quota', 'Hourly quota low', 'hourly-quota');
watch.above('backlog', 'Emails held by the quota', 'backlog', array('warning' => 0, 'for' => '3 runs'));

// The account's figures, by users/info. The API takes its key in the JSON body only, and documents no other
// way: the body carries a secret, which would make the whole answer secret. The answer holds the figures of the
// account and never the key, so the call declares it free of tokens, public=true; a part of it that held the
// key would still be secret.
function users_info($key) {
    $answer = http.post('https://mandrillapp.com/api/1.4/users/info', json.write(array('key' => $key)),
        headers=array('Content-Type' => 'application/json'), public=true);
    if ($answer['status'] == 401) {
        fail('misconfigured', 'Mailchimp Transactional refuses the API key, code 401',
            'The key is wrong or revoked, or it may not call users/info.');
    }
    if ($answer['status'] != 200) {
        fail('unreachable', 'Mailchimp Transactional answers users/info with code ' . $answer['status']);
    }
    return json.read($answer['body']);
}

// {"username": "…", "reputation": 82, "hourly_quota": 250, "backlog": 0, "stats": {"today": {…}, …}, …}
$info = users_info($key);
value('reputation', $info['reputation']);
value('hourly-quota', $info['hourly_quota']);
value('backlog', $info['backlog']);