Twitter (OAuth1.0)
    
    
      
    
    
      
      จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
    
    
      
      บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
    
  
    
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
    
// User-level Twitter API request
// Requires the OAuth1 library to be pasted into the script.
// https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library
const CONSUMER_KEY = 'INSERT_CONSUMER_KEY_HERE';
const CONSUMER_SECRET = 'INSERT_CONSUMER_SECRET_HERE';
const ACCESS_TOKEN = 'INSERT_ACCESS_TOKEN_HERE';
const ACCESS_SECRET = 'INSERT_ACCESS_SECRET_HERE';
/**
 * Retrieves the tweets for the specified Twitter user.
 * @param {string} screenName The Twitter name of the user, e.g. 'sundarpichai'
 * @return {?Object} The complex response object containing tweets, or null if
 *     failure. See https://dev.twitter.com/rest/reference/get/statuses/user_timeline
 *     for structure of this object.
 */
function getTweetsForUser(screenName) {
  if (typeof OAuth1 === 'undefined') {
    const libUrl = 'https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library';
    throw Error('OAuth1 library not found. Please take a copy of the OAuth1 ' +
        'library from ' + libUrl + ' and append to the bottom of this script.');
  }
  const params = {screen_name: screenName};
  const authUrlFetch = OAuth1.withAccessToken(CONSUMER_KEY, CONSUMER_SECRET,
      ACCESS_TOKEN, ACCESS_SECRET);
  const response = authUrlFetch
      .fetch('https://api.twitter.com/1.1/statuses/user_timeline.json', params);
  const responseText = response.getContentText();
  return JSON.parse(responseText);
}
// Paste the OAuth1 library here.
// User-level Twitter API request
// Requires the OAuth1 library to be pasted into the script.
// https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library
const CONSUMER_KEY = 'INSERT_CONSUMER_KEY_HERE';
const CONSUMER_SECRET = 'INSERT_CONSUMER_SECRET_HERE';
const ACCESS_TOKEN = 'INSERT_ACCESS_TOKEN_HERE';
const ACCESS_SECRET = 'INSERT_ACCESS_SECRET_HERE';
/**
 * Sends a tweet.
 * @param {string} message The message to send.
 * @return {?Object} The complex response object with the status of the send
 *     request. See https://dev.twitter.com/rest/reference/post/statuses/update
 *     for the structure of this object.
 */
function sendTweet(message) {
  if (typeof OAuth1 === 'undefined') {
    const libUrl = 'https://developers.google.com/google-ads/scripts/docs/examples/oauth10-library';
    throw Error('OAuth1 library not found. Please take a copy of the OAuth1 ' +
        'library from ' + libUrl + ' and append to the bottom of this script.');
  }
  const params = '';
  const tweet = message.substring(0, 160);
  const options = {method: 'POST', payload: {status: tweet}};
  const authUrlFetch = OAuth1.withAccessToken(CONSUMER_KEY, CONSUMER_SECRET,
      ACCESS_TOKEN, ACCESS_SECRET);
  const response = authUrlFetch
      .fetch('https://api.twitter.com/1.1/statuses/update.json', params,
      options);
  const responseText = response.getContentText();
  return JSON.parse(responseText);
}
  
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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"],[],[]]