# Run JSON / Javascript / Python scripts in thunkable

**URL:** <https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834>\
**Category:** Feature Requests\
**Tags:** help, javascript\
**Created:** [September 10, 2023, 4:48am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834 "2023-09-10T04:48:18Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 10, 2023, 4:48am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/1 "2023-09-10T04:48:18Z")

</div>

Hi!

I tried [Makersuite](https://makersuite.google.com/) and wanted to integrate my projects with Thunkable. Since Makersuite can generate code, Does anyone have ideas for running the code?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 10, 2023, 5:00am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/2 "2023-09-10T05:00:21Z")

</div>

You can run Javascript using the Web Viewer in Thunkable. See this: [Is it possible to use javascript in app?](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467)

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 10, 2023, 5:10am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/3 "2023-09-10T05:10:25Z")

</div>

Thanks, But I don’t have a link. Can I use the Colab link (generated by Maker Suite) in the API’s  
set link block and get the response?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 10, 2023, 5:41am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/4 "2023-09-10T05:41:12Z")

</div>

I don’t know what you mean by a link. You would use the Javascript code that you generated with the Web Viewer as explained in that topic. If Maker Suite doesn’t have API access then, no, you couldn’t do that. If you’re accessing Maker Suite’s API then I guess so.

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 10, 2023, 6:02am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/5 "2023-09-10T06:02:40Z")

</div>

The Javascript is generated by Makersuite. Makersuite is a platform like Dialogflow, but it uses PaLM 2 ( Pathways Language Model ) developed by Google.  
Sorry If I didn’t understand

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 12, 2023, 7:08am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/6 "2023-09-12T07:08:19Z")

</div>

I want to run this code (which is written in cURL):

```auto
curl \
  -H 'Content-Type: application/json' \
  -X POST 'https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key='${API_KEY} \
  -d '{ "prompt": { "text": "Word Type Adjective\nWord Beauty\noutput: Beautiful \nWord Type Noun\nWord Running\noutput: Run\nWord Type Adverb\nWord Impatient\noutput: Impatiently\nWord Type Adjective\nWord Generate\noutput:"}, "temperature": 0.7, "top_k": 40, "top_p": 0.95, "candidate_count": 1, "max_output_tokens": 1024, "stop_sequences": [], "safety_settings": [{"category":"HARM_CATEGORY_DEROGATORY","threshold":1},{"category":"HARM_CATEGORY_TOXICITY","threshold":1},{"category":"HARM_CATEGORY_VIOLENCE","threshold":2},{"category":"HARM_CATEGORY_SEXUAL","threshold":2},{"category":"HARM_CATEGORY_MEDICAL","threshold":2},{"category":"HARM_CATEGORY_DANGEROUS","threshold":2}]}'

```

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 12, 2023, 7:52am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/7 "2023-09-12T07:52:40Z")

</div>

If you’re making a POST call to an API then you can learn how to do that by searching the forums. There are examples but each POST call is slightly different.

Were you able to make that POST call in a third-party app/website such as Postman? That’s a good first step before trying to do so in Thunkable. Someone here might be able to help you translate that curl command into blocks. But again, I’d recommend looking around the forums.

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 12, 2023, 8:53am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/8 "2023-09-12T08:53:15Z")

</div>

Thanks for your reply.

I did find some topics related to Converting cURL Commands and Getting Responses from Google App Script or Colab but they did not have any Solutions.

I read the [API Docs](https://developers.generativeai.google/api/python/google/ai/generativelanguage/TextCompletion) to understand how to use the API. To use this API:

> [@vishruth-ram](#):
>
> PaLM 2 ( Pathways Language Model )

I think [@Thunkable\_Staff](https://community.thunkable.com/groups/thunkable_staff) have any Ideas?

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 12, 2023, 10:07am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/9 "2023-09-12T10:07:58Z")

</div>

> [@tatiang](#):
>
> You can run Javascript using the Web Viewer in Thunkable. See this: [Is it possible to use JavaScript in the app?](https://community.thunkable.com/t/is-it-possible-to-use-javascript-in-app/2055467)

Thank You

But where shall I place the Web Viewer?

(My App has a chat layout )

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [September 12, 2023, 11:25am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/10 "2023-09-12T11:25:22Z")

</div>

This isn’t executable code within Thunkable. What you can do is convert this curl call to use the api connector.

In other words you need to convert the text code to block code

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [September 12, 2023, 12:16pm UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/11 "2023-09-12T12:16:06Z")

</div>

Hi, If I understand your question correctly, you want to know where you should place the webview which has the JS file. If you don’t want to show the webviewer carrying the local (in assets) JS file, you can make it 1px in height on the screen you want to use the JS code in. I do this with all my webviews with JS files inside.

Fiddle around with the [Web API blocks](https://docs.thunkable.com/v/snap-to-place/web-api) to convert your cURL code into blocks.

Note, don’t make them invisible, as doing so has sometimes caused problems in my project. 1px height will suffice.

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 12, 2023, 1:19pm UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/12 "2023-09-12T13:19:52Z")

</div>

![Screenshot 2023-09-12 184751](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/2/1257f3e1255299c02728c01d3c20120af15a9641.png)

This is my code. In the screen to display the output I will set Variable generate code to 1

---

<div class="post-metadata">

**Author:** ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)\
**Post date:** [September 12, 2023, 3:55pm UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/13 "2023-09-12T15:55:35Z")

</div>

Hello, Firstly, your key does not need `$ ... \`, it’s just to signify in the url that the API key goes there. So just grab your base url till “generateText”, then append `?key=abc`, where abc is your key.

Secondly, i recommend you try the Web API component’s POST call, set the URL appended by the API key, and set the body to the body component.

Look around in the community and you will find tons of web api examples, and you’ll eventually get he idea of properly formatting our api content.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 12, 2023, 7:02pm UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/14 "2023-09-12T19:02:09Z")

</div>

I’m just going to second what @kartik14 and @jared have already said: use the Web API blocks, not the Web Viewer.

---

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 13, 2023, 11:29am UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/15 "2023-09-13T11:29:03Z")

</div>

The` POST` block does not have the option to send additional data.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:33pm UTC](https://community.thunkable.com/t/run-json-javascript-python-scripts-in-thunkable/2586834/16 "2024-11-08T13:33:30Z")

</div>


