Generate_embed_url_for_anonymous_user with parameters

Hi there -

We have successfully setup a Lambda function to return a URL via generate_embed_url_for_anonymous_user (using python sdk).

However, I cannot seem to find consistent documentation on how to include a parameter in the call to generate this URL. Any examples that are known to work?

Hi @goosh

You can achieve this using the embedding-sdk and passing parameters through contentOptions. An example of what this looks like is available in our Developer Portal, within the personalize dashboards for your user section.

Hi @olivia -

I navigated to the example but not clear to me where they are setting the parameter to pass through to the dashboard. Here’s the code block from that example:

import json
import boto3
from botocore.exceptions import ClientError

# Create QuickSight and STS clients
qs = boto3.client('quicksight', region_name='us-east-1')
sts = boto3.client('sts')

# Function to generate embedded URL
# accountId: AWS account ID
# dashboardId: Dashboard ID to embed
# userArn: arn of registered user
# openIdToken: Token to assume role with roleArn
# roleArn: IAM user role to use for embedding
# sessionName: session name for the roleArn assume role
def getEmbeddingURL(accountId, dashboardId, userArn, openIdToken, roleArn, sessionName):
        assumedRole = sts.assume_role(
            RoleArn = roleArn,
            RoleSessionName = sessionName,
            WebIdentityToken = openIdToken
    except ClientError as e:
        return "Error assuming role: " + str(e)
        assumedRoleSession = boto3.Session(
            aws_access_key_id = assumedRole['Credentials']['AccessKeyId'],
            aws_secret_access_key = assumedRole['Credentials']['SecretAccessKey'],
            aws_session_token = assumedRole['Credentials']['SessionToken'],
            quickSight = assumedRoleSession.client('quicksight', region_name='us-east-1')

            response = quickSight.generate_embed_url_for_registered_user(
                 "AwsAccountId" = accountId,
                 "ExperienceConfiguration" = {
                    "Dashboard" = {
                        "InitialDashboardId" = dashboardId
                 "UserArn" = userArn,
                 "SessionLifetimeInMinutes" = 600

            return {
                'statusCode': 200,
                'headers': {"Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "Content-Type"},
                'body': json.dumps(response),
                'isBase64Encoded':  bool('false')
        except ClientError as e:
            return "Error generating embedding url: " + str(e)

@goosh KISS

 embeded_url = client.generate_embed_url_for_anonymous_user(**kwargs)
 embeded_url += `&{parameter}={value}`