Failed Webhook type translation: Conversion error.

 

 

 

Hi, I'm trying to return a URL using webhooks + tinyurl api, but I get an error on the second process.

GFormMLH_0-1688997032498.png

 

GFormMLH_1-1688997097776.png

GFormMLH_4-1688997144984.png

 

 

GFormMLH_3-1688997126799.png

Any guess on this ? 

The error message is :  Failed Webhook type translation: Conversion error.

I set my column type to Text, same for Specific Type (also tried with url)

https://support.google.com/appsheet/answer/12738438

 

Solved Solved
1 9 1,494
1 ACCEPTED SOLUTION

The error message `Conversion Error` isn't very helpful but this means that the endpoint URL you're posting to isn't returning a valid JSON format, I'll see if I can improve the error message.

Here is the issue in more detail:

The endpoint you're trying to use returns only the url as a string (AKA it's not in JSON format which is the only format webhook return value expects).

For example if I run `https://tinyurl.com/api-create.php?url=https://www.google.com` it returns just:

https://tinyurl.com/bjnwp7u

 But you're Webhook is formatting is expecting the following return:

{
   "New Tiny": "https://tinyurl.com/bjnwp7u"
}

So can't use this particular endpoint with Webhook return values. Luckily, there are two possible solutions either:

1.) You can use a simple Apps Script task that uses UrlFetchApp and encodeURIComponent to use the same api you're trying to use something like this (warning: untested):

function makeTinyUrl(url) {
    var response = UrlFetchApp.fetch("https://tinyurl.com/api-create.php?url=" + encodeURIComponent(url));
    return response.getContentText();
}

And then in your Apps Script Task configuration just select "String" as the return value and you can access it as [Task Name].[Output] . Relevant docs: here.

2.) Alternatively, TinyUrl does have an API that returns JSON: https://tinyurl.com/app/dev (free for <600 API calls). You can use that and then have a column that is called data.tiny_url to extract the shorter url for use in your app. Relevant docs: here.

Hope that helps!

View solution in original post

9 REPLIES 9

In the automation it shows the shortened URL with the correct informations. I'm just trying to get that value inside a column

I made a ticket to the support but they said it seemed well configured and that it should work correctly -- it does not ๐Ÿ˜ž 

@nico @Koichi_Tsuji can anybody help me with this please ? 

The url inside the webhook is : http://tinyurl.com/api-create.php?url=https://form.jotform.com/231093511193348?codeChantier=<<[_THISROW].[column]>>

The error message `Conversion Error` isn't very helpful but this means that the endpoint URL you're posting to isn't returning a valid JSON format, I'll see if I can improve the error message.

Here is the issue in more detail:

The endpoint you're trying to use returns only the url as a string (AKA it's not in JSON format which is the only format webhook return value expects).

For example if I run `https://tinyurl.com/api-create.php?url=https://www.google.com` it returns just:

https://tinyurl.com/bjnwp7u

 But you're Webhook is formatting is expecting the following return:

{
   "New Tiny": "https://tinyurl.com/bjnwp7u"
}

So can't use this particular endpoint with Webhook return values. Luckily, there are two possible solutions either:

1.) You can use a simple Apps Script task that uses UrlFetchApp and encodeURIComponent to use the same api you're trying to use something like this (warning: untested):

function makeTinyUrl(url) {
    var response = UrlFetchApp.fetch("https://tinyurl.com/api-create.php?url=" + encodeURIComponent(url));
    return response.getContentText();
}

And then in your Apps Script Task configuration just select "String" as the return value and you can access it as [Task Name].[Output] . Relevant docs: here.

2.) Alternatively, TinyUrl does have an API that returns JSON: https://tinyurl.com/app/dev (free for <600 API calls). You can use that and then have a column that is called data.tiny_url to extract the shorter url for use in your app. Relevant docs: here.

Hope that helps!

Infinite thanks @nico and @JSO , both solutions works like a charm. 

Thanks for the complete answer ! 

@baba_sawane Could you please share some screens shots of how you set up your bot and webhook?  Trying to figure this out.

Thank you.

Hi Mauricio,

I gave details in this thread : shorten urls tip 

Here if you need more details, have a nice day.

JSO
Silver 2
Silver 2

I think the problem is that in the Return Value, within the Specific type, you put Name: New Tiny and it matches the name of the column where you are going to save it later.
I have tested it and it works.

Try leaving the name of Specific type as Key (of type Text)and then assign New Tiny the formula [Tiny Solins].[Key]

Hi JSO, thanks for answering.

I guessed it could have been the issue earlier on so I tried with another name but I still get the error.

GFormMLH_0-1689682407686.png

"

Error encountered in step with name [Return & update]: Error: 'Set Column Values' Data action ''Set Column Values' Data action 'Return & update Action - 1'' failed with exception 'Set Column Values' Data action 'Return & update Action - 1' failed because field 'New Tiny' in table 'PDC_Solins' could not be computed due to exception Error: Failed Webhook type translation: Conversion error."

I'm sorry I confused you.
I just realized that the same thing happens to me.
The data was filled in by another bot that does something similar but uses Google Script (I had not disabled it for the test).
The bot that I launch through WebHook also fails me.
I have put EncodeUrl() to the web that I pass to shorten it but it has not given me any results either.
Analyzing my version of Google script, I detect that Tinyurl returns an object and specifically its getContentText() property is the one that contains the short url. So I don't know what the type should be in the return value.
It sounds to me that they had done something in AppSheet to be able to refer to it but now I don't remember how it was.

JSO_0-1689684863727.png

 

Top Labels in this Space