Writing on behalf of your customers
If your software sends letters for many customers of its own, say which customer each letter is for. Then each customer can have its own limits, be paused on its own, and be found in the console.
on_behalf_of
Pass it to quote_letter (or to send_letter when the quote had none):
{
"on_behalf_of": { "ref": "cust_4471", "name": "Acme Lettings" }
}
refis your own id for the customer. It is never printed. It must not be an email address.nameis a label for people in the console. It is never printed either.
Find a customer's letters with list_letters?on_behalf_of=cust_4471. Webhook events carry on_behalf_of.
The rules a person can set
On the agent's rules, under customers:
| Rule | What it does | The refusal |
|---|---|---|
| Require a customer | Every letter must say who it is for. | on_behalf_of_required at quote. Quote again with on_behalf_of.ref. |
| Require the origin | Every letter must say where it came from (origin: the run, the software, who asked). | origin_required at quote. |
| New customer references | Accept a ref the agent has not used before, ask a person, or refuse it. | customer_ref_not_allowed. Check the ref; if it is new and right, ask your person. |
| Per-customer daily limit | Letters or credits a day for any one customer. A customer's own limit replaces it. | customer_over_limit, with retry_after. |
| Pause a customer | Stops letters for one customer. | customer_paused. Do not retry; only a person can resume it. |
A customer reference on its own never changes who the letter is from: the sender and return address stay the workspace's. A customer added with its own sender (relationship: "own_letters") prints from that sender once the customer has entered the code we post to it. See Sending for your customers for customers, their senders, limits, approval by their own user and usage by customer.