How to get the memberstack ID for a user currently logged into Webflow?

Hi all -

I am creating a form in Webflow that will pass a bunch of data to Integromat. It works fine, but I need to pass the memberstack ID of the currently logged in user along with the data. I assume that info is available via JavaScript since there is a session running, but I can’t find any reference for that.

Can anyone tell me if there is a standard way of getting the current user ID from Webflow? Any resources much appreciated!

thanks, David

1 Like

This is what you are looking for :smile:

Ah OK I think I passed over this documentation because I saw ‘API’ and assumed it was for accessing data via ordinary API.

So, can I just put a snipped of JS into the webflow page that will grab the member’s ID if they are logged in, then use that ID in a hidden field of my webflow form? That would certainly do it!

<script>
	MemberStack.onReady.then(function(member) {   
	if (member.loggedIn) {
		var id = member["id"]
		// do something with the id
	}
	})
</script>