Blog

Building an AI-Powered Meditation Generator API with BuildShip

Tutorial

·

Jan 15, 2024

Bhavya Verma

Engineering

Have you ever wanted to build an AI-powered meditation generator? Well, look no further! In this blog post, we'll guide you through the process of building your very own AI-powered meditation generator API using BuildShip, a low-code visual backend builder. With BuildShip, you can create powerful APIs and backend functions without being a coding expert. Let's dive in and see just how easy it is!

Getting Started with BuildShip

The first step is to login to the BuildShip dashboard. Once you're in, you'll find yourself on the templates page, where you'll see a variety of templates available to help you get started building your own backend. For this project, we'll select the "Meditate GPT" template.

Exploring the Workflow

After selecting the template, you'll find yourself with a fully completed workflow, ready for deployment. This workflow includes all the necessary nodes to generate a meditation session using the power of OpenAI's GPT model.

Understanding the Workflow

Let's take a moment to go through each node in the workflow to gain a good understanding of what's happening. Each node will be executed sequentially from top to bottom.

  • Trigger Node: The trigger node acts as the entry point of the workflow. In this case, we're using the rest API call trigger, which allows us to kick-start the execution of the workflow. It expects two inputs: the endpoint path ("generate meditation") and the HTTP method (POST).

  • OpenAI Chat Node: This node uses the OpenAI API to generate the meditation script. We set our OpenAI API key in the secrets section and provide the necessary instructions to GPT to generate the script. We specify the duration of the meditation script, which can be passed in the request body. The user request describes the meditation session we want to generate.

  • Parse JSON Node: The JSON output from the OpenAI chat node is converted into a valid JavaScript object using the parse JSON node. This allows us to easily work with the meditation script.

  • Loop Node: We iterate through each item in the vocals array of the meditation script and convert the text to speech using the playHT integration node. We set our playHT API key in the secrets section, allowing us to use the playHT text node to convert the text to speech.

  • Combined Audio Node: The combined audio node takes the audio URLs generated by the playHT integration node, along with the specified duration and the vocals array from the parse JSON node. It uses the FFmpeg package to combine the audio URLs and a relaxing background music into one audio clip. The combined audio file is then written to a local file path.

  • Upload to Cloud Storage Node: The combined audio file is uploaded to the default cloud storage bucket provided by BuildShip. We specify the file to upload and the destination in the cloud storage bucket.

  • Return Node: Finally, we use the return node to provide the publicly accessible URL of the meditation audio file. This URL can be used to listen to the meditation session.

Testing the Workflow

Once you've deployed the workflow, it becomes live and publicly accessible. To test the workflow, you can copy the endpoint URL and make a POST request to it. In the body of the request, you can set the description of the meditation session and the desired duration. The workflow will generate a meditation session based on your inputs and provide you with a publicly accessible URL of the meditation audio.

Conclusion

In just a few simple steps, you've successfully built your own AI-powered meditation generator API using BuildShip. With minimal coding required, you were able to bring your innovative idea to life. So, what are you waiting for? Start creating with BuildShip and see where your creativity takes you!

Stay tuned for more exciting projects and until the next one.

That's all for today!

Have you ever wanted to build an AI-powered meditation generator? Well, look no further! In this blog post, we'll guide you through the process of building your very own AI-powered meditation generator API using BuildShip, a low-code visual backend builder. With BuildShip, you can create powerful APIs and backend functions without being a coding expert. Let's dive in and see just how easy it is!

Getting Started with BuildShip

The first step is to login to the BuildShip dashboard. Once you're in, you'll find yourself on the templates page, where you'll see a variety of templates available to help you get started building your own backend. For this project, we'll select the "Meditate GPT" template.

Exploring the Workflow

After selecting the template, you'll find yourself with a fully completed workflow, ready for deployment. This workflow includes all the necessary nodes to generate a meditation session using the power of OpenAI's GPT model.

Understanding the Workflow

