Looping
Hey guys. I am encountering a problem with my chatbot. I have a web search that outputs products url but not their image (I am using serper) Is there a way to get the images aswell? My idea to get the images is to loop through the product url links and by using microlink to get image url. is there a way in Voiceflow to create loops? Thanks for help
16 Replies
Sure. There are a few ways. You really should not need to loop through if the image is in the output from serper. If you need to loop, you can write a VF Function. See the voiceflow docs for info on writing a VF Function.
@W. Williams (SFT) the image is not in the serper output. I only get url link of the product not the image. So then I want to loop the url of the products with microlink in order to get image url of each one
You can do that. You might consider writing a script using Replit or Cloudflare Workers to retrieve the data you need. Then write a function so the data is available to your Agent.
@W. Williams (SFT) Is it possible to do it within Voiceflow? I have all my links from the serper stored in variable and I am kinda lost on how to loop the url links inside api call of microlink...
Can you give me an example of a link that you want to get the image for?
@hrubasek
So that is gonna take some work, but it is doable.
<img alt="Swim&Relax Plavecká čepice Solid Color" class="cboxPhoto" src="https://cdn.myshoptet.com/usr/www.swim-relax.cz/user/shop/big/1605_swim-relax-plavecka-cepice-solid-color.jpg?659fdc54" style="cursor: pointer; width: 1024px; height: 768px; float: none;">
That is the image. You would need to browse to each page and pull out that data. It would be better to store the data in another database OR use the API provided by Shoptet (if they have one) to make it super easy.
@W. Williams (SFT) Thanks I dont have trouble extracting one image. I just need to extract it for every link. The way that I thought about this is using this api call: [GET ]https://api.microlink.io/?url=
after the url = all my links would loop...
@W. Williams (SFT) If I manage this I think this could be really nice because you could really skip all database and just use web search. So thank you for any help
You really need to use a Function for this. It is super easy. I personally can't help you, but I can give you a Custom GPT to help you write the function.
@W. Williams (SFT) that would be great
ChatGPT
ChatGPT - Voiceflow Function Creator
Assists in creating JavaScript functions for Voiceflow with formal guidance.
make sure to provide the curl requests or example api call.
thank you!
and what you want back from it.
again, I would love to help one-on-one but I just don't have the time (I have to go to my real job). BTW: I don't work for VF 😎
Totally understand, Have a good one 🙂