Get parameters from page URL

I’m not sure if I understood correctly what I mean, but if you want to open the app from an URL, you need to:

  1. Use appgyver:// as the URL in the Preview app and for mobile specify the URL of the application in Build Settings (not sure if this works on web at all)
  2. Use the app launched from URL event. In its output you get the event it emits, and that event has in it the parameters it got.

I don’t know if there’s any documentation about this, but if you have any further questions I’ll do my best to answer!

That’s very useful, but that’s not what I was looking for, and it seems I didn’t specify what I wanted properly- I’m working with a webview, and want to extract parameters from that URL. Sorry for the confusion.

Hmm, alright. I’m still not sure I understand what you want to do, could you give me an example or explain in some more detail?

I want to get the ? or & parts of a webview URL, of a specific param

1 Like

@imvicdiagnostic … Try systemVars.initialUrl … it might be what you are looking for.

1 Like

Thanks for the help everyone! However, none of these suggestions worked - I was looking to get parameters from a specified page URL, and found the solution after SCOURING the AppGyver docs. Where appVars.Webview is my app variable storing the current Webview URL on event change, and “0” indicates the first parameter in the aforementioned URL, here is the solution:

PICK_ITEM(QUERY_PARAMETERS_ARRAY(appVars.Webview), 0).value

However, thanks for the help from everyone!

4 Likes

Thanks for sharing the solution… exactly what I was looking for.

1 Like

I don’t mean to bring up an old thread, but @mevi would you mind explaining how I could parse the parameters from that event? Can’t seem to wrap my head around that.

Anyone have any tips on how to do this? I have 3 parameters I need when I launch from URL to be passed onto a page I’m opening.

Hi! I don’t actually know what parameters the event gets, as I haven’t used it myself. Try and see by using ENCODE_JSON in a toast/alert/debug log and print out what you get from the output of the event. But the other replies suggest that the event may not provide the parameters you might need, so you might want to look into the other suggestions / solutions as well :slight_smile:

Would this be the way to forward to a new page if the home page of the web app is launched from an url and the url has a param? For example, users can share a link to their story which includes the storyId as an url param. like this: [Preformatted text](https://platform.preview.appgyver.com/368325/wikacy-reels/page.Page5?storyId=-M9fHLAuAHww7sqKyiEr)

The storyId is a document in firebase. I want to check to see if app has been opened with a storyId and, if so, forward them to the story page where the data variable is set to pull the single record. I am trying to figure the best way to do this in appgyver. Any help would be sincerely appreciated.

could you please give an example of how to access the parameters? i see

outputs[“openedfromurl”]

outputs[“openedfromurl”].componentInstanceId

outputs[“openedfromurl”].event

outputs[“openedfromurl”].eventValue

… as the options. I have a param with key postId and want to open another page and pass the postId to the params of the next page. How do i accesss the postId in a flow function???

I have tried outputs[“openedfromurl”].postId, outputs[“openedfromurl”].params.postId

PLEASE give us some clarification on this. Pretty please.

Have a read of this post.

It works for me too, though I´m not sure how it works in preview mode. I recommend that you do all of you testing in your published webapp.

I read it. It was the post which led to my question. I cannot find anywhere in it where it explains how to structure the formula to retrieve the param.

ok, so I tried using an if statement as the first function in the on page mounted event to check to see whether the page param is empty, and if, so, continue with the rest of the logic, but if not, alert the value of the param. it worked to alert. however, when i tried to open page function and pass the param and dismiss initial view or without dismissing initial view, the app freezes, or just dismisses the initial view but does not open the desired page, instead just opening the next page in the stack. is this a bug??? do we know of any way to redirect to a desired page if someone shares a link to say, a story or something they want to share, which is what makes websites and apps useful???

edit: of course i made sure the desired page was set to allow open without auth. i have both top and bottom app nav disabled.

Its a page parameter. Just use it like an app variable or page variable. Here´s how I use it. If I load the webapp with AppGyver then it takes the true option out of the IF stmt.

thank you. i think i am getting closer now. but in my case i do not know what the value of the param will be, only the key. i also would like to impliment different keys and the ability to check which key is being used to direct to different pages. such as if a user shares a story or their profile or a video post. I also see you use replace page instead of open page. i will try that.

i just tried using replace page and it does not work.

Try hand drawing how you want this to work, noting the variable flows etc.

From what I can see, you need a parameter of StoryID but I don´t know what you want to do with the values that you get back from it.

I also think its worth taking a step back. Are you building this to be a mobile app, with native android or IOS versions?

If you are only ever intending it to be a webapp then I don´t think AppGyver is the best solution. Webapp - as I understand it - is really just intended as a backup to the native apps.

I am building both native and web app. I simply want the web app to be able to open if someone shares a link to a story or a post, and display the story or post, like any website would.
Thank you.