How to make my app to trigger specific action based on url link clicked in another website

Hi,

What I am trying to accomplish is the following:
1- start my app (Form1 for example)
2- collect some data in the form (the data not saved yet)
3- click a link to open another website within my app (inside an alert for example)
4- click a specific button in the other website that has a url link to my app.

My goal is to make the opening of this url link save the data that weren’t saved in my Form1 .

Please help!

Please see the HTTP endpoint documentation to see if it helps.

https://anvil.works/docs/http-apis/creating-http-endpoints

Is there any simple example for a method triggered by url link?

I found this in the forum " POST method from HTTP blog - method not supported ", but it still difficult for me to understand how does it work (I am still a beginner, and I learn as I go :blush:), the easiest way for my me to understand is to see a live example.
I created this app

https://anvil.works/build#clone:V7MZTITY6PNEHW5W=LKLNODVDPLJ2JUHHUML5BKWR
Hopefully with some guidance I can accomplish my goal

the link to the app: https://clumsy-petty-peafowl.anvil.app/

Thank you for your help!

Hi,

Anyone with HTTP experience, please help.

Thank you.

I am confused by the word “website” on your question.
Do you mean a form of the same app?
Or another app?

The main purpose is to make another website (other than Anvil) to start an action in anvil through url link. In this app I used another anvil app (instead of external website) so, you guys can modify the url link.

Thank you

Clicking on a link from another website calls an http endpoint of an Anvil app, which does something on the server, for example writes something on a table.

But the server doesn’t know how many users have a form open on that app at any given time, so you can’t change what you see on your browser when another user clicks on a link on another computer (or on your computer).

You can do these two steps:

  1. Create an http endpoint that adds something to a table

  2. On a form you add a timer that every few seconds:

    1. Calls a server function (with anvil.call_s() to avoid the spinner)

    2. The server function checks the database and returns something to the client, for example a dictionary like {'option 1': True, 'option 2': 'abc'}

    3. Now the client knows what’s going on on the server, that is knows whether the http endpoint has been hit, that is knows if someone clicked on that link, and can do something about it

1 Like

I will give it a try. Thank you!