title: Cannot return a card markup from the callback function of a universal action
body: <p>I'm just trying to get started with the sample addon Google describes here for extending the compose UI:
  <a href="https://developers.google.com/gsuite/add-ons/gmail/extending-compose-ui" rel="nofollow noreferrer">https://developers.google.com/gsuite/add-ons/gmail/extending-compose-ui</a></p>
  
  <p>However when I run it I'm getting this error:</p>
  
  <blockquote>
    <p>Error with the add-on. Run time error. Cannot return a card markup
    from the callback function of a universal action.</p>
  </blockquote>
  
  <p>I have not setup any universal actions in my manifest file:</p>
  
  <pre><code>{
    "timeZone": "America/New_York",
    "oauthScopes":[
      "https://www.googleapis.com/auth/script.send_mail",
      "https://www.googleapis.com/auth/gmail.readonly",
      "https://www.googleapis.com/auth/spreadsheets",
      "https://www.googleapis.com/auth/gmail.addons.execute",
      "https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
      "https://www.googleapis.com/auth/gmail.modify",
      "https://www.googleapis.com/auth/gmail.addons.current.action.compose"
      ],
    "gmail":{
      "name": "My Mail Merge",
      "logoUrl": "https://www.gstatic.com/images/icons/material/system/1x/label_googblue_24dp.png",
      "composeTrigger": {
        "draftAccess": "METADATA",
        "selectActions": [
          {
            "text": "show UI",
            "runFunction": "buildImageComposeCard"
          }
        ]
      },
      "openLinkUrlPrefixes": [
        "https://mail.google.com/"
        ],
      "primaryColor": "#42585F4",
      "secondaryColor": "#42585F4"
    },
    "exceptionLogging": "STACKDRIVER"
  }
  </code></pre>
  
  <p>Below is Code.gs:</p>
  
  <pre><code>function getInsertImageComposeUI(e) {
    return [buildImageComposeCard()];
  }
  
  function buildImageComposeCard() {
    // Get a list of image URLs to display in the UI.
    // This function is not shown in this example.
    var imageUrls  = [
      "https://mail.google.com/1",
      "https://mail.google.com/2",
      "https://mail.google.com/3"
      ];
  
    var card = CardService.newCardBuilder();
    var cardSection = CardService.newCardSection().setHeader('My Images');
    for (var i = 0; i &lt; imageUrls.length; i++) {
      var imageUrl = imageUrls[i];
      cardSection.addWidget(
        CardService.newImage()
        .setImageUrl(imageUrl)
        .setOnClickAction(CardService.newAction()
                          .setFunctionName('applyInsertImageAction')
                          .setParameters({'url' : imageUrl})));
    }
    return card.addSection(cardSection).build();
  }
  
  function applyInsertImageAction(e) {
    var imageUrl = e.parameters.url;
    var imageHtmlContent = '&lt;img style=\"display: block\" src=\"'
    + imageUrl + '\"/&gt;';
    var response = CardService.newUpdateDraftActionResponseBuilder()
    .setUpdateDraftBodyAction(CardService.newUpdateDraftBodyAction()
                              .addUpdateContent(
                                imageHtmlContent,
                                CardService.ContentType.HTML)
                              .setUpdateType(
                                CardService.UpdateDraftBodyType.IN_PLACE_INSERT))
    .build();
    return response;
  }
  </code></pre>