I have a form sending contact info to Make through a webhook.
One of the variables is a url that I’m using in an HTTP module to grab the website in order to parse the text.
I noticed the HTTP module throws an error if the url doesn’t contain “http://” or “https://”.
Is there a way to check the incoming url and add either “http://” or “https://”, if necessary?
TIA - I’m a complete novice, so easy to understand explanations in layman’s terms are greatly appreciated, if possible.
Hello! Welcome to the community!
You can achieve this using functions in your mapping. However, there will be no way for Make to know whether it’s HTTP:// or HTTPS://, so let’s assume all URLs are secured, and that they need HTTPS://.
Instead of the Webhook, I used a Set Variable to simulate the “url” field that you get
As you can see here, in the URL field of the HTTP call, I use:
if(contains(2.url;http);2.url;
https://2.url)
It says: IF the received-URL field (in the example it’s mine, but you would map the URL field you got from the Webhook) contains “http”, then I map directly the received-URL field. If not, I hard-code HTTPS:// and merge it with received-URL
I hope it’s clear
Benjamin
3 Likes
You can use just a single built-in function replace
e.g.:
https://{{ replace(1.url; "/^https?:\/\//"; emptystring) }}
For more information, see replace function documentation in the Make Help Center:
Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —
General
Help Center Basics
Articles & Videos
samliew – request private consultation
Join the unofficial Make Discord server to chat with other makers!
Module Export
You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.
-
Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
-
Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.
-
Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.
View Module Export Code
JSON
{
"subflows": [
{
"flow": [
{
"id": 74,
"module": "util:ComposeTransformer",
"version": 1,
"parameters": {},
"mapper": {
"value": "https://{{replace(72.url; \"/^https?:\\/\\//\"; emptystring)}}"
},
"metadata": {
"designer": {
"x": -488,
"y": -1744,
"messages": [
{
"category": "last",
"severity": "warning",
"message": "A transformer should not be the last module in the route."
}
]
},
"restore": {},
"expect": [
{
"name": "value",
"type": "text",
"label": "Text"
}
]
}
}
]
}
],
"metadata": {
"version": 1
}
}
3 Likes
Thanks for your help, it’s greatly appreciated.
I think I followed instructions, granted it’s my first time doing this.
I’m not sure what I’m doing wrong, but I’m getting this error.
EPROTO: write EPROTO 139713644959680:error:14094458:SSL routines:ssl3_read_bytes:tlsv1 unrecognized name:…/deps/openssl/openssl/ssl/record/rec_layer_s3.c:1565:SSL alert number 112
Hi,
I don’t know this type of error, but it seems to be related to the fact that, as I was worried about, some of the urls you have to reached only work with http and not https.
One way to know if it’s this is to check the logs and see what url has failed. Then you can try and type it manually in a web browser, to see if it works with https.
If ever there are websites that only offer HTTP, we could workaround it using a error handler. But let’s investigate first.
Can you please check where it failed, and find the url to see if you can call it with https?
1 Like
I’ve just been testing with my own website url.
I’m sending it through the webhook without http://, https://, or www.
Just domainname.tld
It works correctly when I type it into a browser with https://.
Have you tried the one that failed in Make?
Can you also try to send a screenshot of the logs where we can see the url that the HTTP module tried to call?
Maybe there’s an issue with the way the url is built
1 Like
I actually got it to work.
The information you showed me wasn’t the problem. I just misunderstood where I need use it.
I added a “make a request” module, when all I needed to do was add the function you showed me to the existing “get a file” module.
I can’t thank you enough for your assistance!
2 Likes
Great it works now!
No problem, I assumed you already had the Make a Request module, next time I should ask for a screenshot of the scenario
Kind regards