title: Error converting google slide to image using app script
body: <p>This is the code I am using to convert my google slide to image:</p>
  <pre><code>function myFunction() {
    var dApp = DriveApp;
    var folder = dApp.getFoldersByName(&quot;til&quot;);
    
    var til = folder.next();
    var filesIter = til.getFiles();
    var i = 0;
    while(filesIter.hasNext() &amp;&amp; i &lt; 50){
      var file = filesIter.next();
      Logger.log(file.getId());
      
      exportSlideImages(file.getId(), file.getName())
      break;
      i = i + 1;
    }
    
  }
  
  function exportSlideImages(presentationId, imageName) {
    var presentation = SlidesApp.openById(presentationId);
    var baseUrl =
      &quot;https://slides.googleapis.com/v1/presentations/{presentationId}/pages/{pageObjectId}/thumbnail&quot;;
    var parameters = {
      method: &quot;GET&quot;,
      headers: { Authorization: &quot;Bearer &quot; + ScriptApp.getOAuthToken() },
      contentType: &quot;application/json&quot;,
      muteHttpExceptions: true
    };
    
    presentation.getSlides().forEach(function(slide, i) {
      var url = baseUrl
        .replace(&quot;{presentationId}&quot;, presentationId)
        .replace(&quot;{pageObjectId}&quot;, slide.getObjectId());
      
      var response = JSON.parse(UrlFetchApp.fetch(url, parameters));
      Logger.log(response)
      var blob = UrlFetchApp.fetch(response.contentUrl).getBlob();
      blob.setName(imageName +'.png');
      DriveApp.createFile(blob);
     
      
    });
  }
  </code></pre>
  <p>It did create an image file but I got this output in the file:</p>
  <blockquote>
  <p>&quot;code&quot;: 403,
  &quot;message&quot;: &quot;Google Slides API has not been used in project 396798675804 before or it is disabled. Enable it by visiting
  (a link was given here to)
  then retry. If you enabled this API recently, wait a few minutes for
  the action to propagate to our systems and retry.&quot;,</p>
  </blockquote>
  <p>But what I don't understand is I don't have any project with id 396798675804. What am I doing wrong?? Any pointers??</p>