Hello everyone,
I’m struggling to figure out how to pass the previous step content to Eleven Labs Code.
What I want to do is to have an audio made from chatgpt text. So, I want to pass the chatgpt content to eleven labs and then return the audio back to Pipedream.
Anyone can help with this?
(I added both Javascript and Python code so you can work with the one that suits you best)
Thank you
Javascript :
import { axios } from “@pipedream/platform”
export default defineComponent({
props: {
elevenlabs: {
type: “app”,
app: “elevenlabs”,
}
},
async run({steps, $}) {
return await axios($, {
url: https://api.elevenlabs.io/v1/user
,
headers: {
“Accept”: application/json
,
“xi-api-key”: ${this.elevenlabs.$auth.api_key}
,
},
})
},
})
Python Version :
import requests
def handler(pd: “pipedream”):
headers = {“Accept”: ‘application/json’, “xi-api-key”: f’{pd.inputs[“elevenlabs”][“$auth”][“api_key”]}'}
r = requests.get(‘https://api.elevenlabs.io/v1/user’, headers=headers)
Export the data for use in future steps
return r.json()