Let's take a moment to go through each node in the workflow to gain a good understanding of what's happening. Each node will be executed sequentially from top to bottom.

  • Trigger Node: The trigger node acts as the entry point of the workflow. In this case, we're using the rest API call trigger, which allows us to kick-start the execution of the workflow. It expects two inputs: the endpoint path ("generate meditation") and the HTTP method (POST).

  • OpenAI Chat Node: This node uses the OpenAI API to generate the meditation script. We set our OpenAI API key in the secrets section and provide the necessary instructions to GPT to generate the script. We specify the duration of the meditation script, which can be passed in the request body. The user request describes the meditation session we want to generate.

  • Parse JSON Node: The JSON output from the OpenAI chat node is converted into a valid JavaScript object using the parse JSON node. This allows us to easily work with the meditation script.

  • Loop Node: We iterate through each item in the vocals array of the meditation script and convert the text to speech using the playHT integration node. We set our playHT API key in the secrets section, allowing us to use the playHT text node to convert the text to speech.

  • Combined Audio Node: The combined audio node takes the audio URLs generated by the playHT integration node, along with the specified duration and the vocals array from the parse JSON node. It uses the FFmpeg package to combine the audio URLs and a relaxing background music into one audio clip. The combined audio file is then written to a local file path.

  • Upload to Cloud Storage Node: The combined audio file is uploaded to the default cloud storage bucket provided by BuildShip. We specify the file to upload and the destination in the cloud storage bucket.

  • Return Node: Finally, we use the return node to provide the publicly accessible URL of the meditation audio file. This URL can be used to listen to the meditation session.

Testing the Workflow

Once you've deployed the workflow, it becomes live and publicly accessible. To test the workflow, you can copy the endpoint URL and make a POST request to it. In the body of the request, you can set the description of the meditation session and the desired duration. The workflow will generate a meditation session based on your inputs and provide you with a publicly accessible URL of the meditation audio.

Conclusion

In just a few simple steps, you've successfully built your own AI-powered meditation generator API using BuildShip. With minimal coding required, you were able to bring your innovative idea to life. So, what are you waiting for? Start creating with BuildShip and see where your creativity takes you!

Stay tuned for more exciting projects and until the next one.

That's all for today!

Have you ever wanted to build an AI-powered meditation generator? Well, look no further! In this blog post, we'll guide you through the process of building your very own AI-powered meditation generator API using BuildShip, a low-code visual backend builder. With BuildShip, you can create powerful APIs and backend functions without being a coding expert. Let's dive in and see just how easy it is!

Getting Started with BuildShip

The first step is to login to the BuildShip dashboard. Once you're in, you'll find yourself on the templates page, where you'll see a variety of templates available to help you get started building your own backend. For this project, we'll select the "Meditate GPT" template.

Exploring the Workflow

After selecting the template, you'll find yourself with a fully completed workflow, ready for deployment. This workflow includes all the necessary nodes to generate a meditation session using the power of OpenAI's GPT model.

Understanding the Workflow

Let's take a moment to go through each node in the workflow to gain a good understanding of what's happening. Each node will be executed sequentially from top to bottom.

  • Trigger Node: The trigger node acts as the entry point of the workflow. In this case, we're using the rest API call trigger, which allows us to kick-start the execution of the workflow. It expects two inputs: the endpoint path ("generate meditation") and the HTTP method (POST).

  • OpenAI Chat Node: This node uses the OpenAI API to generate the meditation script. We set our OpenAI API key in the secrets section and provide the necessary instructions to GPT to generate the script. We specify the duration of the meditation script, which can be passed in the request body. The user request describes the meditation session we want to generate.

  • Parse JSON Node: The JSON output from the OpenAI chat node is converted into a valid JavaScript object using the parse JSON node. This allows us to easily work with the meditation script.

  • Loop Node: We iterate through each item in the vocals array of the meditation script and convert the text to speech using the playHT integration node. We set our playHT API key in the secrets section, allowing us to use the playHT text node to convert the text to speech.

  • Combined Audio Node: The combined audio node takes the audio URLs generated by the playHT integration node, along with the specified duration and the vocals array from the parse JSON node. It uses the FFmpeg package to combine the audio URLs and a relaxing background music into one audio clip. The combined audio file is then written to a local file path.

  • Upload to Cloud Storage Node: The combined audio file is uploaded to the default cloud storage bucket provided by BuildShip. We specify the file to upload and the destination in the cloud storage bucket.

  • Return Node: Finally, we use the return node to provide the publicly accessible URL of the meditation audio file. This URL can be used to listen to the meditation session.

Testing the Workflow

Once you've deployed the workflow, it becomes live and publicly accessible. To test the workflow, you can copy the endpoint URL and make a POST request to it. In the body of the request, you can set the description of the meditation session and the desired duration. The workflow will generate a meditation session based on your inputs and provide you with a publicly accessible URL of the meditation audio.

Conclusion

In just a few simple steps, you've successfully built your own AI-powered meditation generator API using BuildShip. With minimal coding required, you were able to bring your innovative idea to life. So, what are you waiting for? Start creating with BuildShip and see where your creativity takes you!

Stay tuned for more exciting projects and until the next one.

That's all for today!

Start building your
BIGGEST ideas
in the *simplest* of ways.

Start building your
BIGGEST ideas
in the *simplest* of ways.

Start building your
BIGGEST ideas
in the *simplest* of ways.

You might also like