function onAddToSpace(event) {
  let message = '';

  // Personalizes the message depending on how the Chat app is called.
  if (event.space.singleUserBotDm) {
    message = `Hi ${event.user.displayName}!`;
  } else {
    const spaceName = event.space.displayName ? event.space.displayName : "this chat";
    message = `Hi! Thank you for adding me to ${spaceName}`;
  }

  // Lets users know what they can do and how they can get help.
  message = message + '/nI can quickly schedule a meeting for you with just a few clicks.' +
    'Try me out by typing */schedule_Meeting*. ' +
    '/nTo learn what else I can do, type */help*.'

  return { "text": message };
}
Responds to an ADDED_TO_SPACE event in Google Chat.
Called when the Chat app is added to a space. The Chat app can either be directly added to the space
or added by a @mention. If the Chat app is added by a @mention, the event object includes a message property. 
Returns a Message object, which is usually a welcome message informing users about the Chat app.

@param {Object} event The event object from Google Chat