Discourse as SSO host -> Restrict content in WP based on Discourse groups

Is there any way to set up a custom shortcode which makes an API call to check the user’s group status?