# Run Agent in a click button

**URL:** <https://community.automationedge.com/t/run-agent-in-a-click-button/11056>\
**Category:** AutomationEdge API\
**Tags:** rpa\
**Created:** [October 13, 2023, 3:04pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056 "2023-10-13T15:04:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kock03](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Kock03](https://community.automationedge.com/u/Kock03)\
**Post date:** [October 13, 2023, 3:04pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/1 "2023-10-13T15:04:16Z")

</div>

Hey everyone! How can I do it in an application, call the automation API to run the Agent after I click on a button? It’s possible? I need to run a certain robot after the user uses the application and submits it.

Thank you for the all support and help!

---

<div class="post-metadata">

**Author:** ![wllmdjngh](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/wllmdjngh/32/952_2.png) [@wllmdjngh](https://community.automationedge.com/u/wllmdjngh)\
**Post date:** [October 13, 2023, 6:23pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/2 "2023-10-13T18:23:52Z")

</div>

You can do it through RestAPI.  
Request the documentation from Support.  
First you need to request a TOKEN, then Execute WF, After that you can request status and restart if there was a failure, like WEB page down.  
All through API.

---

<div class="post-metadata">

**Author:** ![Kock03](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Kock03](https://community.automationedge.com/u/Kock03)\
**Post date:** [October 16, 2023, 7:45pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/3 "2023-10-16T19:45:35Z")

</div>

Thank you, but how I request this TOKEN?  
I didn’t understand this part

---

<div class="post-metadata">

**Author:** ![wllmdjngh](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/wllmdjngh/32/952_2.png) [@wllmdjngh](https://community.automationedge.com/u/wllmdjngh)\
**Post date:** [October 16, 2023, 10:24pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/4 "2023-10-16T22:24:19Z")

</div>

The below WF is an example on how to get the token through an API call.  
Only way you can get this TOKEN.  
Hope this helps.

[WF\_Inicialización.psw](https://community.automationedge.com/uploads/short-url/uVrDTQZRZTk68WJ8SFYwwMvXGS2.psw) (14.6 KB)

---

<div class="post-metadata">

**Author:** ![Kock03](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Kock03](https://community.automationedge.com/u/Kock03)\
**Post date:** [October 17, 2023, 1:58pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/5 "2023-10-17T13:58:25Z")

</div>

In fact, I have a simple application, html and javascript, in this application I have a button. I need to run a workflow after this button is pressed, calling the API directly through javascript, and how do I do that?

---

<div class="post-metadata">

**Author:** ![Jane](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jane](https://community.automationedge.com/u/Jane)\
**Post date:** [October 18, 2023, 6:03am UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/6 "2023-10-18T06:03:35Z")

</div>

Hi! Vinicius

Please can you refer these links and try yo implement calling API from a Java Script.

[4 Ways to Make an API Call in JavaScript]

> **[4 Ways to Make an API Call in JavaScript - GeeksforGeeks](https://www.geeksforgeeks.org/javascript/ways-to-make-an-api-call-in-javascript/)**
>
> Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and...

[html - How to call a REST web service API from JavaScript? - Stack…]  
[https://stackoverflow.com/questions/36975619/how-to-call-a-rest-web-service-api-from-javascript](https://stackoverflow.com/questions/36975619/how-to-call-a-rest-web-service-api-from-javascript)

---

<div class="post-metadata">

**Author:** ![Kock03](https://avatars.discourse-cdn.com/v4/letter/k/ac91a4/32.png) [@Kock03](https://community.automationedge.com/u/Kock03)\
**Post date:** [October 23, 2023, 4:38pm UTC](https://community.automationedge.com/t/run-agent-in-a-click-button/11056/7 "2023-10-23T16:38:57Z")

</div>

It worked, thank you for all!
