Hërzouz
Hërzouz2mo ago

Amazon Polly API

Hello Buildshipers! I am trying to create a workflow that connects to Amazon Polly API. Is this possible? I am a total noob when it comes to buildship. If you have any tips or ideas i am totaly focused on your returns. Now, i am here: import { PollyClient, SynthesizeSpeechCommand } from "@aws-sdk/client-polly"; const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID; const AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY; const AWS_REGION = process.env.AWS_REGION; if (!AWS_ACCESS_KEY_ID !AWS_SECRET_ACCESS_KEY !AWS_REGION) { throw new Error('AWS credentials or region are not set in environment variables'); } export default async function synthesizeSpeech({ text, voiceId, format = 'mp3', sampleRate = '8000', textType = 'text', region, engine = 'neural', languageCode }) { const awsRegion = region || AWS_REGION; if (!awsRegion) { throw new Error('Region is missing'); } const client = new PollyClient({ region: awsRegion, credentials: { accessKeyId: AWS_ACCESS_KEY_ID, secretAccessKey: AWS_SECRET_ACCESS_KEY } }); const input = { Text: text, OutputFormat: format, VoiceId: voiceId, SampleRate: sampleRate, TextType: textType, Engine: engine, LanguageCode: languageCode }; const command = new SynthesizeSpeechCommand(input); try { const { AudioStream, ContentType } = await client.send(command); if (AudioStream && ContentType === 'audio/mpeg') { let audioBuffer = []; for await (let chunk of AudioStream) { audioBuffer.push(chunk); } return Buffer.concat(audioBuffer).toString('base64'); } throw new Error('AudioStream is empty or ContentType is not MP3'); } catch (error) { throw new Error(Error synthesizing speech: ${error.message}); } } / Cheers!
Solution:
Hi @Hërzouz You can also generate a node with AI fir the Amazon Polly API - https://www.youtube.com/watch?v=AawYfYW8xu0
BuildShip
YouTube
Generating Custom Nodes with AI - BuildShip AI Workflow Builder
Get started with BuildShip for FREE 👉 https://buildship.com A Low-code Visual Backend Builder with AI 💬 Chat and build together with a community of no-code/low-code developers: https://buildship.com/discord 🐦 Tweets: https://twitter.com/buildshipapp #nocode #backend #apibuilder #lowcode #cronjob #scheduledtask #backgroundjob #googlecloud #ope...
Jump to solution
3 Replies
AI Support
AI Support2mo ago
To connect to the Amazon Polly API using BuildShip, you can create a custom node to handle the integration. However, since you're new to BuildShip, I recommend starting with the basics of creating and configuring nodes. Here's a general approach: 1. Create a Custom Node: You can create a custom node in BuildShip to interact with the Amazon Polly API. This involves setting up the node to accept inputs such as text, voice ID, and format, and then using the AWS SDK to synthesize speech. 2. Set Environment Variables: Ensure your AWS credentials and region are set up as environment variables in BuildShip. 3. Use the AWS SDK: In your custom node, use the AWS SDK to interact with the Polly API. The code you provided is a good starting point for this. Since there isn't a specific BuildShip documentation link for integrating Amazon Polly, I recommend submitting this via the in-app support button for more detailed guidance tailored to your specific use case. If you need further assistance or have specific questions about creating custom nodes in BuildShip, feel free to ask!
Solution
Gaurav Chadha
Gaurav Chadha2mo ago
Hi @Hërzouz You can also generate a node with AI fir the Amazon Polly API - https://www.youtube.com/watch?v=AawYfYW8xu0
BuildShip
YouTube
Generating Custom Nodes with AI - BuildShip AI Workflow Builder
Get started with BuildShip for FREE 👉 https://buildship.com A Low-code Visual Backend Builder with AI 💬 Chat and build together with a community of no-code/low-code developers: https://buildship.com/discord 🐦 Tweets: https://twitter.com/buildshipapp #nocode #backend #apibuilder #lowcode #cronjob #scheduledtask #backgroundjob #googlecloud #ope...
Hërzouz
Hërzouz2mo ago
Hey! Thank you for your reply! Yes i am getting there, it's not perfect yet but it is working!