SDKs
Official client libraries to help you integrate Brighten into your applications quickly.
TypeScript
Official
Installation
npm install @brighten/sdkAlso available via yarn and pnpm.
Quick Setup
import { createClient } from '@brighten/sdk';
const brighten = createClient({
apiKey: 'brtn_live_sk_your_key_here',
// Optional:
// baseUrl: 'https://api.hellobrighten.com',
// timeout: 30000,
});Usage Examples
List recognitions
const { data, pagination } = await brighten.recognitions.list({
page: 1,
limit: 10,
});
console.log(`Page ${pagination.page} of ${pagination.total_pages}`);
data.forEach((rec) => console.log(`${rec.sender.name} recognized ${rec.recipient.name}`));Send a recognition
const { data: recognition } = await brighten.recognitions.create({
recipient_id: '550e8400-e29b-41d4-a716-446655440001',
message: 'Great job on the quarterly review!',
points: 25,
});
console.log(`Sent! ID: ${recognition.id}`);Get analytics
const { data: analytics } = await brighten.analytics.summary('30d');
console.log(`${analytics.total_recognitions} recognitions this month`);
console.log(`${analytics.participation_rate}% participation rate`);Error handling
import { BrightenApiError } from '@brighten/sdk';
try {
await brighten.recognitions.create({ recipient_id: 'invalid-id', message: 'Hello!' });
} catch (err) {
if (err instanceof BrightenApiError) {
console.error(`API Error ${err.status}: ${err.code} - ${err.message}`);
}
}Available Resources
All resource methods available on the client
brighten.recognitions.list(params?).get(id).create(params).delete(id)brighten.users.list(params?).get(id)brighten.rewards.list(params?).get(id)brighten.teams.list(params?).get(id)brighten.webhooks.list().get(id).create(params).update(id, params).delete(id)brighten.budgets.list().get(id)brighten.analytics.summary(period?)Other Languages
Community SDKs are coming soon. In the meantime, use our REST API directly from any language.
Python
import requests
response = requests.get(
"https://api.hellobrighten.com/v1/recognitions",
headers={"Authorization": "Bearer brtn_live_sk_..."}
)
data = response.json()Go
req, _ := http.NewRequest("GET",
"https://api.hellobrighten.com/v1/recognitions", nil)
req.Header.Set("Authorization", "Bearer brtn_live_sk_...")
resp, _ := http.DefaultClient.Do(req)Ruby
uri = URI("https://api.hellobrighten.com/v1/recognitions")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer brtn_live_sk_..."
response = Net::HTTP.start(uri.hostname, uri.port,
use_ssl: true) { |http| http.request(req) }cURL
curl -H "Authorization: Bearer brtn_live_sk_..." \
https://api.hellobrighten.com/v1/recognitionsFor the full list of endpoints, see the API Reference. For webhook integration, check the Webhooks Documentation.
Ready to build?
Sign up for free and start integrating today.