Thank you @narrow-agent-91470. That tutorial had the syntax I needed to make both events work. This is what I ended up needing:
window.botpressWebChat.onEvent(function (event) {
if (event.type === 'LIFECYCLE.LOADED') {
window.botpressWebChat.sendEvent({ type: 'show' })
}
if (event.type === 'MESSAGE.SENT') {
console.log('message sent');
}
},
['LIFECYCLE.LOADED', 'MESSAGE.SENT']
);