Cookbook
Integrate with an existing pipeline
Wire Bedrock into your back-office without rewriting it. The pattern is the same regardless of what your existing system looks like.
You already have a system that produces advice — Intelliflo, Iress XPLAN, an in-house Salesforce build, a Python notebook, whatever. The job is to add Bedrock without ripping that system out. There are three integration points.
1. The submission hook
Wherever your existing system finalises a piece of advice, add a single call to Bedrock to submit it for review. This can be:
- A workflow step in your back-office BPM
- A database trigger watching the “advice ready” state
- A message-queue consumer picking up “advice.finalised” events
- A scheduled job submitting whatever was completed in the last hour
async function onAdviceFinalised(advice: Advice) {
const { jobId } = await bedrock.submitAdvice({
documentType: 'SUITABILITY_REPORT',
documentUrl: await presignedUrlFor(advice.documentId),
clientReference: advice.id,
modelProvider: advice.modelProvider,
modelVersion: advice.modelVersion,
metadata: { adviser: advice.adviserId, product: advice.productCode },
});
await db.advice.update({ where: { id: advice.id }, data: { bedrockJobId: jobId } });
}2. The webhook receiver
See Handle a webhook. This is the path that updates your customer record with the certificate URL.
3. The reconciliation job
Even with webhooks, you should reconcile periodically — say nightly — to catch any events you missed during downtime. Pull the firm's ledger forward from your last-seen sequence and reconcile against your local mirror.
async function reconcile() {
const lastSeen = await db.config.get('bedrock.lastSequence') ?? 0;
const { entries, nextSequence } = await bedrock.ledger.list({ from: lastSeen + 1 });
for (const entry of entries) {
await applyEntry(entry);
}
await db.config.set('bedrock.lastSequence', nextSequence);
}What not to do
- Don't make Bedrock submission synchronous with adviser submission. Queue it; treat the submission as fire-and-forget with a retry on failure.
- Don't rely solely on webhooks. They're at-least-once, but networks fail; reconcile.
- Don't skip reconciliation. The whole point of Bedrock is that the records exist independently of your system; if the two diverge, the ledger is the truth.