Libraries and integrations
The fastest way to start: drop in a small client instead of writing HTTP calls yourself. They're open source, have no dependencies, and handle errors the same way everywhere. Prefer to call the API directly? See the API docs.
The Ruby and Node packages are about to be published. Until they are, call the API directly with any HTTP client.
Official libraries
Ruby
gem · v0.1
Works with Rails, Sinatra or plain Ruby 2.7+.
install
gem install opentrust
# or in your Gemfile
gem "opentrust"
use
client = OpenTrust::Client.new
# reads OPENTRUST_API_KEY
result = client.lookup(order.phone)
flag_for_review(order) if result.reported?
Node.js
npm · v0.1
Node 18+, ES modules, TypeScript types included.
install
npm install opentrust
use
import { OpenTrust } from "opentrust";
const ot = new OpenTrust();
// reads OPENTRUST_API_KEY
const result = await ot.lookup(order.phone);
if (result.reported) flagForReview(order);
What every library does
- Same four calls: check one number, check many (up to 100), share an experience, and see your remaining checks.
- Typed errors: a missing key, no checks left, a duplicate report, a bad number and a rate limit each raise their own error, so you can handle them directly.
- Short timeouts: 5 seconds by default, so a slow response never holds up your checkout.
- The notice travels with the result: every result carries the reminder that reports are unverified observations. Please show it to anyone who sees a result.
Please don't block checkout on OpenTrust
Use results as one input, have a person review decisions that matter, and carry on if OpenTrust can't be reached:
fail open
begin
result = client.lookup(order.phone)
flag_for_review(order) if result.reported?
rescue OpenTrust::Error => e
logger.warn("OpenTrust unavailable: #{e.message}") # carry on
end
On the way
Most Indian online stores run on a platform, so we're starting there. Each will check the billing number at checkout and flag the order for review, rather than blocking it.
WooCommerce · Plugin for WordPress stores
In testing
Shopify · App for Shopify stores
In development
Python · Package for Django, Flask and scripts
Planned
PHP · Package for Laravel and plain PHP
Planned
Using something else, or want to help build one? Tell us.