Slack
    
    
      
    
    
      
      จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
    
    
      
      บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
    
  
    
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
    
โพสต์ข้อความไปยังผู้ใช้หรือกลุ่ม
/**
 * An example of sending messages into Slack. See:
 * https://developers.google.com/google-ads/scripts/docs/features/third-party-apis
 *
 * Webhook set up at: https://api.slack.com/custom-integrations >
 * 'Set up an incoming webhook', follow the steps then click 'Add Incoming
 * WebHooks Integration'. This will create the URL needed for below, e.g:
 * 'https://hooks.slack.com/services/TXXXXXXX/BXXXXXXX/AAAAAAAAABBBBBBBBBBCCCC';
 */
const SLACK_URL = 'INSERT_WEBHOOK_URL_HERE';
// An example of retrieving an Google Ads Report and sending it in a slack message.
function sendReportToSlack() {
  const report = AdsApp.report(
      'SELECT CampaignName, Impressions, Clicks FROM ' +
      'CAMPAIGN_PERFORMANCE_REPORT DURING YESTERDAY');
  const spreadsheet = SpreadsheetApp.create('Report');
  report.exportToSheet(spreadsheet.getActiveSheet());
  // See https://api.slack.com/docs/message-formatting for message formatting.
  const message = 'Your *Google Ads Report* is ready! <' + spreadsheet.getUrl() +
      '|Click here>';
  sendSlackMessage(message);
}
/**
 * Sends a message to Slack
 * @param {string} text The message to send in slack formatting. See:
 *     https://api.slack.com/docs/message-formatting.
 * @param {string=} opt_channel An optional channel, which can be channel e.g.
 *     '#google-ads' or a direct message e.g. '@sundar'. Defaults to '#general'.
 */
function sendSlackMessage(text, opt_channel) {
  const slackMessage = {
    text: text,
    icon_url:
        'https://www.gstatic.com/images/icons/material/product/1x/adwords_64dp.png',
    username: 'Google Ads Scripts',
    channel: opt_channel || '#general'
  };
  const options = {
    method: 'POST',
    contentType: 'application/json',
    payload: JSON.stringify(slackMessage)
  };
  UrlFetchApp.fetch(SLACK_URL, options);
}
  
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
  อัปเดตล่าสุด 2025-08-21 UTC
  
  
  
    
      [[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-08-21 UTC"],[],[]]