Custom action error - send pictures from Adalo

We are trying to connect Adalo with our side server, where we have the ML model to detect certain parameters in the pictures, which users take in Adalo app.

Normally we would send via api the url of the picture from Adalo to our server and the server should return the response (text).

But both get and post requests don’t work when we set up external collection and test the connection. However without Adalo the model and requests work.

Here is the example of the request:

import requests

url = ‘https://diagnio.taroff.io/api/predict

response = requests.get(url, {‘image_url’: ‘https://adalo-uploads.imgix.net/0303c6179dd97f43f256635ea38f191da6f2bdaafe2147a4064c39fab7c5c3a1.jpg?orient=&auto=compress’})

if response.status_code == 200:
result = response.json()
print(result)
else:
print(‘Error:’, response.text)

Adalo just returns the error message “no image url” and that’s it. What do we do wrong? We are not sure if we should use get or post request to send picture and receive parameter in the same action…

Thank you,
Marina

Hi Marina @diagnio,

Why would you like to use External collection for that? Your flow looks like a “one-off” flow, smth like:

  • user uploads an image
  • you store it in Adalo collection
  • you send request to your backend
  • your backend gives a reply with some params
  • you store these params in Adalo collection.

If that’s what you’d like to do, I’d advice using Custom Actions.

Best,
Victor.

Hi Victor! We are indeed trying to use custom actions… problem is - we are not sure how to set up them correctly and which requests to use - Get/Post ? We tried to use the request which I mentioned in initial message but I’d did not work.
We are no experts in Adalo custom actions so definitely looking for some help here!

Hi Marina @diagnio,

Request type depends on what your server API endpoint requires :slight_smile:

Do you know how to send request to your endpoint from Postman or using curl? How does it look like? Do you have any docs for that API endpoint?

Best,
Victor.

Hi, I am trying to do the same thing:

  1. User takes photo using Adalo app
  2. Image is stored in Adalo Collection
  3. Send the photo from Adalo Collection via a Custom Action to an image classifier ML model from Hugging Face [This steps is where I need help]
  4. ML Model from Hugging Face returns output

What I need help with is configuring the Custom Action so I can send an Image as Input for my model. I already have the right API Base URL & Header, just need to understand how to make an image the input while configuring the Custom Action.

Can you please help with this?

Is this even possible?

Thanks!

@Victor

Hi @Tizzy,

If the API endpoint of your Image Classifier ML accepts URL as an image source - you can use Custom Action.
If your API endpoint requires an image itself (binary) - you will need to use either 3rd party platform like Make, or create a custom component in Adalo (coding skills required).

Without documentation for your API unfortunately it won’t be possible to advise what way to choose.

Hope this helps.

Best regards, Victor.

Thanks Victor! We have fixed this by changing the request code parameters. All works great in preview mode, and we were able to get the Build ready.

Now there is another problem - what works fine in preview, doesn’t work in TestFlight mode. Request is not being sent to the external server (we checked the logs on server), therefore Adalo app returns error and freezes.

Do you have any advice here?
Thanks in advance,
Marina

Hi Marina @diagnio,

This case will be difficult to debug. As an option, you can add some debug labels to this screen (displaying the content of what parameters are transferred to the custom action) and also, if you have several actions on 1 button, you can try to temporarily “split” these actions.

There were some issues few years ago with custom actions related to CORS policy, but I can’t recall what was the case.

But it’s difficult to give detailed advice without hands-on investigation. In previewer mode it is possible to see the logs in the browser console to see what’s happening with a custom action; but with the native app only Adalo can see the logs. So you could submit a ticket here: Submit a Support Ticket

Best,
Victor.

Hi Victor, what would make it possible to debug the problem?

To give a bit more context here:
The custom action is a post request which works with the external server. We send there the url of the picture, which is being taken in Adalo app, and the request within couple of seconds returns the response, as a conditional parameter (kind of good, bad, error). So it works ok in preview mode, tested hundred times.

In the TestFlight, once the request is sent, we know that it does not even arrive to the external server (we checked the logs there), so the app returns error response and starts looping that screen.