Pull and Save Recordings to Supabase
# support
m
Hello! It seems like VAPI has documentation for storing audio recordings to GCP, Cloudflare and AWS but was wondering if I could store on Supabase. I don't see a way to pull audio recording with the server SDK.
v
@Mistermanu#000 Hello! While VAPI's documentation may not explicitly mention storing audio recordings on Supabase, you can certainly implement a solution to store your audio files there. Since Supabase provides object storage similar to AWS S3, you can use the server SDK to first retrieve the audio recordings and then use Supabase's API or SDK to upload the files to your Supabase storage bucket. To pull audio recordings with the server SDK, you would typically use the relevant methods provided by the SDK to access the audio data. If you need guidance on how to do this, I can assist you with more detailed instructions or direct you to the appropriate part of the documentation. Would you like to proceed with that?
You can continue this conversation by mentioning me in the message.
m
@Vapi Yes I need guidance on how to pull the audio using the server SDK. I could not find the method...
v
@Mistermanu#000 I understand you're looking to retrieve audio recordings using the server SDK. To assist you effectively, I would need to know which server SDK you are referring to, as VAPI might not provide a direct method for this action. Typically, to retrieve audio recordings, you would use an API endpoint provided by the service that handles the audio data. If VAPI has such an endpoint, you would make an HTTP request to that endpoint, authenticate as necessary, and then download the audio file. Once you have the audio file, you can use the Supabase client library to upload the file to your Supabase storage bucket. Here's a general outline of the steps you would take: 1. Use the VAPI server SDK or API to retrieve the audio recording. This usually involves making an authenticated request to an API endpoint that returns the audio file or a link to the file. 2. Initialize the Supabase client with your project credentials. 3. Use the Supabase storage API to upload the audio file to your bucket. If you provide me with the specific server SDK you're using, I can give you more detailed instructions. Otherwise, please ask support for more info on this.
m
@Vapi I'm using the server SDK for Typescript. But I couldn't find the right properties and endpoint to call...
v
@Mistermanu#000 If you're using the TypeScript server SDK for VAPI and you're unable to find the specific method or endpoint to retrieve audio recordings, it's possible that this functionality might not be directly exposed through the SDK, or it may require accessing a lower-level API. Typically, SDKs provide a wrapper around HTTP API calls, so you might need to: 1. Check the official VAPI documentation for an HTTP API endpoint that allows you to retrieve audio recordings. 2. Look for any examples or guides in the documentation that demonstrate how to interact with this endpoint using the TypeScript SDK. 3. If the SDK doesn't provide a method for this, you might need to make a direct HTTP request to the VAPI endpoint using a library like
axios
or the native
fetch
API in TypeScript. Here's a generic example of how you might use
fetch
to retrieve an audio file:
Copy code
typescript
const getAudioRecording = async (audioId: string) => {
  const response = await fetch(`https://api.vapi.com/audio/${audioId}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_TOKEN',
      // Other headers as required by the API
    },
  });

  if (!response.ok) {
    throw new Error(`Error fetching audio: ${response.statusText}`);
  }

  return await response.blob();
};

// Usage
getAudioRecording('your-audio-id')
  .then(blob => {
    // Handle the audio blob, such as uploading to Supabase
  })
  .catch(error => {
    console.error('Failed to retrieve audio recording:', error);
  });
Please replace
'https://api.vapi.com/audio/${audioId}'
with the actual endpoint and
'YOUR_API_TOKEN'
with your actual API token. If you're still having trouble finding the right properties and endpoint, I recommend reaching out to VAPI support for more detailed guidance on how to use their TypeScript SDK to retrieve audio recordings.
s
@Mistermanu#000 By default we only allow to store recordings in AWS, GCP and Cloudflare but you can raise the feature request over here https://vapi.canny.io to add supabase.
You can also pull all of the recordings from GET /call/:id endpoint and can store in your choice of provider.
m
ohh ok thanks yea that's what I meant! I couldn't find the correct parameters and had missed the recordingPath on the Get /call/ response. Thanks!