fastify-xwhatconverts
recordings.getBuffer
Fetch the MP3 call recording for a WhatConverts lead as a Node.js Buffer.
recordings.getBuffer
Fetch the MP3 call recording for a lead and return it as a Node.js Buffer. Internally calls recordings.get and wraps the result with Buffer.from.
Signature
fastify.xwhatconverts.recordings.getBuffer(leadId: string): Promise<Buffer>
Params
| Name | Type | Required | Description |
|---|---|---|---|
leadId | string | Yes | The WhatConverts lead ID with an associated call recording. |
Returns
A Buffer containing the MP3 audio data.
Throws
[xWhatConverts] recordings.getBuffer: leadId is required— called withoutleadId.[xWhatConverts] Network error: <message>— network-level failure.[xWhatConverts] API error: <status>— non-2xx response;404if no recording exists.
Examples
Basic — save recording to disk
import { writeFile } from "fs/promises";
const buffer = await fastify.xwhatconverts.recordings.getBuffer("123456");
await writeFile("call-recording.mp3", buffer);
Realistic — upload recording to S3 after call
fastify.post("/leads/:id/archive-recording", async (request, reply) => {
const { id } = request.params;
const buffer = await fastify.xwhatconverts.recordings.getBuffer(id);
const result = await fastify.xStorage.upload(buffer, `${id}.mp3`, {
folder: "recordings",
contentType: "audio/mpeg",
});
return { key: result.key, url: result.url };
});
See Also
- recordings.get — get as
ArrayBufferinstead - recordings.getUrl — get the URL without fetching data
AI Context
package: "@xenterprises/fastify-xwhatconverts"
method: fastify.xwhatconverts.recordings.getBuffer(leadId)
use-when: Fetch a WhatConverts call recording as a Node.js Buffer — convenient for file writes or S3 uploads
params: leadId (string, required)
returns: Buffer containing MP3 audio data
