ExternalAPI getEmail and emailChange don't work for other participant?

I try to use the function getEmail from the externalAPI to get the email of every participant who just joined the conference (in our system email is the only reliable way to identify an user).

But getEmail almost always fail. It returns ‘undefined’. According to the documentation, I thought this function could be used to retrieve the email of any participant of a conference if we know their id and if they provided an email. However looking at the code of getEmail, it just returns participant[id].email, but this field is only updated when receiving an ‘email-change’ event.

What about people who provide their email in the options of JitsiMeetExternalAPI function ? ‘email-change’ is not called in this case.

Also, about the emailChange event, I correctly get it when I change my own email (with api.executeCommand(‘email’)), but when other participant change their own email, I don’t receive the event. (They receive the event themselves)

It feel like I misunderstand the purpose of api.executeCommand(‘email’) and getEmail, are they supposed to be called only on ourselves ?

In external-api.js, the only code I can spot that update the email field:

case 'email-change': {
                const user = this._participants[userID];
                if (user) {
                    user.email = data.email;
                }
                break;
            }
1 Like

I am facing the same issue too. Were you able to get it to work ?

I added a utility method to the external-api.js that would return all the participants (basically added a method to simply return this. _participants ) and noticed that it only contains displayName and formattedDisplayName and nothing else.

Anyway I had a close deadline to implement some stuff, so here’s ( a hacky way ) what I did

// PATH - jitsi-meet > react > features > base > conference > middleware.js
// inside _conferenceJoined function
// before returning the result - add the following lines

// intercepter hack to sync email when using external-api
if(getLocalParticipant(getState)?.email) {
    APP.API.notifyEmailChanged(getLocalParticipant(getState)?.id, {
        email: getLocalParticipant(getState)?.email
    });
}

My assumption is the email-change event is not getting triggered properly or so. Triggering it manually post conference creation and participant joining seems to solve the issue. But then again, its probably a hack and I’d wait and see someone fixing it appropriately.

I did something similar, but even with that I couldn’t get the emailChange event to fire when other participants enter or change their emails, just when the local participant enter or change his email. Maybe I did something wrong.

Also it’s quite a pain to maintain a modified version of Jitsi so we went back to the official repo and just use displayName as an identifier, even if it’s really bad for now… I hope this bug will be fixed officially.

Can you let a comment on the github issue too, describing your workaround ?