twiliotwilio-apitwilio-python

Check if a participant exists in a conference using participant label


I tried

participant = conferences[0].participants('participant')

but this always return a participant even though the participant is not in the conference.

participant = conferences[0].participants('participant').fetch()

returns an error if the participant is not in the conference


Solution

  • Try something like the below:

    function findParticipant() {
    return client.conferences('CFba9989...')
        .participants
        .list()
    }
    
    let findMe = 'Winston';
    
    findParticipant()
    .then(participants => {
        let result = participants.filter(participant => participant.label === findMe )
         console.log(result);
    }).catch(err => console.log(err.message))