Use the js sdk to integrate an iframe so the users can create a heygen avatar without leaving your app

Import the script

<script src=""></script>

Create an instance of the iframe

const instantAavatarWin = new window.InstantFrame({ host: '' });

You can open and close the iframe like this

// token created using the create_token API

Then you can call these methods on the instantAvatarWin to consume events

instantAavatarWin.on('open', function () {})
instantAavatarWin.on('close', function () {})
instantAavatarWin.on('submitted', function (resp) {