Google Chat, Vertex AI, এবং Apps Script-এর মাধ্যমে ঘটনার প্রতিক্রিয়া জানান

এই টিউটোরিয়ালটি অনুমোদনের সুযোগ ব্যবহার করে যা https://www.googleapis.com/auth/chat.app.* দিয়ে শুরু হয়

এই টিউটোরিয়ালটি দেখায় যে কীভাবে একটি Google চ্যাট অ্যাপ তৈরি করতে হয় যা বাস্তব সময়ে ঘটনাগুলির প্রতিক্রিয়া জানায়৷ একটি ঘটনার প্রতিক্রিয়া জানানোর সময়, অ্যাপটি একটি চ্যাট স্পেস তৈরি করে এবং পপুলেট করে, বার্তা, স্ল্যাশ কমান্ড এবং ডায়ালগগুলির সাহায্যে ঘটনার রেজোলিউশন সহজ করে এবং একটি Google ডক্স ডকুমেন্টে ঘটনার প্রতিক্রিয়া সংক্ষিপ্ত করতে AI ব্যবহার করে৷

একটি ঘটনা হল এমন একটি ঘটনা যা সমাধান করার জন্য মানুষের একটি দলের অবিলম্বে মনোযোগ প্রয়োজন। ঘটনার উদাহরণগুলির মধ্যে রয়েছে:

  • কাস্টমার রিলেশনশিপ ম্যানেজমেন্ট (CRM) প্ল্যাটফর্মে একটি সময়-সংবেদনশীল কেস তৈরি করা হয়, একটি রেজোলিউশনে একটি পরিষেবা দলকে সহযোগিতা করতে হয়।
  • একটি সিস্টেম অফলাইন হয়ে যায়, সাইটের নির্ভরযোগ্যতা ইঞ্জিনিয়ারদের (SREs) একটি গ্রুপকে সতর্ক করে যাতে তারা এটিকে অনলাইনে ফিরিয়ে আনতে একসাথে কাজ করতে পারে।
  • একটি উচ্চ মাত্রার ভূমিকম্প হয়, এবং জরুরী কর্মীদের তাদের প্রতিক্রিয়া সমন্বয় করতে হবে।

এই টিউটোরিয়ালের উদ্দেশ্যে, ঘটনা সতর্কতা শুরু হয় যখন কেউ একটি ওয়েব পৃষ্ঠা থেকে একটি বোতাম ক্লিক করে ঘটনাটি রিপোর্ট করে। ওয়েব পৃষ্ঠাটি ব্যবহারকারীদের প্রাথমিক ঘটনার তথ্য লিখতে বলে একটি ঘটনা অনুকরণ করে: উত্তরদাতাদের শিরোনাম, বিবরণ এবং ইমেল ঠিকানা।

ইভেন্ট ম্যানেজমেন্ট চ্যাট অ্যাপটি কাজ করে দেখুন:

  • ওয়েবসাইট যে একটি ঘটনা শুরু.
    চিত্র 1. ওয়েবসাইট যেখানে কেউ একটি ঘটনা রিপোর্ট করতে পারে।
  • ঘটনা চ্যাট স্পেস তৈরি করা হয় বিজ্ঞপ্তি.
    চিত্র 2. বিজ্ঞপ্তি যে ঘটনাটি চ্যাট স্পেস তৈরি করা হয়েছে।
  • ঘটনা প্রতিক্রিয়া চ্যাট স্থান.
    চিত্র 3. ঘটনার প্রতিক্রিয়া চ্যাট স্পেস।
  • একটি স্ল্যাশ কমান্ড দিয়ে ঘটনার সমাধান করা হচ্ছে।
    চিত্র 4. একটি স্ল্যাশ কমান্ড দিয়ে ঘটনার সমাধান করা।
  • ঘটনা সমাধান ডায়ালগ.
    চিত্র 5. ঘটনার রেজোলিউশন ডায়ালগ।
  • ঘটনার রেজোলিউশন Google ডক্স ডকুমেন্ট স্পেসে শেয়ার করা হয়েছে।
    চিত্র 6. ঘটনার রেজোলিউশন Google ডক্স ডকুমেন্ট মহাকাশে শেয়ার করা হয়েছে।
  • AI সারাংশ ঘটনার রেজোলিউশন গুগল ডক।
    চিত্র 7. এআই সারাংশ ঘটনার রেজোলিউশন গুগল ডক্স ডকুমেন্ট।

পূর্বশর্ত

আপনার প্রতিষ্ঠানের জন্য এই পূর্বশর্তগুলির মধ্যে যেকোনো একটি চালু করার প্রয়োজন হলে, আপনার Google Workspace অ্যাডমিনিস্ট্রেটরকে সেগুলি চালু করতে বলুন:

  • Google Chat অ্যাক্সেস সহ একটি ব্যবসা বা এন্টারপ্রাইজ Google Workspace অ্যাকাউন্ট।
  • Google Workspace-এর জন্য ডিরেক্টরি (যোগাযোগ শেয়ার করা) চালু করতে। ঘটনা অ্যাপটি ঘটনার উত্তরদাতাদের যোগাযোগের তথ্য, যেমন নাম এবং ইমেল ঠিকানা দেখতে ডিরেক্টরি ব্যবহার করে। ঘটনার উত্তরদাতাদের অবশ্যই আপনার Google Workspace সংস্থার Google Chat অ্যাকাউন্টের ব্যবহারকারী হতে হবে।

উদ্দেশ্য

  • একটি চ্যাট অ্যাপ তৈরি করুন যা ঘটনাগুলির প্রতিক্রিয়া জানায়৷
  • নিম্নলিখিতগুলি করে ব্যবহারকারীদের ঘটনার প্রতিক্রিয়া জানাতে সহায়তা করুন:
    • ঘটনার প্রতিক্রিয়া স্পেস তৈরি করা।
    • ঘটনা এবং প্রতিক্রিয়া সংক্ষিপ্ত বার্তা পোস্ট করা.
    • ইন্টারেক্টিভ চ্যাট অ্যাপের বৈশিষ্ট্যগুলির সাথে সহযোগিতার সহায়ক।
  • Vertex AI এর সাথে কথোপকথন এবং রেজোলিউশনের সারসংক্ষেপ।

স্থাপত্য

নিম্নলিখিত চিত্রটিতে Google Workspace এবং Google ক্লাউড সংস্থানগুলির আর্কিটেকচার দেখানো হয়েছে যা Google Chat অ্যাপের ঘটনা প্রতিক্রিয়ার দ্বারা ব্যবহৃত হয়।

ঘটনার প্রতিক্রিয়ার আর্কিটেকচার গুগল চ্যাট অ্যাপ

আর্কিটেকচারটি দেখায় কিভাবে ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ একটি ঘটনা এবং রেজোলিউশন প্রক্রিয়া করে।

  1. একজন ব্যবহারকারী অ্যাপস স্ক্রিপ্টে হোস্ট করা একটি বহিরাগত ওয়েবসাইট থেকে একটি ঘটনা শুরু করেন।

  2. ওয়েবসাইটটি অ্যাপস স্ক্রিপ্টে হোস্ট করা Google চ্যাট অ্যাপে একটি অ্যাসিঙ্ক্রোনাস HTTP অনুরোধ পাঠায়।

  3. ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ অনুরোধটি প্রক্রিয়া করে:

    1. অ্যাপস স্ক্রিপ্ট অ্যাডমিন SDK পরিষেবা টিমের সদস্যদের তথ্য পায়, যেমন ব্যবহারকারী আইডি এবং ইমেল ঠিকানা।

    2. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবা ব্যবহার করে চ্যাট এপিআই-তে HTTP অনুরোধের একটি সেটের সাথে, ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ একটি ঘটনা চ্যাট স্পেস তৈরি করে, দলের সদস্যদের সাথে এটিকে পপুলেট করে এবং স্পেসে একটি বার্তা পাঠায়।

  4. দলের সদস্যরা চ্যাট স্পেসে ঘটনাটি নিয়ে আলোচনা করে।

  5. একটি দলের সদস্য ঘটনার একটি রেজোলিউশন সংকেত একটি স্ল্যাশ কমান্ড আহ্বান.

    1. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবা ব্যবহার করে চ্যাট API-এ একটি HTTP কল চ্যাট স্পেসের সমস্ত বার্তা তালিকাভুক্ত করে।

    2. Vertex AI তালিকাভুক্ত বার্তাগুলি গ্রহণ করে এবং একটি সারাংশ তৈরি করে।

    3. Apps Script DocumentApp পরিষেবা একটি ডক্স ডকুমেন্ট তৈরি করে এবং ডকুমেন্টে Vertex AI এর সারাংশ যোগ করে।

    4. ঘটনার প্রতিক্রিয়া Google Chat অ্যাপটি Chat API-কে সারসংক্ষেপ ডক্স ডকুমেন্টের লিঙ্ক শেয়ার করে একটি বার্তা পাঠাতে কল করে।

পরিবেশ প্রস্তুত করুন

এই বিভাগটি দেখায় কিভাবে চ্যাট অ্যাপের জন্য একটি Google ক্লাউড প্রকল্প তৈরি এবং কনফিগার করতে হয়।

একটি Google ক্লাউড প্রকল্প তৈরি করুন

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, মেনু > IAM & Admin > Create a Project এ যান।

    একটি প্রকল্প তৈরি করুন এ যান

  2. প্রকল্পের নাম ক্ষেত্রে, আপনার প্রকল্পের জন্য একটি বর্ণনামূলক নাম লিখুন।

    ঐচ্ছিক: প্রকল্প আইডি সম্পাদনা করতে, সম্পাদনা ক্লিক করুন। প্রোজেক্ট তৈরি হওয়ার পর প্রোজেক্ট আইডি পরিবর্তন করা যাবে না, তাই এমন একটি আইডি বেছে নিন যা প্রোজেক্টের জীবনকালের জন্য আপনার চাহিদা পূরণ করে।

  3. অবস্থান ক্ষেত্রে, আপনার প্রকল্পের সম্ভাব্য অবস্থানগুলি প্রদর্শন করতে ব্রাউজ ক্লিক করুন। তারপর, নির্বাচন ক্লিক করুন.
  4. তৈরি করুন ক্লিক করুন। Google ক্লাউড কনসোল ড্যাশবোর্ড পৃষ্ঠায় নেভিগেট করে এবং আপনার প্রকল্পটি কয়েক মিনিটের মধ্যে তৈরি হয়।

জিক্লাউড সিএলআই

নিম্নলিখিত উন্নয়ন পরিবেশগুলির মধ্যে একটিতে, Google ক্লাউড CLI ( gcloud ) অ্যাক্সেস করুন :

  • ক্লাউড শেল : ইতিমধ্যেই সেট আপ করা gcloud CLI সহ একটি অনলাইন টার্মিনাল ব্যবহার করতে, ক্লাউড শেল সক্রিয় করুন।
    ক্লাউড শেল সক্রিয় করুন
  • স্থানীয় শেল : একটি স্থানীয় উন্নয়ন পরিবেশ ব্যবহার করতে, gcloud CLI ইনস্টল এবং আরম্ভ করুন
    একটি ক্লাউড প্রকল্প তৈরি করতে, gcloud projects create কমান্ড ব্যবহার করুন:
    gcloud projects create PROJECT_ID
    আপনি যে প্রকল্পটি তৈরি করতে চান তার জন্য ID সেট করে PROJECT_ID প্রতিস্থাপন করুন।

ক্লাউড প্রকল্পের জন্য বিলিং সক্ষম করুন৷

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, বিলিং- এ যান। মেনু > বিলিং > আমার প্রকল্পে ক্লিক করুন।

    আমার প্রকল্পের জন্য বিলিং এ যান

  2. একটি সংস্থা নির্বাচন করুন -এ, আপনার Google ক্লাউড প্রকল্পের সাথে যুক্ত সংস্থা নির্বাচন করুন৷
  3. প্রকল্পের সারিতে, অ্যাকশন মেনু খুলুন ( ), বিলিং পরিবর্তন করুন এ ক্লিক করুন এবং ক্লাউড বিলিং অ্যাকাউন্ট বেছে নিন।
  4. অ্যাকাউন্ট সেট করুন ক্লিক করুন।

জিক্লাউড সিএলআই

  1. উপলব্ধ বিলিং অ্যাকাউন্টের তালিকা করতে, চালান:
    gcloud billing accounts list
  2. Google ক্লাউড প্রকল্পের সাথে একটি বিলিং অ্যাকাউন্ট লিঙ্ক করুন:
    gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID

    নিম্নলিখিতগুলি প্রতিস্থাপন করুন:

    • PROJECT_ID হল ক্লাউড প্রকল্পের জন্য প্রকল্প আইডি যার জন্য আপনি বিলিং সক্ষম করতে চান৷
    • BILLING_ACCOUNT_ID হল Google ক্লাউড প্রকল্পের সাথে লিঙ্ক করার জন্য বিলিং অ্যাকাউন্ট আইডি

APIs সক্রিয় করুন

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, Google Chat API, Google Docs API, Admin SDK API, Google Workspace Marketplace SDK এবং Vertex AI API সক্ষম করুন।

    APIs সক্রিয় করুন

  2. নিশ্চিত করুন যে আপনি সঠিক ক্লাউড প্রকল্পে API গুলি সক্ষম করছেন, তারপর পরবর্তী ক্লিক করুন।

  3. নিশ্চিত করুন যে আপনি সঠিক API গুলি সক্ষম করছেন, তারপর সক্ষম করুন ক্লিক করুন৷

জিক্লাউড সিএলআই

  1. প্রয়োজনে, বর্তমান ক্লাউড প্রজেক্টটিকে আপনার তৈরি করা একটিতে সেট করুন gcloud config set project কমান্ড:

    gcloud config set project PROJECT_ID

    আপনার তৈরি করা ক্লাউড প্রকল্পের প্রকল্প আইডি দিয়ে PROJECT_ID প্রতিস্থাপন করুন।

  2. Google Chat API, Google Docs API, Admin SDK API, Google Workspace Marketplace SDK, এবং Vertex AI API চালু করুন gcloud services enable কমান্ড দিয়ে:

    gcloud services enable chat.googleapis.com docs.googleapis.com admin.googleapis.com aiplatform.googleapis.com appsmarket-component.googleapis.com

প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

চ্যাট অ্যাপ চ্যাট অ্যাপের শংসাপত্র ব্যবহার করে Google Chat API অ্যাক্সেস করে। অ্যাপটি ব্যবহারকারীর শংসাপত্র সহ অ্যাডমিন SDK API এবং Google ডক্স API অ্যাক্সেস করে৷

ব্যবহারকারীর প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

প্রমাণীকরণ এবং অনুমোদনের মাধ্যমে Chat অ্যাপকে Google Workspace এবং Google ক্লাউড-এর রিসোর্স অ্যাক্সেস করার অনুমতি দেওয়া হয়। বিশেষভাবে, ব্যবহারকারীর প্রমাণীকরণ Google ডক্স API এবং অ্যাডমিন SDK API কল করতে ব্যবহৃত হয়।

এই টিউটোরিয়ালে, আপনি আপনার ওয়ার্কস্পেস ডোমেনে অভ্যন্তরীণভাবে অ্যাপটি প্রকাশ করেন, তাই এটি স্থানধারক তথ্য ব্যবহার করার জন্য গ্রহণযোগ্য। অ্যাপটি বাহ্যিকভাবে প্রকাশ করার আগে, সম্মতি স্ক্রিনে প্রকৃত তথ্য দিয়ে স্থানধারক তথ্য প্রতিস্থাপন করুন।

  1. Google ক্লাউড কনসোলে, মেনু > এ যান > ব্র্যান্ডিং

    ব্র্যান্ডিং এ যান

  2. আপনি যদি ইতিমধ্যেই কনফিগার করে থাকেন, আপনি ব্র্যান্ডিং , দর্শক এবং ডেটা অ্যাক্সেসে নিম্নলিখিত OAuth সম্মতি স্ক্রীন সেটিংস কনফিগার করতে পারেন৷ আপনি যদি একটি বার্তা দেখতে পারেন যা বলে এখনো কনফিগার করা হয়নি , Get Started এ ক্লিক করুন:

    1. অ্যাপ তথ্যের অধীনে, অ্যাপের নামে , Incident Management টাইপ করুন।
    2. ব্যবহারকারী সমর্থন ইমেলে , আপনার ইমেল ঠিকানা বা একটি উপযুক্ত Google গ্রুপ নির্বাচন করুন।
    3. পরবর্তী ক্লিক করুন.
    4. দর্শকের অধীনে, অভ্যন্তরীণ নির্বাচন করুন। আপনি যদি অভ্যন্তরীণ নির্বাচন করতে না পারেন তবে বাহ্যিক নির্বাচন করুন।
    5. পরবর্তী ক্লিক করুন.
    6. যোগাযোগের তথ্যের অধীনে, একটি ইমেল ঠিকানা লিখুন যেখানে আপনাকে আপনার প্রকল্পের যেকোনো পরিবর্তন সম্পর্কে অবহিত করা যেতে পারে।
    7. পরবর্তী ক্লিক করুন.
    8. সমাপ্তির অধীনে, Google API পরিষেবাগুলির ব্যবহারকারীর ডেটা নীতি পর্যালোচনা করুন এবং আপনি যদি সম্মত হন, নির্বাচন করুন আমি Google API পরিষেবাগুলির সাথে সম্মত: ব্যবহারকারী ডেটা নীতি
    9. অবিরত ক্লিক করুন.
    10. তৈরি করুন ক্লিক করুন।
    11. আপনি যদি ব্যবহারকারীর প্রকারের জন্য বাহ্যিক নির্বাচন করেন, পরীক্ষা ব্যবহারকারীদের যোগ করুন:
      1. শ্রোতা ক্লিক করুন.
      2. টেস্ট ব্যবহারকারীদের অধীনে, ব্যবহারকারী যোগ করুন ক্লিক করুন।
      3. আপনার ইমেল ঠিকানা এবং অন্য কোন অনুমোদিত পরীক্ষা ব্যবহারকারীদের লিখুন, তারপর সংরক্ষণ করুন ক্লিক করুন।
  3. ডেটা অ্যাক্সেস > স্কোপ যোগ করুন বা সরান ক্লিক করুন। আপনি আপনার Google ক্লাউড প্রকল্পে সক্ষম করেছেন এমন প্রতিটি API-এর জন্য স্কোপের তালিকা সহ একটি প্যানেল উপস্থিত হয়৷

    1. ম্যানুয়ালি স্কোপ যোগ করুন এর অধীনে, নিম্নলিখিত স্কোপগুলি পেস্ট করুন:

      • https://www.googleapis.com/auth/documents
      • https://www.googleapis.com/auth/admin.directory.user.readonly
      • https://www.googleapis.com/auth/script.external_request
      • https://www.googleapis.com/auth/userinfo.email
      • https://www.googleapis.com/auth/cloud-platform
    2. টেবিলে যোগ করুন ক্লিক করুন।

    3. আপডেট ক্লিক করুন.

    4. আপনার অ্যাপের জন্য প্রয়োজনীয় স্কোপগুলি নির্বাচন করার পরে, ডেটা অ্যাক্সেস পৃষ্ঠায়, সংরক্ষণ করুন ক্লিক করুন।

অ্যাপ প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

Google Chat API কল করতে অ্যাপ প্রমাণীকরণ ব্যবহার করা হয়।

Google ক্লাউড কনসোলে একটি পরিষেবা অ্যাকাউন্ট তৈরি করুন

একটি পরিষেবা অ্যাকাউন্ট তৈরি করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, মেনু > IAM & Admin > Service Accounts- এ যান।

    সার্ভিস অ্যাকাউন্টে যান

  2. পরিষেবা অ্যাকাউন্ট তৈরি করুন ক্লিক করুন।
  3. পরিষেবা অ্যাকাউন্টের বিবরণ পূরণ করুন, তারপর তৈরি করুন এবং চালিয়ে যান ক্লিক করুন।
  4. ঐচ্ছিক: আপনার Google ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা বরাদ্দ করুন৷ আরও বিশদ বিবরণের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর করা, পরিবর্তন করা এবং প্রত্যাহার করা দেখুন।
  5. অবিরত ক্লিক করুন.
  6. ঐচ্ছিক: ব্যবহারকারী বা গোষ্ঠীগুলি লিখুন যারা এই পরিষেবা অ্যাকাউন্টের সাথে ক্রিয়াকলাপ পরিচালনা এবং সম্পাদন করতে পারে৷ আরও বিশদ বিবরণের জন্য, পরিসেবা অ্যাকাউন্ট ছদ্মবেশ ম্যানেজিং দেখুন।
  7. সম্পন্ন ক্লিক করুন. পরিষেবা অ্যাকাউন্টের জন্য ইমেল ঠিকানা একটি নোট করুন.

জিক্লাউড সিএলআই

  1. পরিষেবা অ্যাকাউন্ট তৈরি করুন:
    gcloud iam service-accounts create SERVICE_ACCOUNT_NAME \
      --display-name="SERVICE_ACCOUNT_NAME"
  2. ঐচ্ছিক: আপনার Google ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা বরাদ্দ করুন৷ আরও বিশদ বিবরণের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর করা, পরিবর্তন করা এবং প্রত্যাহার করা দেখুন।

পরিষেবা অ্যাকাউন্ট পরিষেবা অ্যাকাউন্ট পৃষ্ঠায় উপস্থিত হয়৷ পরবর্তী, পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি করুন।

একটি ব্যক্তিগত কী তৈরি করুন

পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি এবং ডাউনলোড করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. Google ক্লাউড কনসোলে, মেনু > IAM & Admin > Service Accounts- এ যান।

    সার্ভিস অ্যাকাউন্টে যান

  2. আপনার পরিষেবা অ্যাকাউন্ট নির্বাচন করুন.
  3. কী > কী যোগ করুন > নতুন কী তৈরি করুন ক্লিক করুন।
  4. JSON নির্বাচন করুন, তারপর তৈরি করুন ক্লিক করুন।

    আপনার নতুন পাবলিক/প্রাইভেট কী জোড়া তৈরি করা হয়েছে এবং একটি নতুন ফাইল হিসেবে আপনার মেশিনে ডাউনলোড করা হয়েছে। ডাউনলোড করা JSON ফাইলটিকে আপনার কাজের ডিরেক্টরিতে credentials.json হিসাবে সংরক্ষণ করুন। এই ফাইলটি এই কীটির একমাত্র অনুলিপি। কীভাবে আপনার কী নিরাপদে সংরক্ষণ করবেন সে সম্পর্কে তথ্যের জন্য, পরিষেবা অ্যাকাউন্ট কীগুলি পরিচালনা করা দেখুন।

  5. বন্ধ ক্লিক করুন.

পরিষেবা অ্যাকাউন্ট সম্পর্কে আরও তথ্যের জন্য, Google ক্লাউড IAM ডকুমেন্টেশনে পরিষেবা অ্যাকাউন্টগুলি দেখুন৷

একটি Google Workspace Marketplace-এর সাথে সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করুন

একটি Google Workspace Marketplace-সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করতে, এই ধাপগুলি অনুসরণ করুন:

  1. Google ক্লাউড কনসোলে, মেনু > IAM & Admin > Service Accounts- এ যান।

    সার্ভিস অ্যাকাউন্টে যান

  2. আপনার চ্যাট অ্যাপের জন্য তৈরি করা পরিষেবা অ্যাকাউন্টে ক্লিক করুন।

  3. Advanced settings এ ক্লিক করুন।

  4. Google Workspace Marketplace-সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করুন- এ ক্লিক করুন।

  5. অবিরত ক্লিক করুন.

একটি কনফার্মেশন মেসেজ দেখা যাচ্ছে যাতে বলা হয়েছে একটি Google Workspace Marketplace-এর সাথে সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করা হয়েছে।

চ্যাট অ্যাপ তৈরি করুন এবং স্থাপন করুন

নিম্নলিখিত বিভাগে, আপনি একটি সম্পূর্ণ অ্যাপস স্ক্রিপ্ট প্রকল্প কপি এবং আপডেট করুন যাতে আপনার চ্যাট অ্যাপের জন্য প্রয়োজনীয় সমস্ত অ্যাপ্লিকেশন কোড রয়েছে, তাই প্রতিটি ফাইল কপি এবং পেস্ট করার প্রয়োজন নেই।

কিছু ফাংশন তাদের নামের শেষে আন্ডারস্কোর অন্তর্ভুক্ত করে, যেমন ChatApp.gs থেকে processSlashCommand_() । একটি ব্রাউজারে খোলা থাকলে আন্ডারস্কোর ঘটনাটি শুরুর ওয়েব পৃষ্ঠা থেকে ফাংশনটিকে লুকিয়ে রাখে। আরও তথ্যের জন্য, ব্যক্তিগত ফাংশন দেখুন।

Apps Script দুটি ধরনের ফাইল সমর্থন করে, .gs স্ক্রিপ্ট এবং .html ফাইল। এই সমর্থন মেনে চলার জন্য, অ্যাপটির ক্লায়েন্ট-সাইড জাভাস্ক্রিপ্ট <script /> ট্যাগের মধ্যে অন্তর্ভুক্ত করা হয়েছে এবং এর CSS একটি HTML ফাইলের ভিতরে <style /> ট্যাগের মধ্যে অন্তর্ভুক্ত করা হয়েছে।

ঐচ্ছিকভাবে, আপনি GitHub-এ পুরো প্রকল্পটি দেখতে পারেন।

GitHub এ দেখুন

এখানে প্রতিটি ফাইলের একটি ওভারভিউ আছে:

Consts.gs

আপনার ক্লাউড প্রোজেক্ট আইডি, ভার্টেক্স এআই লোকেশন আইডি, পরিষেবা অ্যাকাউন্টের জন্য অ্যাপের শংসাপত্র এবং একটি ঘটনা বন্ধ করার জন্য স্ল্যাশ কমান্ড আইডি সহ অন্যান্য কোড ফাইলগুলির দ্বারা উল্লেখ করা ধ্রুবকগুলিকে সংজ্ঞায়িত করে৷

Consts.gs কোড দেখুন

apps-script/incident-response-app-auth/Consts.gs
const PROJECT_ID = 'replace-with-your-project-id';
const CLOSE_INCIDENT_COMMAND_ID = 1;
const APP_CREDENTIALS = 'replace-with-your-app-credentials';
const APP_CREDENTIALS_SCOPES = 'https://www.googleapis.com/auth/chat.bot https://www.googleapis.com/auth/chat.app.memberships https://www.googleapis.com/auth/chat.app.spaces.create';
const VERTEX_AI_LOCATION_ID = 'us-central1';
const MODEL_ID = 'gemini-1.5-flash-002';
ChatApp.gs

বার্তা, কার্ড ক্লিক, স্ল্যাশ কমান্ড এবং ডায়ালগ সহ চ্যাট ইন্টারঅ্যাকশন ইভেন্টগুলি পরিচালনা করে। ঘটনার রেজোলিউশনের বিশদ সংগ্রহ করতে একটি ডায়ালগ খোলার মাধ্যমে /closeIncident স্ল্যাশ কমান্ডের প্রতিক্রিয়া জানায়। Chat API-এ spaces.messages.list পদ্ধতিতে কল করে স্পেস-এ বার্তা পড়ে। অ্যাপস স্ক্রিপ্টে অ্যাডমিন SDK ডিরেক্টরি পরিষেবা ব্যবহার করে ব্যবহারকারী আইডি পায়।

ChatApp.gs কোড দেখুন

apps-script/incident-response-app-auth/ChatApp.gs
/**
 * Responds to a MESSAGE event in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident").
 * It will respond to any other message with a simple "Hello" text message.
 *
 * @param {Object} event the event object from Google Chat
 */
function onMessage(event) {
  if (event.message.slashCommand) {
    return processSlashCommand_(event);
  }
  return { "text": "Hello from Incident Response app!" };
}

/**
 * Responds to a CARD_CLICKED event in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 *
 * @param {Object} event the event object from Google Chat
 */
function onCardClick(event) {
  if (event.isDialogEvent) {
    if (event.dialogEventType == 'SUBMIT_DIALOG') {
      return processSubmitDialog_(event);
    }
    return {
      actionResponse: {
        type: "DIALOG",
        dialogAction: {
          actionStatus: "OK"
        }
      }
    };
  }
}

/**
 * Responds to a MESSAGE event with a Slash command in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident")
 * by returning a Dialog.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSlashCommand_(event) {
  if (event.message.slashCommand.commandId != CLOSE_INCIDENT_COMMAND_ID) {
    return {
      "text": "Command not recognized. Use the command `/closeIncident` to close the incident managed by this space."
    };
  }
  const sections = [
    {
      header: "Close Incident",
      widgets: [
        {
          textInput: {
            label: "Please describe the incident resolution",
            type: "MULTIPLE_LINE",
            name: "description"
          }
        },
        {
          buttonList: {
            buttons: [
              {
                text: "Close Incident",
                onClick: {
                  action: {
                    function: "closeIncident"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  ];
  return {
    actionResponse: {
      type: "DIALOG",
      dialogAction: {
        dialog: {
          body: {
            sections,
          }
        }
      }
    }
  };
}

/**
 * Responds to a CARD_CLICKED event with a Dialog submission in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 * It creates a Doc with a summary of the incident information and posts a message
 * to the space with a link to the Doc.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSubmitDialog_(event) {
  const resolution = event.common.formInputs.description[""].stringInputs.value[0];
  const chatHistory = concatenateAllSpaceMessages_(event.space.name);
  const chatSummary = summarizeChatHistory_(chatHistory);
  const docUrl = createDoc_(event.space.displayName, resolution, chatHistory, chatSummary);
  return {
    actionResponse: {
      type: "NEW_MESSAGE",
    },
    text: `Incident closed with the following resolution: ${resolution}\n\nHere is the automatically generated post-mortem:\n${docUrl}`
  };
}

/**
 * Lists all the messages in the Chat space, then concatenate all of them into
 * a single text containing the full Chat history.
 *
 * For simplicity for this demo, it only fetches the first 100 messages.
 *
 * Messages with slash commands are filtered out, so the returned history will
 * contain only the conversations between users and not app command invocations.
 *
 * @return {string} a text containing all the messages in the space in the format:
 *          Sender's name: Message
 */
function concatenateAllSpaceMessages_(spaceName) {
  // Call Chat API method spaces.messages.list
  const response = Chat.Spaces.Messages.list(spaceName, { 'pageSize': 100 });
  const messages = response.messages;
  // Fetch the display names of the message senders and returns a text
  // concatenating all the messages.
  let userMap = new Map();
  return messages
    .filter(message => message.slashCommand === undefined)
    .map(message => `${getUserDisplayName_(userMap, message.sender.name)}: ${message.text}`)
    .join('\n');
}

/**
 * Obtains the display name of a user by using the Admin Directory API.
 *
 * The fetched display name is cached in the provided map, so we only call the API
 * once per user.
 *
 * If the user does not have a display name, then the full name is used.
 *
 * @param {Map} userMap a map containing the display names previously fetched
 * @param {string} userName the resource name of the user
 * @return {string} the user's display name
 */
function getUserDisplayName_(userMap, userName) {
  if (userMap.has(userName)) {
    return userMap.get(userName);
  }
  let displayName = 'Unknown User';
  try {
    const user = AdminDirectory.Users.get(
      userName.replace("users/", ""),
      { projection: 'BASIC', viewType: 'domain_public' });
    displayName = user.name.displayName ? user.name.displayName : user.name.fullName;
  } catch (e) {
    // Ignore error if the API call fails (for example, because it's an
    // out-of-domain user or Chat app)) and just use 'Unknown User'.
  }
  userMap.set(userName, displayName);
  return displayName;
}
ChatSpaceCreator.gs

ঘটনা প্রারম্ভিক ওয়েব পৃষ্ঠায় ব্যবহারকারীরা প্রবেশ করা ফর্ম ডেটা গ্রহণ করে এবং এটি তৈরি করে এবং পপুলেট করে একটি চ্যাট স্পেস সেট আপ করতে এটি ব্যবহার করে এবং তারপর ঘটনা সম্পর্কে একটি বার্তা পোস্ট করে৷

ChatSpaceCreator.gs কোড দেখুন

apps-script/incident-response-app-auth/ChatSpaceCreator.gs
/**
 * Handles an incident by creating a chat space, adding members, and posting a message.
 * All the actions are done using application credentials.
 *
 * @param {Object} formData - The data submitted by the user. It should contain the fields:
 *                           - title: The display name of the chat space.
 *                           - description: The description of the incident.
 *                           - users: A comma-separated string of user emails to be added to the space.
 * @return {string} The resource name of the new space.
 */
function handleIncident(formData) {
  const users = formData.users.trim().length > 0 ? formData.users.split(',') : [];
  const service = getService_();
  if (!service.hasAccess()) {
    console.error(service.getLastError());
    return;
   }
  const spaceName = createChatSpace_(formData.title, service);
  createHumanMembership_(spaceName, getUserEmail(), service);
  for (const user of users ){
    createHumanMembership_(spaceName, user, service);
  }
  createMessage_(spaceName, formData.description, service);
  return spaceName;
}
/**
 * Creates a chat space with application credentials.
 *
 * @param {string} displayName - The name of the chat space.
 * @param {object} service - The credentials of the service account.
 * @returns {string} The resource name of the new space.
*/
function createChatSpace_(displayName, service) {
  try {
    // For private apps, the alias can be used
    const my_customer_alias = "customers/my_customer";
    // Specify the space to create.
    const space = {
        displayName: displayName,
        spaceType: 'SPACE',                
        customer: my_customer_alias
    };
    // Call Chat API with a service account to create a message.
    const createdSpace = Chat.Spaces.create(
        space,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});
    return createdSpace.name;
  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create space with error %s', err.message);
  }
}
/*
 * Creates a chat message with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} message - The text to be posted.
 * @param {object} service - The credentials of the service account.
 * @return {string} the resource name of the new space.
 */
function createMessage_(spaceName, message, service) {
  try {
    // Call Chat API with a service account to create a message.
    const result = Chat.Spaces.Messages.create(
        {'text': message},
        spaceName,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});

  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create message with error %s', err.message);
  }
}
/**
 * Creates a human membership in a chat space with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} email - The email of the user to be added.
 * @param {object} service - The credentials of the service account.
 */
function createHumanMembership_(spaceName, email, service){
  try{
    const membership = {
      member: {
        name: 'users/'+email,
        // User type for the membership
        type: 'HUMAN'
      }
    };
    const result = Chat.Spaces.Members.create(
      membership,
      spaceName,
      {},
      {'Authorization': 'Bearer ' + service.getAccessToken()}
    );
  } catch (err){
    console.log('Failed to create membership with error %s', err.message)
  }

}

 /*
 * Creates a service for the service account.
 * @return {object}  - The credentials of the service account.
 */
function getService_() {
  return OAuth2.createService(APP_CREDENTIALS.client_email)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(APP_CREDENTIALS.private_key)
      .setIssuer(APP_CREDENTIALS.client_email)
      .setSubject(APP_CREDENTIALS.client_email)
      .setScope(APP_CREDENTIALS_SCOPES)
      .setPropertyStore(PropertiesService.getScriptProperties());
}
DocsApi.gs

ব্যবহারকারীর Google ড্রাইভে একটি Google ডক্স ডকুমেন্ট তৈরি করতে Google ডক্স API-কে কল করে এবং VertexAiApi.gs এ তৈরি ঘটনার তথ্যের একটি সারাংশ নথিতে লেখে।

DocsApi.gs কোড দেখুন

apps-script/incident-response-app-auth/DocsApi.gs
/**
 * Creates a Doc in the user's Google Drive and writes a summary of the incident information to it.
 *
 * @param {string} title The title of the incident
 * @param {string} resolution Incident resolution described by the user
 * @param {string} chatHistory The whole Chat history be included in the document
 * @param {string} chatSummary A summary of the Chat conversation to be included in the document
 * @return {string} the URL of the created Doc
 */
function createDoc_(title, resolution, chatHistory, chatSummary) {
  let doc = DocumentApp.create(title);
  let body = doc.getBody();
  body.appendParagraph(`Post-Mortem: ${title}`).setHeading(DocumentApp.ParagraphHeading.TITLE);
  body.appendParagraph("Resolution").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(resolution);
  body.appendParagraph("Summary of the conversation").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatSummary);
  body.appendParagraph("Full Chat history").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatHistory);
  return doc.getUrl();
}
VertexAiApi.gs

Vertex AI API ব্যবহার করে চ্যাট স্পেসে কথোপকথন সংক্ষিপ্ত করে। এই সারাংশটি DocsAPI.gs এ একটি বিশেষভাবে তৈরি নথিতে পোস্ট করা হয়েছে।

VertexAiApi.gs কোড দেখুন

apps-script/incident-response-app-auth/VertexAiApi.gs
/**
 * Summarizes a Chat conversation using the Vertex AI text prediction API.
 *
 * @param {string} chatHistory The Chat history that will be summarized.
 * @return {string} The content from the text prediction response.
 */


function summarizeChatHistory_(chatHistory) {

  const API_ENDPOINT = `https://${VERTEX_AI_LOCATION_ID}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${VERTEX_AI_LOCATION_ID}/publishers/google/models/${MODEL_ID}:generateContent`;
  const prompt = "Summarize the following conversation between Engineers resolving an incident"
      + " in a few sentences. Use only the information from the conversation.\n\n" + chatHistory;
  // Get the access token.
  const accessToken = ScriptApp.getOAuthToken();

  const headers = {
    'Authorization': 'Bearer ' + accessToken,
    'Content-Type': 'application/json',
  };
  const payload = {
    'contents': {
      'role': 'user',
      'parts' : [
        {
          'text': prompt
        }
      ]
    }
  }
  const options = {
    'method': 'post',
    'headers': headers,
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true,
  };
  try {
    const response = UrlFetchApp.fetch(API_ENDPOINT, options);
    const responseCode = response.getResponseCode();
    const responseText = response.getContentText();

    if (responseCode === 200) {
      const jsonResponse = JSON.parse(responseText);
      console.log(jsonResponse)
      if (jsonResponse.candidates && jsonResponse.candidates.length > 0) {
        return jsonResponse.candidates[0].content.parts[0].text; // Access the summarized text
      } else {
        return "No summary found in response.";
      }

    } else {
      console.error("Vertex AI API Error:", responseCode, responseText);
      return `Error: ${responseCode} - ${responseText}`;
    }
  } catch (e) {
    console.error("UrlFetchApp Error:", e);
    return "Error: " + e.toString();
  }
}
WebController.gs

ঘটনা প্রারম্ভিক ওয়েবসাইট পরিবেশন করে.

WebController.gs কোড দেখুন

apps-script/incident-response-app-auth/WebController.gs
/**
 * Serves the web page from Index.html.
 */
function doGet() {
  return HtmlService
    .createTemplateFromFile('Index')
    .evaluate();
}

/**
 * Serves the web content from the specified filename.
 */
function include(filename) {
  return HtmlService
    .createHtmlOutputFromFile(filename)
    .getContent();
}

/**
 * Returns the email address of the user running the script.
 */
function getUserEmail() {
  return Session.getActiveUser().getEmail();
}
Index.html

এইচটিএমএল যার মধ্যে ঘটনা প্রারম্ভিক ওয়েবসাইট রয়েছে।

Index.html কোড দেখুন

apps-script/incident-response-app-auth/Index.html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
    <?!= include('Stylesheet'); ?>
  </head>
  <body>
    <div class="container">
      <div class="content">
        <h1>Incident Manager</h1>
        <form id="incident-form" onsubmit="handleFormSubmit(this)">
          <div id="form">
            <p>
              <label for="title">Incident title</label><br/>
              <input type="text" name="title" id="title" />
            </p>
            <p>
              <label for="users">Incident responders</label><br/>
              <small>
                Please enter a comma-separated list of email addresses of the users
                that should be added to the space.
                Do not include <?= getUserEmail() ?> as it will be added automatically.
              </small><br/>
              <input type="text" name="users" id="users" />
            </p>
            <p>
              <label for="description">Initial message</label></br>
              <small>This message will be posted after the space is created.</small><br/>
              <textarea name="description" id="description"></textarea>
            </p>
            <p class="text-center">
              <input type="submit" value="CREATE CHAT SPACE" />
            </p>
          </div>
          <div id="output" class="hidden"></div>
          <div id="clear" class="hidden">
            <input type="reset" value="CREATE ANOTHER INCIDENT" onclick="onReset()" />
          </div>
        </form>
      </div>
    </div>
    <?!= include('JavaScript'); ?>
  </body>
</html>
JavaScript.html

ঘটনার শুরুর ওয়েবসাইটের জন্য জমা, ত্রুটি এবং ক্লিয়ার সহ ফর্ম আচরণ পরিচালনা করে। WebController.gs এ কাস্টম include ফাংশন দ্বারা এটি Index.html এ অন্তর্ভুক্ত করা হয়েছে।

JavaScript.html কোড দেখুন

apps-script/incident-response-app-auth/JavaScript.html
<script>
  var formDiv = document.getElementById('form');
  var outputDiv = document.getElementById('output');
  var clearDiv = document.getElementById('clear');

  function handleFormSubmit(formObject) {
    event.preventDefault();
    outputDiv.innerHTML = 'Please wait while we create the space...';
    hide(formDiv);
    show(outputDiv);
    google.script.run
      .withSuccessHandler(updateOutput)
      .withFailureHandler(onFailure)
      .handleIncident(formObject);
  }

  function updateOutput(response) {
    var spaceId = response.replace('spaces/', '');
    outputDiv.innerHTML =
      '<p>Space created!</p><p><a href="https://mail.google.com/chat/#chat/space/'
        + spaceId
        + '" target="_blank">Open space</a></p>';
    show(outputDiv);
    show(clearDiv);
  }

  function onFailure(error) {
    outputDiv.innerHTML = 'ERROR: ' + error.message;
    outputDiv.classList.add('error');
    show(outputDiv);
    show(clearDiv);
  }

  function onReset() {
    outputDiv.innerHTML = '';
    outputDiv.classList.remove('error');
    show(formDiv);
    hide(outputDiv);
    hide(clearDiv);
  }

  function hide(element) {
    element.classList.add('hidden');
  }

  function show(element) {
    element.classList.remove('hidden');
  }
</script>
Stylesheet.html

ঘটনা প্রারম্ভিক ওয়েবসাইট জন্য CSS. WebController.gs এ কাস্টম include ফাংশন দ্বারা এটি Index.html এ অন্তর্ভুক্ত করা হয়েছে।

Stylesheet.html কোড দেখুন

apps-script/incident-response-app-auth/Stylesheet.html৷
<style>
  * {
    box-sizing: border-box;
  }
  body {
    font-family: Roboto, Arial, Helvetica, sans-serif;
  }
  div.container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
  }
  div.content {
    width: 80%;
    max-width: 1000px;
    padding: 1rem;
    border: 1px solid #999;
    border-radius: 0.25rem;
    box-shadow: 0 2px 2px 0 rgba(66, 66, 66, 0.08), 0 2px 4px 2px rgba(66, 66, 66, 0.16);
  }
  h1 {
    text-align: center;
    padding-bottom: 1rem;
    margin: 0 -1rem 1rem -1rem;
    border-bottom: 1px solid #999;
  }
 #output {
    text-align: center;
    min-height: 250px;
  }
  div#clear {
    text-align: center;
    padding-top: 1rem;
    margin: 1rem -1rem 0 -1rem;
    border-top: 1px solid #999;
  }
  input[type=text], textarea {
    width: 100%;
    padding: 1rem 0.5rem;
    margin: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid #999;
    background-color: #f0f0f0;
  }
  textarea {
    height: 5rem;
  }
  small {
    color: #999;
  }
  input[type=submit], input[type=reset] {
    padding: 1rem;
    border: none;
    background-color: #6200ee;
    color: #fff;
    border-radius: 0.25rem;
    width: 25%;
  }
  .hidden {
    display: none;
  }
  .text-center {
    text-align: center;
  }
  .error {
    color: red;
  }
</style>

আপনার ক্লাউড প্রকল্প নম্বর এবং আইডি খুঁজুন

  1. Google ক্লাউড কনসোলে, আপনার ক্লাউড প্রকল্পে যান।

    গুগল ক্লাউড কনসোলে যান

  2. সেটিংস এবং ইউটিলিটি > প্রকল্প সেটিংস ক্লিক করুন।

  3. প্রজেক্ট নম্বর এবং প্রোজেক্ট আইডি ক্ষেত্রের মানগুলি নোট করুন। আপনি নিম্নলিখিত বিভাগে তাদের ব্যবহার করুন.

অ্যাপস স্ক্রিপ্ট প্রকল্প তৈরি করুন

একটি Apps স্ক্রিপ্ট প্রকল্প তৈরি করতে এবং এটিকে আপনার ক্লাউড প্রকল্পের সাথে সংযুক্ত করতে:

  1. Google চ্যাট অ্যাপস স্ক্রিপ্ট প্রকল্পের সাথে ঘটনার প্রতিক্রিয়া জানাতে নিম্নলিখিত বোতামে ক্লিক করুন।
    প্রকল্প খুলুন
  2. ওভারভিউ-এ ক্লিক করুন।
  3. ওভারভিউ পৃষ্ঠায়, ক্লিক করুন একটি অনুলিপি তৈরি করার জন্য আইকন একটি অনুলিপি তৈরি করুন
  4. Apps স্ক্রিপ্ট প্রকল্পের আপনার কপির নাম দিন:

    1. Google চ্যাটের সাথে ঘটনাগুলির প্রতিক্রিয়ার অনুলিপিতে ক্লিক করুন।

    2. প্রকল্পের শিরোনামে , Incident Management Chat app টাইপ করুন।

    3. পুনঃনামকরণ ক্লিক করুন।

  5. আপনার Apps স্ক্রিপ্ট প্রকল্পের অনুলিপিতে, Consts.gs ফাইলে যান এবং আপনার ক্লাউড প্রকল্পের ID দিয়ে YOUR_PROJECT_ID প্রতিস্থাপন করুন।

অ্যাপস স্ক্রিপ্ট প্রকল্পের ক্লাউড প্রকল্প সেট করুন

  1. আপনার Apps স্ক্রিপ্ট প্রকল্পে, ক্লিক করুন প্রকল্প সেটিংসের জন্য আইকন প্রকল্প সেটিংস
  2. Google ক্লাউড প্ল্যাটফর্ম (GCP) প্রকল্পের অধীনে, প্রকল্প পরিবর্তন করুন ক্লিক করুন।
  3. GCP প্রকল্প নম্বরে , আপনার ক্লাউড প্রকল্পের প্রকল্প নম্বর পেস্ট করুন।
  4. সেট প্রকল্প ক্লিক করুন. ক্লাউড প্রকল্প এবং Apps স্ক্রিপ্ট প্রকল্প এখন সংযুক্ত আছে.

একটি Apps স্ক্রিপ্ট স্থাপনা তৈরি করুন৷

এখন যেহেতু সমস্ত কোড রয়েছে, অ্যাপস স্ক্রিপ্ট প্রকল্পটি স্থাপন করুন। আপনি যখন Google ক্লাউডে চ্যাট অ্যাপ কনফিগার করেন তখন আপনি ডিপ্লয়মেন্ট আইডি ব্যবহার করেন।

  1. অ্যাপস স্ক্রিপ্টে, ঘটনা প্রতিক্রিয়া অ্যাপের প্রকল্পটি খুলুন।

    Apps Script এ যান

  2. Deploy > New deployment এ ক্লিক করুন।

  3. যদি অ্যাড-অন এবং ওয়েব অ্যাপ ইতিমধ্যেই নির্বাচিত না থাকে, তাহলে নির্বাচন প্রকারের পাশে, স্থাপনার প্রকারগুলি ক্লিক করুন৷ প্রকল্প সেটিংসের জন্য আইকন এবং অ্যাড-অন এবং ওয়েব অ্যাপ নির্বাচন করুন।

  4. বিবরণে , এই সংস্করণের জন্য একটি বিবরণ লিখুন, যেমন Complete version of incident management app

  5. Execute as তে , User to access the web app নির্বাচন করুন

  6. কার কাছে অ্যাক্সেস আছে , আপনার ওয়ার্কস্পেস সংস্থার মধ্যে যে কেউ নির্বাচন করুন, যেখানে "আপনার ওয়ার্কস্পেস সংস্থা" হল আপনার Google Workspace সংস্থার নাম।

  7. ডিপ্লোয় ক্লিক করুন। অ্যাপস স্ক্রিপ্ট সফল স্থাপনার রিপোর্ট করে এবং ঘটনা প্রারম্ভিক ওয়েব পৃষ্ঠার জন্য একটি স্থাপনার আইডি এবং একটি URL প্রদান করে।

  8. আপনি একটি ঘটনা শুরু করার সময় পরে দেখার জন্য ওয়েব অ্যাপের URL টি নোট করুন৷ ডিপ্লয়মেন্ট আইডি কপি করুন। Google ক্লাউড কনসোলে চ্যাট অ্যাপ কনফিগার করার সময় আপনি এই আইডি ব্যবহার করেন।

  9. সম্পন্ন ক্লিক করুন.

Google ক্লাউড কনসোলে চ্যাট অ্যাপ কনফিগার করুন

এই বিভাগটি দেখায় কিভাবে Google ক্লাউড কনসোলে Google চ্যাট এপিআই কনফিগার করতে হয় আপনার চ্যাট অ্যাপ সম্পর্কে তথ্য সহ, আপনি এইমাত্র আপনার অ্যাপস স্ক্রিপ্ট প্রোজেক্ট থেকে তৈরি করা স্থাপনার আইডি সহ।

  1. Google ক্লাউড কনসোলে, মেনু > আরও প্রোডাক্ট > Google Workspace > প্রোডাক্ট লাইব্রেরি > Google Chat API > Manage > Configuration-এ ক্লিক করুন।

    চ্যাট এপিআই কনফিগারেশনে যান

  2. অ্যাপের নামে , Incident Management টাইপ করুন।

  3. Avatar URL- এ, https://developers.google.com/chat/images/quickstart-app-avatar.png টাইপ করুন।

  4. বর্ণনায় , টাইপ করুন Responds to incidents. .

  5. অন ​​পজিশনে টগল করে ইন্টারেক্টিভ ফিচার সক্ষম করুন ক্লিক করুন।

  6. কার্যকারিতার অধীনে, 1:1 বার্তা গ্রহণ করুন , স্পেস এবং গ্রুপ কথোপকথনে যোগ দিন নির্বাচন করুন।

  7. সংযোগ সেটিংসের অধীনে, অ্যাপস স্ক্রিপ্ট নির্বাচন করুন।

  8. Deployment ID এ, Apps Script Deployment ID পেস্ট করুন যা আপনি Apps Script প্রজেক্ট ডিপ্লয়মেন্ট থেকে আগে কপি করেছেন।

  9. একটি স্ল্যাশ কমান্ড নিবন্ধন করুন যা সম্পূর্ণরূপে বাস্তবায়িত চ্যাট অ্যাপ ব্যবহার করে:

    1. কমান্ডের অধীনে, একটি কমান্ড যোগ করুন ক্লিক করুন।

    2. কমান্ড আইডিতে , 1 টাইপ করুন।

    3. বর্ণনায় , Closes the incident being discussed in the space.

    4. কমান্ড প্রকারের অধীনে, স্ল্যাশ কমান্ড নির্বাচন করুন।

    5. স্ল্যাশ কমান্ডের নামে , /closeIncident টাইপ করুন।

    6. একটি ডায়ালগ খোলে নির্বাচন করুন।

    7. সম্পন্ন ক্লিক করুন. স্ল্যাশ কমান্ড নিবন্ধিত এবং তালিকাভুক্ত।

  10. দৃশ্যমানতার অধীনে, আপনার ওয়ার্কস্পেস ডোমেনে নির্দিষ্ট ব্যক্তি এবং গোষ্ঠীর জন্য এই চ্যাট অ্যাপটি উপলব্ধ করুন নির্বাচন করুন এবং আপনার ইমেল ঠিকানা লিখুন।

  11. লগের অধীনে, লগিং করতে লগ ত্রুটি নির্বাচন করুন।

  12. সংরক্ষণ করুন ক্লিক করুন. একটি কনফিগারেশন সংরক্ষিত বার্তা উপস্থিত হয়, যার অর্থ অ্যাপটি পরীক্ষা করার জন্য প্রস্তুত৷

প্রশাসকের অনুমোদন পান

অ্যাডমিনিস্ট্রেটরের অনুমোদন পেতে, আপনাকে Google Workspace Marketplace SDK-এ Chat অ্যাপ কনফিগার করতে হবে।

Google Workspace Marketplace SDK-এ Chat অ্যাপ কনফিগার করুন

Google Workspace Marketplace SDK-এ Chat অ্যাপ কনফিগার করতে, এই ধাপগুলি অনুসরণ করুন:

  1. Google ক্লাউড কনসোলে, মেনু > APIs & Services > Enabled APIs & Services > Google Workspace Marketplace SDK > অ্যাপ কনফিগারেশন- এ যান।

    অ্যাপ কনফিগারেশনে যান

  2. অ্যাপ কনফিগারেশন পৃষ্ঠাটি সম্পূর্ণ করুন। আপনি কীভাবে আপনার চ্যাট অ্যাপটি কনফিগার করবেন তা নির্ভর করে আপনার অভিপ্রেত শ্রোতা কারা এবং অন্যান্য বিষয়ের উপর। অ্যাপ কনফিগারেশন পৃষ্ঠা সম্পূর্ণ করতে সাহায্যের জন্য, Google Workspace Marketplace SDK-এ আপনার অ্যাপ কনফিগার করুন দেখুন। এই গাইডের উদ্দেশ্যে, নিম্নলিখিত তথ্য লিখুন:

    1. অ্যাপের দৃশ্যমানতার অধীনে, ব্যক্তিগত নির্বাচন করুন।
    2. ইনস্টলেশন সেটিংসের অধীনে, অ্যাডমিন ইনস্টল নির্বাচন করুন।
    3. অ্যাপ ইন্টিগ্রেশনের অধীনে, চ্যাট অ্যাপ নির্বাচন করুন।
    4. OAuth স্কোপের অধীনে, নিম্নলিখিত স্কোপগুলি লিখুন:
      • https://www.googleapis.com/auth/chat.app.spaces
      • https://www.googleapis.com/auth/chat.app.memberships
    5. বিকাশকারী তথ্যের অধীনে, আপনার বিকাশকারীর নাম , বিকাশকারী ওয়েবসাইট URL এবং বিকাশকারী ইমেল লিখুন।
    6. খসড়া সংরক্ষণ করুন ক্লিক করুন.

অ্যাপটি কনফিগার করার পরে, স্টোর তালিকা আপডেট করুন:

  1. Google ক্লাউড কনসোলে, মেনু > APIs & Services > Enabled APIs & Services > Google Workspace Marketplace SDK > স্টোর লিস্টিং- এ যান।
  2. অ্যাপের বিবরণে , বিভাগ হিসেবে ওয়েব ডেভেলপমেন্ট নির্বাচন করুন।
  3. গ্রাফিক সম্পদে , অনুরোধ করা ফরম্যাটে অ্যাপ্লিকেশন আইকন আপলোড করুন।
  4. স্ক্রিনশটগুলিতে , অ্যাপ্লিকেশনটির একটি স্ক্রিনশট আপলোড করুন।
  5. সমর্থন লিঙ্কগুলিতে , পরিষেবার শর্তাবলী URL, গোপনীয়তা URL এবং সমর্থন URL তৈরি করুন৷
  6. ডিস্ট্রিবিউশনে , সেই অঞ্চলগুলি নির্বাচন করুন যেখানে এই অ্যাপ্লিকেশনটি উপলব্ধ হবে৷
  7. প্রকাশ করুন ক্লিক করুন.

প্রশাসকের অনুমোদন পান

এখন যেহেতু আপনার পরিষেবা অ্যাকাউন্ট অ্যাডমিনিস্ট্রেটরের অনুমোদন পাওয়ার জন্য কনফিগার করা হয়েছে, Google Workspace অ্যাডমিনিস্ট্রেটরের কাছ থেকে এটি নিন যিনি Chat অ্যাপের অনুমোদন সেট-আপ করার ধাপগুলি অনুসরণ করে অনুমোদন দিতে পারেন।

চ্যাট অ্যাপটি পরীক্ষা করুন

ঘটনা ব্যবস্থাপনা চ্যাট অ্যাপটি পরীক্ষা করতে, ওয়েব পৃষ্ঠা থেকে একটি ঘটনা শুরু করুন এবং যাচাই করুন যে চ্যাট অ্যাপটি প্রত্যাশা অনুযায়ী কাজ করে:

  1. অ্যাপস স্ক্রিপ্ট স্থাপনার ওয়েব অ্যাপ URL-এ যান।

  2. যখন Apps স্ক্রিপ্ট আপনার ডেটা অ্যাক্সেস করার অনুমতি চায়, তখন অনুমতিগুলি পর্যালোচনা করুন ক্লিক করুন, আপনার Google Workspace ডোমেনে একটি উপযুক্ত Google অ্যাকাউন্ট দিয়ে সাইন ইন করুন এবং অনুমতি দিন ক্লিক করুন।

  3. ঘটনা প্রারম্ভিক ওয়েব পৃষ্ঠা খোলে. পরীক্ষার তথ্য লিখুন:

    1. ঘটনার শিরোনামে , The First Incident টাইপ করুন।
    2. ঐচ্ছিকভাবে, ঘটনা উত্তরদাতাদের মধ্যে, আপনার সহকর্মী ঘটনার উত্তরদাতাদের ইমেল ঠিকানা লিখুন। তাদের অবশ্যই আপনার Google Workspace সংস্থার Google Chat অ্যাকাউন্টের ব্যবহারকারী হতে হবে অথবা স্পেস তৈরি করতে ব্যর্থ হবে। আপনার নিজের ইমেল ঠিকানা লিখবেন না কারণ এটি স্বয়ংক্রিয়ভাবে অন্তর্ভুক্ত।
    3. প্রাথমিক বার্তায় , Testing the incident management Chat app.
  4. চ্যাট স্পেস তৈরি করুন ক্লিক করুন। একটি creating space বার্তা প্রদর্শিত হবে.

  5. স্পেস তৈরি হওয়ার পর একটা Space created! বার্তা প্রদর্শিত হয়। Open Space-এ ক্লিক করুন, যা একটি নতুন ট্যাবে চ্যাটে স্পেস খোলে।

  6. ঐচ্ছিকভাবে, আপনি এবং অন্যান্য ঘটনার উত্তরদাতারা স্পেসে বার্তা পাঠাতে পারেন। অ্যাপটি ভার্টেক্স এআই ব্যবহার করে এই বার্তাগুলিকে সংক্ষিপ্ত করে এবং একটি পূর্ববর্তী নথি শেয়ার করে৷

  7. ঘটনার প্রতিক্রিয়া শেষ করতে এবং রেজোলিউশন প্রক্রিয়া শুরু করতে, চ্যাট স্পেসে, /closeIncident টাইপ করুন। একটি ঘটনা ব্যবস্থাপনা ডায়ালগ খোলে।

  8. ক্লোজ ইভেন্টে , ঘটনার রেজোলিউশনের জন্য একটি বিবরণ লিখুন, যেমন Test complete

  9. ঘটনা বন্ধ করুন ক্লিক করুন।

ইনসিডেন্ট ম্যানেজমেন্ট অ্যাপটি স্থানের বার্তাগুলিকে তালিকাভুক্ত করে, ভার্টেক্স এআই দিয়ে সেগুলিকে সংক্ষিপ্ত করে, একটি Google ডক্স ডকুমেন্টে সারাংশ পেস্ট করে এবং নথিটিকে স্পেসে শেয়ার করে।

পরিষ্কার করুন

এই টিউটোরিয়ালে ব্যবহৃত সংস্থানগুলির জন্য আপনার Google ক্লাউড অ্যাকাউন্টে চার্জ এড়াতে, আমরা আপনাকে ক্লাউড প্রকল্পটি মুছে ফেলার পরামর্শ দিই।

  1. Google ক্লাউড কনসোলে, সম্পদ পরিচালনা পৃষ্ঠাতে যান। মেনু > আইএএম এবং অ্যাডমিন > সম্পদ পরিচালনা করুন ক্লিক করুন।

    রিসোর্স ম্যানেজারে যান

  2. প্রকল্প তালিকায়, আপনি যে প্রকল্পটি মুছতে চান সেটি নির্বাচন করুন এবং তারপরে মুছুন ক্লিক করুন।
  3. ডায়ালগে, প্রকল্প আইডি টাইপ করুন এবং তারপরে প্রকল্পটি মুছে ফেলতে শাট ডাউন ক্লিক করুন।
,

এই টিউটোরিয়ালটি অনুমোদনের সুযোগ ব্যবহার করে যা https://www.googleapis.com/auth/chat.app.* দিয়ে শুরু হয়

এই টিউটোরিয়ালটি দেখায় যে কীভাবে একটি Google চ্যাট অ্যাপ তৈরি করতে হয় যা বাস্তব সময়ে ঘটনাগুলির প্রতিক্রিয়া জানায়৷ একটি ঘটনার প্রতিক্রিয়া জানানোর সময়, অ্যাপটি একটি চ্যাট স্পেস তৈরি করে এবং পপুলেট করে, বার্তা, স্ল্যাশ কমান্ড এবং ডায়ালগগুলির সাহায্যে ঘটনার রেজোলিউশন সহজ করে এবং একটি Google ডক্স ডকুমেন্টে ঘটনার প্রতিক্রিয়া সংক্ষিপ্ত করতে AI ব্যবহার করে৷

একটি ঘটনা হল এমন একটি ঘটনা যা সমাধান করার জন্য মানুষের একটি দলের অবিলম্বে মনোযোগ প্রয়োজন। ঘটনার উদাহরণগুলির মধ্যে রয়েছে:

  • কাস্টমার রিলেশনশিপ ম্যানেজমেন্ট (CRM) প্ল্যাটফর্মে একটি সময়-সংবেদনশীল কেস তৈরি করা হয়, একটি রেজোলিউশনে একটি পরিষেবা দলকে সহযোগিতা করতে হয়।
  • একটি সিস্টেম অফলাইন হয়ে যায়, সাইটের নির্ভরযোগ্যতা ইঞ্জিনিয়ারদের (SREs) একটি গ্রুপকে সতর্ক করে যাতে তারা এটিকে অনলাইনে ফিরিয়ে আনতে একসাথে কাজ করতে পারে।
  • একটি উচ্চ মাত্রার ভূমিকম্প হয়, এবং জরুরী কর্মীদের তাদের প্রতিক্রিয়া সমন্বয় করতে হবে।

এই টিউটোরিয়ালের উদ্দেশ্যে, ঘটনা সতর্কতা শুরু হয় যখন কেউ একটি ওয়েব পৃষ্ঠা থেকে একটি বোতাম ক্লিক করে ঘটনাটি রিপোর্ট করে। ওয়েব পৃষ্ঠাটি ব্যবহারকারীদের প্রাথমিক ঘটনার তথ্য লিখতে বলে একটি ঘটনা অনুকরণ করে: উত্তরদাতাদের শিরোনাম, বিবরণ এবং ইমেল ঠিকানা।

ইভেন্ট ম্যানেজমেন্ট চ্যাট অ্যাপটি কাজ করে দেখুন:

  • ওয়েবসাইট যে একটি ঘটনা শুরু.
    চিত্র 1. ওয়েবসাইট যেখানে কেউ একটি ঘটনা রিপোর্ট করতে পারে।
  • ঘটনা চ্যাট স্পেস তৈরি করা হয় বিজ্ঞপ্তি.
    চিত্র 2. বিজ্ঞপ্তি যে ঘটনাটি চ্যাট স্পেস তৈরি করা হয়েছে।
  • ঘটনা প্রতিক্রিয়া চ্যাট স্থান.
    চিত্র 3. ঘটনার প্রতিক্রিয়া চ্যাট স্পেস।
  • একটি স্ল্যাশ কমান্ড দিয়ে ঘটনার সমাধান করা হচ্ছে।
    চিত্র 4. একটি স্ল্যাশ কমান্ড দিয়ে ঘটনার সমাধান করা।
  • ঘটনা সমাধান ডায়ালগ.
    চিত্র 5. ঘটনার রেজোলিউশন ডায়ালগ।
  • ঘটনার রেজোলিউশন Google ডক্স ডকুমেন্ট স্পেসে শেয়ার করা হয়েছে।
    চিত্র 6. ঘটনার রেজোলিউশন Google ডক্স ডকুমেন্ট মহাকাশে শেয়ার করা হয়েছে।
  • AI সারাংশ ঘটনার রেজোলিউশন গুগল ডক।
    চিত্র 7. এআই সারাংশ ঘটনার রেজোলিউশন গুগল ডক্স ডকুমেন্ট।

পূর্বশর্ত

আপনার প্রতিষ্ঠানের জন্য এই পূর্বশর্তগুলির মধ্যে যেকোনো একটি চালু করার প্রয়োজন হলে, আপনার Google Workspace অ্যাডমিনিস্ট্রেটরকে সেগুলি চালু করতে বলুন:

  • Google Chat অ্যাক্সেস সহ একটি ব্যবসা বা এন্টারপ্রাইজ Google Workspace অ্যাকাউন্ট।
  • Google Workspace-এর জন্য ডিরেক্টরি (যোগাযোগ শেয়ার করা) চালু করতে। ঘটনা অ্যাপটি ঘটনার উত্তরদাতাদের যোগাযোগের তথ্য, যেমন নাম এবং ইমেল ঠিকানা দেখতে ডিরেক্টরি ব্যবহার করে। ঘটনার উত্তরদাতাদের অবশ্যই আপনার Google Workspace সংস্থার Google Chat অ্যাকাউন্টের ব্যবহারকারী হতে হবে।

উদ্দেশ্য

  • একটি চ্যাট অ্যাপ তৈরি করুন যা ঘটনাগুলির প্রতিক্রিয়া জানায়৷
  • নিম্নলিখিতগুলি করে ব্যবহারকারীদের ঘটনার প্রতিক্রিয়া জানাতে সহায়তা করুন:
    • ঘটনার প্রতিক্রিয়া স্পেস তৈরি করা।
    • ঘটনা এবং প্রতিক্রিয়া সংক্ষিপ্ত বার্তা পোস্ট করা.
    • ইন্টারেক্টিভ চ্যাট অ্যাপের বৈশিষ্ট্যগুলির সাথে সহযোগিতার সহায়ক।
  • Vertex AI এর সাথে কথোপকথন এবং রেজোলিউশনের সারসংক্ষেপ।

স্থাপত্য

নিম্নলিখিত চিত্রটিতে Google Workspace এবং Google ক্লাউড সংস্থানগুলির আর্কিটেকচার দেখানো হয়েছে যা Google Chat অ্যাপের ঘটনা প্রতিক্রিয়ার দ্বারা ব্যবহৃত হয়।

ঘটনার প্রতিক্রিয়ার আর্কিটেকচার গুগল চ্যাট অ্যাপ

আর্কিটেকচারটি দেখায় কিভাবে ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ একটি ঘটনা এবং রেজোলিউশন প্রক্রিয়া করে।

  1. একজন ব্যবহারকারী অ্যাপস স্ক্রিপ্টে হোস্ট করা একটি বহিরাগত ওয়েবসাইট থেকে একটি ঘটনা শুরু করেন।

  2. ওয়েবসাইটটি অ্যাপস স্ক্রিপ্টে হোস্ট করা Google চ্যাট অ্যাপে একটি অ্যাসিঙ্ক্রোনাস HTTP অনুরোধ পাঠায়।

  3. ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ অনুরোধটি প্রক্রিয়া করে:

    1. অ্যাপস স্ক্রিপ্ট অ্যাডমিন SDK পরিষেবা টিমের সদস্যদের তথ্য পায়, যেমন ব্যবহারকারী আইডি এবং ইমেল ঠিকানা।

    2. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবা ব্যবহার করে চ্যাট এপিআই-তে HTTP অনুরোধের একটি সেটের সাথে, ঘটনার প্রতিক্রিয়া Google Chat অ্যাপ একটি ঘটনা চ্যাট স্পেস তৈরি করে, দলের সদস্যদের সাথে এটিকে পপুলেট করে এবং স্পেসে একটি বার্তা পাঠায়।

  4. দলের সদস্যরা চ্যাট স্পেসে ঘটনাটি নিয়ে আলোচনা করে।

  5. একটি দলের সদস্য ঘটনার একটি রেজোলিউশন সংকেত একটি স্ল্যাশ কমান্ড আহ্বান.

    1. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবা ব্যবহার করে চ্যাট API-এ একটি HTTP কল চ্যাট স্পেসের সমস্ত বার্তা তালিকাভুক্ত করে।

    2. Vertex AI তালিকাভুক্ত বার্তাগুলি গ্রহণ করে এবং একটি সারাংশ তৈরি করে।

    3. Apps Script DocumentApp পরিষেবা একটি ডক্স ডকুমেন্ট তৈরি করে এবং ডকুমেন্টে Vertex AI এর সারাংশ যোগ করে।

    4. ঘটনার প্রতিক্রিয়া Google Chat অ্যাপটি Chat API-কে সারসংক্ষেপ ডক্স ডকুমেন্টের লিঙ্ক শেয়ার করে একটি বার্তা পাঠাতে কল করে।

পরিবেশ প্রস্তুত করুন

এই বিভাগটি দেখায় কিভাবে চ্যাট অ্যাপের জন্য একটি Google ক্লাউড প্রকল্প তৈরি এবং কনফিগার করতে হয়।

একটি Google ক্লাউড প্রকল্প তৈরি করুন

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, মেনু > IAM & Admin > Create a Project এ যান।

    একটি প্রকল্প তৈরি করুন এ যান

  2. প্রকল্পের নাম ক্ষেত্রে, আপনার প্রকল্পের জন্য একটি বর্ণনামূলক নাম লিখুন।

    ঐচ্ছিক: প্রকল্প আইডি সম্পাদনা করতে, সম্পাদনা ক্লিক করুন। প্রোজেক্ট তৈরি হওয়ার পর প্রোজেক্ট আইডি পরিবর্তন করা যাবে না, তাই এমন একটি আইডি বেছে নিন যা প্রোজেক্টের জীবনকালের জন্য আপনার চাহিদা পূরণ করে।

  3. অবস্থান ক্ষেত্রে, আপনার প্রকল্পের সম্ভাব্য অবস্থানগুলি প্রদর্শন করতে ব্রাউজ ক্লিক করুন। তারপর, নির্বাচন ক্লিক করুন.
  4. তৈরি করুন ক্লিক করুন। Google ক্লাউড কনসোল ড্যাশবোর্ড পৃষ্ঠায় নেভিগেট করে এবং আপনার প্রকল্পটি কয়েক মিনিটের মধ্যে তৈরি হয়।

জিক্লাউড সিএলআই

নিম্নলিখিত উন্নয়ন পরিবেশগুলির মধ্যে একটিতে, Google ক্লাউড CLI ( gcloud ) অ্যাক্সেস করুন :

  • ক্লাউড শেল : ইতিমধ্যেই সেট আপ করা gcloud CLI সহ একটি অনলাইন টার্মিনাল ব্যবহার করতে, ক্লাউড শেল সক্রিয় করুন।
    ক্লাউড শেল সক্রিয় করুন
  • স্থানীয় শেল : একটি স্থানীয় উন্নয়ন পরিবেশ ব্যবহার করতে, gcloud CLI ইনস্টল এবং আরম্ভ করুন
    একটি ক্লাউড প্রকল্প তৈরি করতে, gcloud projects create কমান্ড ব্যবহার করুন:
    gcloud projects create PROJECT_ID
    আপনি যে প্রকল্পটি তৈরি করতে চান তার জন্য ID সেট করে PROJECT_ID প্রতিস্থাপন করুন।

ক্লাউড প্রকল্পের জন্য বিলিং সক্ষম করুন৷

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, বিলিং- এ যান। মেনু > বিলিং > আমার প্রকল্পে ক্লিক করুন।

    আমার প্রকল্পের জন্য বিলিং এ যান

  2. একটি সংস্থা নির্বাচন করুন -এ, আপনার Google ক্লাউড প্রকল্পের সাথে যুক্ত সংস্থা নির্বাচন করুন৷
  3. প্রকল্পের সারিতে, অ্যাকশন মেনু খুলুন ( ), বিলিং পরিবর্তন করুন এ ক্লিক করুন এবং ক্লাউড বিলিং অ্যাকাউন্ট বেছে নিন।
  4. অ্যাকাউন্ট সেট করুন ক্লিক করুন।

জিক্লাউড সিএলআই

  1. উপলব্ধ বিলিং অ্যাকাউন্টের তালিকা করতে, চালান:
    gcloud billing accounts list
  2. Google ক্লাউড প্রকল্পের সাথে একটি বিলিং অ্যাকাউন্ট লিঙ্ক করুন:
    gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID

    নিম্নলিখিতগুলি প্রতিস্থাপন করুন:

    • PROJECT_ID হল ক্লাউড প্রকল্পের জন্য প্রকল্প আইডি যার জন্য আপনি বিলিং সক্ষম করতে চান৷
    • BILLING_ACCOUNT_ID হল Google ক্লাউড প্রকল্পের সাথে লিঙ্ক করার জন্য বিলিং অ্যাকাউন্ট আইডি

APIs সক্রিয় করুন

গুগল ক্লাউড কনসোল

  1. Google ক্লাউড কনসোলে, Google Chat API, Google Docs API, Admin SDK API, Google Workspace Marketplace SDK এবং Vertex AI API সক্ষম করুন।

    APIs সক্রিয় করুন

  2. নিশ্চিত করুন যে আপনি সঠিক ক্লাউড প্রকল্পে API গুলি সক্ষম করছেন, তারপর পরবর্তী ক্লিক করুন।

  3. নিশ্চিত করুন যে আপনি সঠিক API গুলি সক্ষম করছেন, তারপর সক্ষম করুন ক্লিক করুন৷

জিক্লাউড সিএলআই

  1. প্রয়োজনে, বর্তমান ক্লাউড প্রজেক্টটিকে আপনার তৈরি করা একটিতে সেট করুন gcloud config set project কমান্ড:

    gcloud config set project PROJECT_ID

    আপনার তৈরি করা ক্লাউড প্রকল্পের প্রকল্প আইডি দিয়ে PROJECT_ID প্রতিস্থাপন করুন।

  2. গুগল চ্যাট এপিআই, গুগল ডকস এপিআই, অ্যাডমিন এসডিকে এপিআই, গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে এবং gcloud services enable :

    gcloud services enable chat.googleapis.com docs.googleapis.com admin.googleapis.com aiplatform.googleapis.com appsmarket-component.googleapis.com

প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

চ্যাট অ্যাপ্লিকেশনটি চ্যাট অ্যাপের শংসাপত্রগুলি ব্যবহার করে গুগল চ্যাট এপিআই অ্যাক্সেস করে। অ্যাপটি ব্যবহারকারীর শংসাপত্রগুলির সাথে অ্যাডমিন এসডিকে এপিআই এবং গুগল ডক্স এপিআই অ্যাক্সেস করে।

ব্যবহারকারীর প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

প্রমাণীকরণ এবং অনুমোদন গুগল ওয়ার্কস্পেস এবং গুগল ক্লাউডে চ্যাট অ্যাপ্লিকেশন অ্যাক্সেস সংস্থানগুলিকে কোনও ঘটনার প্রতিক্রিয়া প্রক্রিয়া করতে দেয়। বিশেষত, ব্যবহারকারী প্রমাণীকরণ গুগল ডক্স এপিআই এবং অ্যাডমিন এসডিকে এপিআই কল করতে ব্যবহৃত হয়।

এই টিউটোরিয়ালে, আপনি আপনার ওয়ার্কস্পেস ডোমেনে অভ্যন্তরীণভাবে অ্যাপ্লিকেশনটি প্রকাশ করেন, সুতরাং স্থানধারীর তথ্য ব্যবহার করা গ্রহণযোগ্য। বাহ্যিকভাবে অ্যাপ্লিকেশনটি প্রকাশের আগে, সম্মতি স্ক্রিনে প্রকৃত তথ্য সহ স্থানধারক তথ্য প্রতিস্থাপন করুন।

  1. গুগল ক্লাউড কনসোলে, মেনু যান > > ব্র্যান্ডিং

    ব্র্যান্ডিংয়ে যান

  2. আপনি যদি ইতিমধ্যে কনফিগার করেছেন, আপনি ব্র্যান্ডিং , শ্রোতা এবং ডেটা অ্যাক্সেসে নিম্নলিখিত ওএথ সম্মতি স্ক্রিন সেটিংস কনফিগার করতে পারেন। আপনি যদি এমন একটি বার্তা দেখতে পান যা বলে এখনও কনফিগার করা হয়নি , শুরু করুন ক্লিক করুন:

    1. অ্যাপের তথ্যের অধীনে, অ্যাপের নামে , Incident Management টাইপ করুন।
    2. ব্যবহারকারী সমর্থন ইমেইলে , আপনার ইমেল ঠিকানা বা একটি উপযুক্ত গুগল গ্রুপ নির্বাচন করুন।
    3. পরবর্তী ক্লিক করুন.
    4. দর্শকদের অধীনে, অভ্যন্তরীণ নির্বাচন করুন। আপনি যদি অভ্যন্তরীণ নির্বাচন করতে না পারেন তবে বাহ্যিক নির্বাচন করুন।
    5. পরবর্তী ক্লিক করুন.
    6. যোগাযোগের তথ্যের অধীনে, একটি ইমেল ঠিকানা লিখুন যেখানে আপনাকে আপনার প্রকল্পের যে কোনও পরিবর্তন সম্পর্কে অবহিত করা যেতে পারে।
    7. পরবর্তী ক্লিক করুন.
    8. সমাপ্তির অধীনে, গুগল এপিআই পরিষেবাদি ব্যবহারকারী ডেটা নীতি পর্যালোচনা করুন এবং আপনি যদি সম্মত হন তবে নির্বাচন করুন আমি গুগল এপিআই পরিষেবাগুলিতে সম্মত: ব্যবহারকারী ডেটা নীতি
    9. অবিরত ক্লিক করুন.
    10. তৈরি করুন ক্লিক করুন।
    11. আপনি যদি ব্যবহারকারীর ধরণের জন্য বাহ্যিক নির্বাচন করেন তবে পরীক্ষা ব্যবহারকারীদের যুক্ত করুন:
      1. শ্রোতাদের ক্লিক করুন।
      2. পরীক্ষা ব্যবহারকারীদের অধীনে, ব্যবহারকারীদের যুক্ত করুন ক্লিক করুন।
      3. আপনার ইমেল ঠিকানা এবং অন্য কোনও অনুমোদিত পরীক্ষার ব্যবহারকারীদের প্রবেশ করান, তারপরে সংরক্ষণ করুন ক্লিক করুন।
  3. ডেটা অ্যাক্সেস > স্কোপগুলি যুক্ত করুন বা সরান ক্লিক করুন। আপনি আপনার গুগল ক্লাউড প্রকল্পে সক্ষম করেছেন এমন প্রতিটি এপিআইয়ের জন্য স্কোপগুলির একটি তালিকা সহ একটি প্যানেল উপস্থিত রয়েছে।

    1. ম্যানুয়ালি স্কোপগুলি যুক্ত করুন , নিম্নলিখিত স্কোপগুলি পেস্ট করুন:

      • https://www.googleapis.com/auth/documents
      • https://www.googleapis.com/auth/admin.directory.user.readonly
      • https://www.googleapis.com/auth/script.external_request
      • https://www.googleapis.com/auth/userinfo.email
      • https://www.googleapis.com/auth/cloud-platform
    2. টেবিলে যোগ করুন ক্লিক করুন।

    3. আপডেট ক্লিক করুন.

    4. ডেটা অ্যাক্সেস পৃষ্ঠায় আপনার অ্যাপ্লিকেশন দ্বারা প্রয়োজনীয় স্কোপগুলি নির্বাচন করার পরে, সংরক্ষণ করুন ক্লিক করুন।

অ্যাপ্লিকেশন প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

অ্যাপ্লিকেশন প্রমাণীকরণ গুগল চ্যাট এপিআই কল করতে ব্যবহৃত হয়।

গুগল ক্লাউড কনসোলে একটি পরিষেবা অ্যাকাউন্ট তৈরি করুন

একটি পরিষেবা অ্যাকাউন্ট তৈরি করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

গুগল ক্লাউড কনসোল

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. পরিষেবা অ্যাকাউন্ট তৈরি করুন ক্লিক করুন।
  3. পরিষেবা অ্যাকাউন্টের বিশদগুলি পূরণ করুন, তারপরে তৈরি করুন ক্লিক করুন এবং চালিয়ে যান
  4. Ption চ্ছিক: আপনার গুগল ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা অর্পণ করুন। আরও তথ্যের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর, পরিবর্তন এবং প্রত্যাহারকে দেখুন।
  5. অবিরত ক্লিক করুন.
  6. Ption চ্ছিক: ব্যবহারকারী বা গোষ্ঠীগুলি লিখুন যা এই পরিষেবা অ্যাকাউন্টের সাথে ক্রিয়া পরিচালনা করতে এবং সম্পাদন করতে পারে। আরও তথ্যের জন্য, পরিষেবা অ্যাকাউন্টের ছদ্মবেশ পরিচালনা করতে দেখুন।
  7. সম্পন্ন ক্লিক করুন. পরিষেবা অ্যাকাউন্টের জন্য ইমেল ঠিকানার একটি নোট তৈরি করুন।

জিক্লাউড সিএলআই

  1. পরিষেবা অ্যাকাউন্ট তৈরি করুন:
    gcloud iam service-accounts create SERVICE_ACCOUNT_NAME \
      --display-name="SERVICE_ACCOUNT_NAME"
  2. Ption চ্ছিক: আপনার গুগল ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা অর্পণ করুন। আরও তথ্যের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর, পরিবর্তন এবং প্রত্যাহারকে দেখুন।

পরিষেবা অ্যাকাউন্ট পৃষ্ঠায় প্রদর্শিত হবে। এরপরে, পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি করুন।

একটি ব্যক্তিগত কী তৈরি করুন

পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি এবং ডাউনলোড করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. আপনার পরিষেবা অ্যাকাউন্ট নির্বাচন করুন।
  3. কীগুলি ক্লিক করুন > কী যুক্ত করুন > নতুন কী তৈরি করুন
  4. JSON নির্বাচন করুন, তারপরে তৈরি ক্লিক করুন।

    আপনার নতুন পাবলিক/প্রাইভেট কী জুটি একটি নতুন ফাইল হিসাবে আপনার মেশিনে উত্পন্ন এবং ডাউনলোড করা হয়েছে। আপনার ওয়ার্কিং ডিরেক্টরিতে ডাউনলোড করা জেএসএন ফাইলটি credentials.json হিসাবে সংরক্ষণ করুন। এই ফাইলটি এই কীটির একমাত্র অনুলিপি। কীভাবে আপনার কীটি নিরাপদে সঞ্চয় করবেন সে সম্পর্কে তথ্যের জন্য, পরিষেবা অ্যাকাউন্ট কীগুলি পরিচালনা করুন।

  5. বন্ধ ক্লিক করুন.

পরিষেবা অ্যাকাউন্ট সম্পর্কে আরও তথ্যের জন্য, গুগল ক্লাউড আইএএম ডকুমেন্টেশনে পরিষেবা অ্যাকাউন্টগুলি দেখুন।

একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করুন

একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. আপনার চ্যাট অ্যাপের জন্য আপনি তৈরি পরিষেবা অ্যাকাউন্টটি ক্লিক করুন।

  3. Advanced settings এ ক্লিক করুন।

  4. গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করুন ক্লিক করুন।

  5. অবিরত ক্লিক করুন.

একটি নিশ্চিতকরণ বার্তা উপস্থিত হয় যা বলে যে একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করা হয়েছে।

চ্যাট অ্যাপ্লিকেশন তৈরি এবং স্থাপন করুন

নিম্নলিখিত বিভাগে, আপনি একটি সম্পূর্ণ অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পটি অনুলিপি এবং আপডেট করেছেন যাতে আপনার চ্যাট অ্যাপের জন্য প্রয়োজনীয় সমস্ত অ্যাপ্লিকেশন কোড রয়েছে, সুতরাং প্রতিটি ফাইল অনুলিপি এবং পেস্ট করার দরকার নেই।

কিছু ফাংশনগুলির মধ্যে তাদের নামগুলির শেষে আন্ডারস্কোর অন্তর্ভুক্ত রয়েছে, যেমন ChatApp.gs থেকে processSlashCommand_() । ব্রাউজারে খোলা থাকাকালীন আন্ডারস্কোর ঘটনার সূচনা ওয়েব পৃষ্ঠা থেকে ফাংশনটি লুকিয়ে রাখে। আরও তথ্যের জন্য, ব্যক্তিগত ফাংশনগুলি দেখুন।

অ্যাপ্লিকেশন স্ক্রিপ্ট দুটি ফাইল প্রকার, .gs স্ক্রিপ্ট এবং .html ফাইল সমর্থন করে। এই সমর্থনটি মেনে চলার জন্য, অ্যাপের ক্লায়েন্ট-সাইড জাভাস্ক্রিপ্টটি <script /> ট্যাগগুলির ভিতরে অন্তর্ভুক্ত করা হয়েছে এবং এর সিএসএস এইচটিএমএল ফাইলের অভ্যন্তরে <style /> ট্যাগগুলির মধ্যে অন্তর্ভুক্ত রয়েছে।

Ally চ্ছিকভাবে, আপনি গিটহাবের পুরো প্রকল্পটি দেখতে পারেন।

GitHub এ দেখুন

প্রতিটি ফাইলের একটি ওভারভিউ এখানে:

Consts.gs

আপনার ক্লাউড প্রজেক্ট আইডি, ভার্টেক্স এআই লোকেশন আইডি, পরিষেবা অ্যাকাউন্টের জন্য অ্যাপ্লিকেশন শংসাপত্র এবং কোনও ঘটনা বন্ধ করার জন্য স্ল্যাশ কমান্ড আইডি সহ অন্যান্য কোড ফাইলগুলি দ্বারা রেফারেন্সযুক্ত ধ্রুবকগুলি সংজ্ঞায়িত করে।

Consts.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/কনস্টস.জি.এস.
const PROJECT_ID = 'replace-with-your-project-id';
const CLOSE_INCIDENT_COMMAND_ID = 1;
const APP_CREDENTIALS = 'replace-with-your-app-credentials';
const APP_CREDENTIALS_SCOPES = 'https://www.googleapis.com/auth/chat.bot https://www.googleapis.com/auth/chat.app.memberships https://www.googleapis.com/auth/chat.app.spaces.create';
const VERTEX_AI_LOCATION_ID = 'us-central1';
const MODEL_ID = 'gemini-1.5-flash-002';
ChatApp.gs

বার্তা, কার্ড ক্লিক, স্ল্যাশ কমান্ড এবং ডায়ালগ সহ চ্যাট ইন্টারঅ্যাকশন ইভেন্টগুলি পরিচালনা করে। ঘটনার রেজোলিউশনের বিশদ সংগ্রহ করতে একটি ডায়ালগ খোলার মাধ্যমে /closeIncident স্ল্যাশ কমান্ডের প্রতিক্রিয়া। spaces.messages.list কল করে স্পেসে বার্তাগুলি পড়ুন Ch চ্যাট এপিআই -তে লিস্ট পদ্ধতি। অ্যাপস স্ক্রিপ্টে অ্যাডমিন এসডিকে ডিরেক্টরি পরিষেবা ব্যবহার করে ব্যবহারকারী আইডি পান।

ChatApp.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/চ্যাট অ্যাপ.জি.এস
/**
 * Responds to a MESSAGE event in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident").
 * It will respond to any other message with a simple "Hello" text message.
 *
 * @param {Object} event the event object from Google Chat
 */
function onMessage(event) {
  if (event.message.slashCommand) {
    return processSlashCommand_(event);
  }
  return { "text": "Hello from Incident Response app!" };
}

/**
 * Responds to a CARD_CLICKED event in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 *
 * @param {Object} event the event object from Google Chat
 */
function onCardClick(event) {
  if (event.isDialogEvent) {
    if (event.dialogEventType == 'SUBMIT_DIALOG') {
      return processSubmitDialog_(event);
    }
    return {
      actionResponse: {
        type: "DIALOG",
        dialogAction: {
          actionStatus: "OK"
        }
      }
    };
  }
}

/**
 * Responds to a MESSAGE event with a Slash command in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident")
 * by returning a Dialog.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSlashCommand_(event) {
  if (event.message.slashCommand.commandId != CLOSE_INCIDENT_COMMAND_ID) {
    return {
      "text": "Command not recognized. Use the command `/closeIncident` to close the incident managed by this space."
    };
  }
  const sections = [
    {
      header: "Close Incident",
      widgets: [
        {
          textInput: {
            label: "Please describe the incident resolution",
            type: "MULTIPLE_LINE",
            name: "description"
          }
        },
        {
          buttonList: {
            buttons: [
              {
                text: "Close Incident",
                onClick: {
                  action: {
                    function: "closeIncident"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  ];
  return {
    actionResponse: {
      type: "DIALOG",
      dialogAction: {
        dialog: {
          body: {
            sections,
          }
        }
      }
    }
  };
}

/**
 * Responds to a CARD_CLICKED event with a Dialog submission in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 * It creates a Doc with a summary of the incident information and posts a message
 * to the space with a link to the Doc.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSubmitDialog_(event) {
  const resolution = event.common.formInputs.description[""].stringInputs.value[0];
  const chatHistory = concatenateAllSpaceMessages_(event.space.name);
  const chatSummary = summarizeChatHistory_(chatHistory);
  const docUrl = createDoc_(event.space.displayName, resolution, chatHistory, chatSummary);
  return {
    actionResponse: {
      type: "NEW_MESSAGE",
    },
    text: `Incident closed with the following resolution: ${resolution}\n\nHere is the automatically generated post-mortem:\n${docUrl}`
  };
}

/**
 * Lists all the messages in the Chat space, then concatenate all of them into
 * a single text containing the full Chat history.
 *
 * For simplicity for this demo, it only fetches the first 100 messages.
 *
 * Messages with slash commands are filtered out, so the returned history will
 * contain only the conversations between users and not app command invocations.
 *
 * @return {string} a text containing all the messages in the space in the format:
 *          Sender's name: Message
 */
function concatenateAllSpaceMessages_(spaceName) {
  // Call Chat API method spaces.messages.list
  const response = Chat.Spaces.Messages.list(spaceName, { 'pageSize': 100 });
  const messages = response.messages;
  // Fetch the display names of the message senders and returns a text
  // concatenating all the messages.
  let userMap = new Map();
  return messages
    .filter(message => message.slashCommand === undefined)
    .map(message => `${getUserDisplayName_(userMap, message.sender.name)}: ${message.text}`)
    .join('\n');
}

/**
 * Obtains the display name of a user by using the Admin Directory API.
 *
 * The fetched display name is cached in the provided map, so we only call the API
 * once per user.
 *
 * If the user does not have a display name, then the full name is used.
 *
 * @param {Map} userMap a map containing the display names previously fetched
 * @param {string} userName the resource name of the user
 * @return {string} the user's display name
 */
function getUserDisplayName_(userMap, userName) {
  if (userMap.has(userName)) {
    return userMap.get(userName);
  }
  let displayName = 'Unknown User';
  try {
    const user = AdminDirectory.Users.get(
      userName.replace("users/", ""),
      { projection: 'BASIC', viewType: 'domain_public' });
    displayName = user.name.displayName ? user.name.displayName : user.name.fullName;
  } catch (e) {
    // Ignore error if the API call fails (for example, because it's an
    // out-of-domain user or Chat app)) and just use 'Unknown User'.
  }
  userMap.set(userName, displayName);
  return displayName;
}
ChatSpaceCreator.gs

ফর্ম ডেটা ব্যবহারকারীরা ঘটনার সূচনা ওয়েব পৃষ্ঠায় প্রবেশ করে এবং এটি তৈরি এবং পপুলেট করে একটি চ্যাট স্পেস সেট আপ করতে এটি ব্যবহার করে এবং তারপরে ঘটনা সম্পর্কে একটি বার্তা পোস্ট করে।

ChatSpaceCreator.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/চ্যাটস্পেসেক্রেটর.জি.এস
/**
 * Handles an incident by creating a chat space, adding members, and posting a message.
 * All the actions are done using application credentials.
 *
 * @param {Object} formData - The data submitted by the user. It should contain the fields:
 *                           - title: The display name of the chat space.
 *                           - description: The description of the incident.
 *                           - users: A comma-separated string of user emails to be added to the space.
 * @return {string} The resource name of the new space.
 */
function handleIncident(formData) {
  const users = formData.users.trim().length > 0 ? formData.users.split(',') : [];
  const service = getService_();
  if (!service.hasAccess()) {
    console.error(service.getLastError());
    return;
   }
  const spaceName = createChatSpace_(formData.title, service);
  createHumanMembership_(spaceName, getUserEmail(), service);
  for (const user of users ){
    createHumanMembership_(spaceName, user, service);
  }
  createMessage_(spaceName, formData.description, service);
  return spaceName;
}
/**
 * Creates a chat space with application credentials.
 *
 * @param {string} displayName - The name of the chat space.
 * @param {object} service - The credentials of the service account.
 * @returns {string} The resource name of the new space.
*/
function createChatSpace_(displayName, service) {
  try {
    // For private apps, the alias can be used
    const my_customer_alias = "customers/my_customer";
    // Specify the space to create.
    const space = {
        displayName: displayName,
        spaceType: 'SPACE',                
        customer: my_customer_alias
    };
    // Call Chat API with a service account to create a message.
    const createdSpace = Chat.Spaces.create(
        space,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});
    return createdSpace.name;
  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create space with error %s', err.message);
  }
}
/*
 * Creates a chat message with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} message - The text to be posted.
 * @param {object} service - The credentials of the service account.
 * @return {string} the resource name of the new space.
 */
function createMessage_(spaceName, message, service) {
  try {
    // Call Chat API with a service account to create a message.
    const result = Chat.Spaces.Messages.create(
        {'text': message},
        spaceName,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});

  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create message with error %s', err.message);
  }
}
/**
 * Creates a human membership in a chat space with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} email - The email of the user to be added.
 * @param {object} service - The credentials of the service account.
 */
function createHumanMembership_(spaceName, email, service){
  try{
    const membership = {
      member: {
        name: 'users/'+email,
        // User type for the membership
        type: 'HUMAN'
      }
    };
    const result = Chat.Spaces.Members.create(
      membership,
      spaceName,
      {},
      {'Authorization': 'Bearer ' + service.getAccessToken()}
    );
  } catch (err){
    console.log('Failed to create membership with error %s', err.message)
  }

}

 /*
 * Creates a service for the service account.
 * @return {object}  - The credentials of the service account.
 */
function getService_() {
  return OAuth2.createService(APP_CREDENTIALS.client_email)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(APP_CREDENTIALS.private_key)
      .setIssuer(APP_CREDENTIALS.client_email)
      .setSubject(APP_CREDENTIALS.client_email)
      .setScope(APP_CREDENTIALS_SCOPES)
      .setPropertyStore(PropertiesService.getScriptProperties());
}
DocsApi.gs

গুগল ডক্স এপিআইকে কোনও ব্যবহারকারীর গুগল ড্রাইভে একটি গুগল ডক্স ডকুমেন্ট তৈরি করতে কল করে এবং ডকুমেন্টে VertexAiApi.gs তৈরি ঘটনার তথ্যের সংক্ষিপ্তসার লিখেছেন।

DocsApi.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/ডকসাপি.জি.এস
/**
 * Creates a Doc in the user's Google Drive and writes a summary of the incident information to it.
 *
 * @param {string} title The title of the incident
 * @param {string} resolution Incident resolution described by the user
 * @param {string} chatHistory The whole Chat history be included in the document
 * @param {string} chatSummary A summary of the Chat conversation to be included in the document
 * @return {string} the URL of the created Doc
 */
function createDoc_(title, resolution, chatHistory, chatSummary) {
  let doc = DocumentApp.create(title);
  let body = doc.getBody();
  body.appendParagraph(`Post-Mortem: ${title}`).setHeading(DocumentApp.ParagraphHeading.TITLE);
  body.appendParagraph("Resolution").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(resolution);
  body.appendParagraph("Summary of the conversation").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatSummary);
  body.appendParagraph("Full Chat history").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatHistory);
  return doc.getUrl();
}
VertexAiApi.gs

ভার্টেক্স এআই এপিআই ব্যবহার করে চ্যাট স্পেসে কথোপকথনের সংক্ষিপ্তসার করে। এই সংক্ষিপ্তসারটি DocsAPI.gs একটি বিশেষভাবে তৈরি ডকুমেন্টে পোস্ট করা হয়েছে।

VertexAiApi.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/ভার্টেক্সাইপাই.জি.এস
/**
 * Summarizes a Chat conversation using the Vertex AI text prediction API.
 *
 * @param {string} chatHistory The Chat history that will be summarized.
 * @return {string} The content from the text prediction response.
 */


function summarizeChatHistory_(chatHistory) {

  const API_ENDPOINT = `https://${VERTEX_AI_LOCATION_ID}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${VERTEX_AI_LOCATION_ID}/publishers/google/models/${MODEL_ID}:generateContent`;
  const prompt = "Summarize the following conversation between Engineers resolving an incident"
      + " in a few sentences. Use only the information from the conversation.\n\n" + chatHistory;
  // Get the access token.
  const accessToken = ScriptApp.getOAuthToken();

  const headers = {
    'Authorization': 'Bearer ' + accessToken,
    'Content-Type': 'application/json',
  };
  const payload = {
    'contents': {
      'role': 'user',
      'parts' : [
        {
          'text': prompt
        }
      ]
    }
  }
  const options = {
    'method': 'post',
    'headers': headers,
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true,
  };
  try {
    const response = UrlFetchApp.fetch(API_ENDPOINT, options);
    const responseCode = response.getResponseCode();
    const responseText = response.getContentText();

    if (responseCode === 200) {
      const jsonResponse = JSON.parse(responseText);
      console.log(jsonResponse)
      if (jsonResponse.candidates && jsonResponse.candidates.length > 0) {
        return jsonResponse.candidates[0].content.parts[0].text; // Access the summarized text
      } else {
        return "No summary found in response.";
      }

    } else {
      console.error("Vertex AI API Error:", responseCode, responseText);
      return `Error: ${responseCode} - ${responseText}`;
    }
  } catch (e) {
    console.error("UrlFetchApp Error:", e);
    return "Error: " + e.toString();
  }
}
WebController.gs

ঘটনার সূচনা ওয়েবসাইট পরিবেশন করে।

WebController.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/ওয়েব কন্ট্রোলার.জিএস
/**
 * Serves the web page from Index.html.
 */
function doGet() {
  return HtmlService
    .createTemplateFromFile('Index')
    .evaluate();
}

/**
 * Serves the web content from the specified filename.
 */
function include(filename) {
  return HtmlService
    .createHtmlOutputFromFile(filename)
    .getContent();
}

/**
 * Returns the email address of the user running the script.
 */
function getUserEmail() {
  return Session.getActiveUser().getEmail();
}
Index.html

ঘটনার সূচনা ওয়েবসাইটের সমন্বয়ে এইচটিএমএল।

Index.html দেখুন html কোড

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ্লিকেশন-এথ/ইনডেক্স এইচটিএমএল
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
    <?!= include('Stylesheet'); ?>
  </head>
  <body>
    <div class="container">
      <div class="content">
        <h1>Incident Manager</h1>
        <form id="incident-form" onsubmit="handleFormSubmit(this)">
          <div id="form">
            <p>
              <label for="title">Incident title</label><br/>
              <input type="text" name="title" id="title" />
            </p>
            <p>
              <label for="users">Incident responders</label><br/>
              <small>
                Please enter a comma-separated list of email addresses of the users
                that should be added to the space.
                Do not include <?= getUserEmail() ?> as it will be added automatically.
              </small><br/>
              <input type="text" name="users" id="users" />
            </p>
            <p>
              <label for="description">Initial message</label></br>
              <small>This message will be posted after the space is created.</small><br/>
              <textarea name="description" id="description"></textarea>
            </p>
            <p class="text-center">
              <input type="submit" value="CREATE CHAT SPACE" />
            </p>
          </div>
          <div id="output" class="hidden"></div>
          <div id="clear" class="hidden">
            <input type="reset" value="CREATE ANOTHER INCIDENT" onclick="onReset()" />
          </div>
        </form>
      </div>
    </div>
    <?!= include('JavaScript'); ?>
  </body>
</html>
JavaScript.html

ঘটনার সূচনা ওয়েবসাইটের জন্য জমা, ত্রুটি এবং ক্লিয়ার সহ ফর্ম আচরণ পরিচালনা করে। এটি কাস্টম দ্বারা Index.html এ অন্তর্ভুক্ত রয়েছে WebController.gs এ ফাংশন include

JavaScript.html কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/জাভাস্ক্রিপ্ট.এইচটিএমএল
<script>
  var formDiv = document.getElementById('form');
  var outputDiv = document.getElementById('output');
  var clearDiv = document.getElementById('clear');

  function handleFormSubmit(formObject) {
    event.preventDefault();
    outputDiv.innerHTML = 'Please wait while we create the space...';
    hide(formDiv);
    show(outputDiv);
    google.script.run
      .withSuccessHandler(updateOutput)
      .withFailureHandler(onFailure)
      .handleIncident(formObject);
  }

  function updateOutput(response) {
    var spaceId = response.replace('spaces/', '');
    outputDiv.innerHTML =
      '<p>Space created!</p><p><a href="https://mail.google.com/chat/#chat/space/'
        + spaceId
        + '" target="_blank">Open space</a></p>';
    show(outputDiv);
    show(clearDiv);
  }

  function onFailure(error) {
    outputDiv.innerHTML = 'ERROR: ' + error.message;
    outputDiv.classList.add('error');
    show(outputDiv);
    show(clearDiv);
  }

  function onReset() {
    outputDiv.innerHTML = '';
    outputDiv.classList.remove('error');
    show(formDiv);
    hide(outputDiv);
    hide(clearDiv);
  }

  function hide(element) {
    element.classList.add('hidden');
  }

  function show(element) {
    element.classList.remove('hidden');
  }
</script>
Stylesheet.html

ঘটনা সূচনা ওয়েবসাইটের জন্য সিএসএস। এটি কাস্টম দ্বারা Index.html এ অন্তর্ভুক্ত রয়েছে WebController.gs এ ফাংশন include

Stylesheet.html কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/স্টাইলশিট এইচটিএমএল
<style>
  * {
    box-sizing: border-box;
  }
  body {
    font-family: Roboto, Arial, Helvetica, sans-serif;
  }
  div.container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
  }
  div.content {
    width: 80%;
    max-width: 1000px;
    padding: 1rem;
    border: 1px solid #999;
    border-radius: 0.25rem;
    box-shadow: 0 2px 2px 0 rgba(66, 66, 66, 0.08), 0 2px 4px 2px rgba(66, 66, 66, 0.16);
  }
  h1 {
    text-align: center;
    padding-bottom: 1rem;
    margin: 0 -1rem 1rem -1rem;
    border-bottom: 1px solid #999;
  }
 #output {
    text-align: center;
    min-height: 250px;
  }
  div#clear {
    text-align: center;
    padding-top: 1rem;
    margin: 1rem -1rem 0 -1rem;
    border-top: 1px solid #999;
  }
  input[type=text], textarea {
    width: 100%;
    padding: 1rem 0.5rem;
    margin: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid #999;
    background-color: #f0f0f0;
  }
  textarea {
    height: 5rem;
  }
  small {
    color: #999;
  }
  input[type=submit], input[type=reset] {
    padding: 1rem;
    border: none;
    background-color: #6200ee;
    color: #fff;
    border-radius: 0.25rem;
    width: 25%;
  }
  .hidden {
    display: none;
  }
  .text-center {
    text-align: center;
  }
  .error {
    color: red;
  }
</style>

আপনার ক্লাউড প্রকল্প নম্বর এবং আইডি সন্ধান করুন

  1. গুগল ক্লাউড কনসোলে, আপনার ক্লাউড প্রকল্পে যান।

    গুগল ক্লাউড কনসোলে যান

  2. সেটিংস এবং ইউটিলিটিগুলি > প্রকল্প সেটিংসে ক্লিক করুন।

  3. প্রকল্প নম্বর এবং প্রকল্প আইডি ক্ষেত্রগুলিতে মানগুলি নোট করুন। আপনি এগুলি নিম্নলিখিত বিভাগগুলিতে ব্যবহার করেন।

অ্যাপস স্ক্রিপ্ট প্রকল্প তৈরি করুন

একটি অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্প তৈরি করতে এবং এটি আপনার ক্লাউড প্রকল্পের সাথে সংযুক্ত করতে:

  1. গুগল চ্যাট অ্যাপস স্ক্রিপ্ট প্রকল্পের সাথে ঘটনার প্রতিক্রিয়া খুলতে নিম্নলিখিত বোতামটি ক্লিক করুন।
    প্রকল্পটি খুলুন
  2. ওভারভিউ ক্লিক করুন।
  3. ওভারভিউ পৃষ্ঠায়, ক্লিক করুন একটি অনুলিপি তৈরি করার জন্য আইকন একটি অনুলিপি করুন
  4. অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পের আপনার অনুলিপিটির নাম দিন:

    1. গুগল চ্যাট সহ ঘটনার প্রতিক্রিয়াটির অনুলিপি ক্লিক করুন।

    2. প্রকল্পের শিরোনামে , Incident Management Chat app টাইপ করুন।

    3. পুনঃনামকরণ ক্লিক করুন।

  5. অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পের আপনার অনুলিপিতে, Consts.gs ফাইলে যান এবং আপনার ক্লাউড প্রকল্পের আইডি দিয়ে YOUR_PROJECT_ID প্রতিস্থাপন করুন।

অ্যাপস স্ক্রিপ্ট প্রকল্পের ক্লাউড প্রকল্প সেট করুন

  1. আপনার অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পে ক্লিক করুন প্রকল্প সেটিংসের জন্য আইকন প্রকল্প সেটিংস
  2. Google ক্লাউড প্ল্যাটফর্ম (GCP) প্রকল্পের অধীনে, প্রকল্প পরিবর্তন করুন ক্লিক করুন।
  3. জিসিপি প্রকল্পের নম্বরগুলিতে , আপনার ক্লাউড প্রকল্পের প্রকল্প নম্বরটি আটকান।
  4. সেট প্রকল্প ক্লিক করুন। ক্লাউড প্রকল্প এবং অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্প এখন সংযুক্ত।

একটি অ্যাপ্লিকেশন স্ক্রিপ্ট স্থাপনা তৈরি করুন

এখন যে সমস্ত কোড স্থানে রয়েছে, অ্যাপস স্ক্রিপ্ট প্রকল্পটি স্থাপন করুন। আপনি গুগল ক্লাউডে চ্যাট অ্যাপটি কনফিগার করার সময় আপনি ডিপ্লোয়মেন্ট আইডি ব্যবহার করেন।

  1. অ্যাপস স্ক্রিপ্টে, ঘটনা প্রতিক্রিয়া অ্যাপের প্রকল্পটি খুলুন।

    অ্যাপস স্ক্রিপ্টে যান

  2. মোতায়েন > নতুন স্থাপনা ক্লিক করুন।

  3. যদি অ্যাড-অন এবং ওয়েব অ্যাপ্লিকেশন ইতিমধ্যে নির্বাচিত না হয়, নির্বাচন প্রকারের পাশে, স্থাপনার ধরণগুলিতে ক্লিক করুন প্রকল্প সেটিংসের জন্য আইকন এবং অ্যাড-অন এবং ওয়েব অ্যাপ্লিকেশন নির্বাচন করুন।

  4. বর্ণনায় , এই সংস্করণটির জন্য একটি বিবরণ লিখুন, যেমন Complete version of incident management app মতো।

  5. যেমন কার্যকর করুন , ওয়েব অ্যাপ্লিকেশন অ্যাক্সেসকারী ব্যবহারকারী নির্বাচন করুন

  6. কার অ্যাক্সেস রয়েছে , আপনার ওয়ার্কস্পেস সংস্থার মধ্যে যে কোনও ব্যক্তিকে নির্বাচন করুন, যেখানে "আপনার ওয়ার্কস্পেস অর্গানাইজেশন" আপনার গুগল ওয়ার্কস্পেস সংস্থার নাম।

  7. ডিপ্লোয় ক্লিক করুন। অ্যাপ্লিকেশন স্ক্রিপ্ট সফল মোতায়েনের প্রতিবেদন করে এবং ঘটনার সূচনা ওয়েব পৃষ্ঠার জন্য একটি স্থাপনার আইডি এবং একটি ইউআরএল সরবরাহ করে।

  8. আপনি যখন কোনও ঘটনা শুরু করবেন তখন পরে দেখার জন্য ওয়েব অ্যাপ্লিকেশন ইউআরএলটি নোট করুন। স্থাপনার আইডি অনুলিপি করুন। গুগল ক্লাউড কনসোলে চ্যাট অ্যাপটি কনফিগার করার সময় আপনি এই আইডিটি ব্যবহার করেন।

  9. সম্পন্ন ক্লিক করুন.

গুগল ক্লাউড কনসোলে চ্যাট অ্যাপটি কনফিগার করুন

এই বিভাগটি দেখায় যে কীভাবে আপনি আপনার অ্যাপস স্ক্রিপ্ট প্রকল্প থেকে তৈরি করেছেন এমন স্থাপনার আইডি সহ আপনার চ্যাট অ্যাপ্লিকেশন সম্পর্কিত তথ্য সহ গুগল ক্লাউড কনসোলে গুগল চ্যাট এপিআই কীভাবে কনফিগার করবেন তা দেখায়।

  1. গুগল ক্লাউড কনসোলে, মেনু > আরও পণ্য > গুগল ওয়ার্কস্পেস > পণ্য লাইব্রেরি > গুগল চ্যাট এপিআই > পরিচালনা > কনফিগারেশন ক্লিক করুন।

    চ্যাট এপিআই কনফিগারেশনে যান

  2. অ্যাপের নামে , Incident Management টাইপ করুন।

  3. অবতার ইউআরএল- এ, https://developers.google.com/chat/images/quickstart-app-avatar.png টাইপ করুন।

  4. বর্ণনায় , টাইপ Responds to incidents. .

  5. ইন্টারেক্টিভ বৈশিষ্ট্যগুলি অন পজিশনে টগল সক্ষম করুন ক্লিক করুন।

  6. কার্যকারিতার অধীনে, 1: 1 বার্তা প্রাপ্ত নির্বাচন করুন, স্পেস এবং গ্রুপ কথোপকথনে যোগদান করুন

  7. সংযোগ সেটিংসের অধীনে অ্যাপ্লিকেশন স্ক্রিপ্ট নির্বাচন করুন।

  8. মোতায়েন আইডিতে , অ্যাপস স্ক্রিপ্ট ডিপ্লোয়মেন্ট আইডি যা আপনি অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পের স্থাপনার আগে অনুলিপি করেছেন তা পেস্ট করুন।

  9. সম্পূর্ণরূপে বাস্তবায়িত চ্যাট অ্যাপ্লিকেশনটি ব্যবহার করে এমন একটি স্ল্যাশ কমান্ডটি নিবন্ধ করুন:

    1. কমান্ডের অধীনে, একটি কমান্ড যুক্ত করুন ক্লিক করুন।

    2. কমান্ড আইডি , টাইপ 1

    3. বর্ণনায় , টাইপটি Closes the incident being discussed in the space.

    4. কমান্ড ধরণের অধীনে, স্ল্যাশ কমান্ড নির্বাচন করুন।

    5. স্ল্যাশ কমান্ডের নাম , টাইপ /closeIncident

    6. নির্বাচন একটি ডায়ালগ খোলে

    7. সম্পন্ন ক্লিক করুন. স্ল্যাশ কমান্ডটি নিবন্ধিত এবং তালিকাভুক্ত করা হয়েছে।

  10. দৃশ্যমানতার অধীনে, আপনার ওয়ার্কস্পেস ডোমেনের নির্দিষ্ট লোক এবং গোষ্ঠীগুলির জন্য এই চ্যাট অ্যাপ্লিকেশনটি উপলব্ধ করুন এবং আপনার ইমেল ঠিকানা লিখুন নির্বাচন করুন।

  11. লগগুলির অধীনে, লগিংয়ে লগ ত্রুটিগুলি নির্বাচন করুন।

  12. সংরক্ষণ করুন ক্লিক করুন. একটি কনফিগারেশন সংরক্ষিত বার্তা উপস্থিত হয়, যার অর্থ অ্যাপটি পরীক্ষা করতে প্রস্তুত।

প্রশাসকের অনুমোদন পান

প্রশাসকের অনুমোদন পেতে, আপনাকে অবশ্যই গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে চ্যাট অ্যাপটি কনফিগার করতে হবে।

গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে চ্যাট অ্যাপটি কনফিগার করুন

গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে চ্যাট অ্যাপ্লিকেশনটি কনফিগার করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > এপিআইএস এবং পরিষেবাদি > সক্ষম এপিআইএস এবং পরিষেবাদি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে > অ্যাপ্লিকেশন কনফিগারেশনে যান।

    অ্যাপ কনফিগারেশনে যান

  2. অ্যাপ্লিকেশন কনফিগারেশন পৃষ্ঠা সম্পূর্ণ করুন। আপনি কীভাবে আপনার চ্যাট অ্যাপ্লিকেশনটি কনফিগার করেন তা নির্ভর করে আপনার উদ্দেশ্যযুক্ত শ্রোতা কে এবং অন্যান্য কারণগুলি। অ্যাপ্লিকেশন কনফিগারেশন পৃষ্ঠা সম্পূর্ণ করতে সহায়তার জন্য, গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে আপনার অ্যাপ্লিকেশনটি কনফিগার করুন । এই গাইডের উদ্দেশ্যে, নিম্নলিখিত তথ্য লিখুন:

    1. অ্যাপ্লিকেশন দৃশ্যমানতার অধীনে, ব্যক্তিগত নির্বাচন করুন।
    2. ইনস্টলেশন সেটিংসের অধীনে অ্যাডমিন ইনস্টল নির্বাচন করুন।
    3. অ্যাপ্লিকেশন সংহতকরণের অধীনে, চ্যাট অ্যাপ্লিকেশন নির্বাচন করুন।
    4. ওআউথ স্কোপগুলির অধীনে, নিম্নলিখিত স্কোপগুলি প্রবেশ করুন:
      • https://www.googleapis.com/auth/chat.app.spaces
      • https://www.googleapis.com/auth/chat.app.memberships
    5. বিকাশকারী তথ্যের অধীনে, আপনার বিকাশকারী নাম , বিকাশকারী ওয়েবসাইট ইউআরএল এবং বিকাশকারী ইমেল লিখুন।
    6. খসড়া সংরক্ষণ করুন ক্লিক করুন.

অ্যাপটি কনফিগার করার পরে, স্টোরের তালিকা আপডেট করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > এপিআইএস এবং পরিষেবাদি > সক্ষম এপিআই এবং পরিষেবাদি > গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে > স্টোর তালিকাতে যান।
  2. অ্যাপের বিশদগুলিতে , বিভাগ হিসাবে ওয়েব বিকাশ নির্বাচন করুন।
  3. গ্রাফিক সম্পদে , অনুরোধ করা ফর্ম্যাটগুলিতে অ্যাপ্লিকেশন আইকনগুলি আপলোড করুন।
  4. স্ক্রিনশটগুলিতে , অ্যাপ্লিকেশনটির একটি স্ক্রিনশট আপলোড করুন।
  5. সমর্থন লিঙ্কগুলিতে , পরিষেবা ইউআরএল, গোপনীয়তা ইউআরএল এবং সমর্থন ইউআরএল এর একটি শর্তাদি তৈরি করুন।
  6. বিতরণে , সেই অঞ্চলগুলি নির্বাচন করুন যেখানে এই অ্যাপ্লিকেশনটি উপলব্ধ থাকবে।
  7. প্রকাশ করুন ক্লিক করুন.

প্রশাসকের অনুমোদন পান

এখন যেহেতু আপনার পরিষেবা অ্যাকাউন্টটি প্রশাসকের অনুমোদন পাওয়ার জন্য কনফিগার করা হয়েছে, এটি গুগল ওয়ার্কস্পেস প্রশাসকের কাছ থেকে গ্রহণ করুন যিনি চ্যাট অ্যাপ্লিকেশনগুলির জন্য অনুমোদনের সেট আপ করার পদক্ষেপগুলি অনুসরণ করে অনুমোদন দিতে পারেন।

চ্যাট অ্যাপ্লিকেশন পরীক্ষা করুন

ঘটনা পরিচালনার চ্যাট অ্যাপ্লিকেশনটি পরীক্ষা করতে, ওয়েব পৃষ্ঠা থেকে একটি ঘটনা শুরু করুন এবং চ্যাট অ্যাপটি প্রত্যাশার মতো কাজ করে কিনা তা যাচাই করুন:

  1. অ্যাপস স্ক্রিপ্ট ডিপ্লোয়মেন্ট ওয়েব অ্যাপ ইউআরএল এ যান।

  2. যখন অ্যাপস স্ক্রিপ্ট আপনার ডেটা অ্যাক্সেস করার অনুমতি জিজ্ঞাসা করে, পর্যালোচনা অনুমতিগুলি ক্লিক করুন, আপনার গুগল ওয়ার্কস্পেস ডোমেনে একটি উপযুক্ত গুগল অ্যাকাউন্টের সাথে সাইন ইন করুন এবং অনুমতি দিন ক্লিক করুন।

  3. ঘটনার সূচনা ওয়েব পৃষ্ঠা খোলে। পরীক্ষার তথ্য লিখুন:

    1. ঘটনার শিরোনামে , The First Incident টাইপ করুন।
    2. Ally চ্ছিকভাবে, ঘটনার প্রতিক্রিয়াকারীদের ক্ষেত্রে, আপনার সহকর্মী ঘটনার প্রতিক্রিয়াকারীদের ইমেল ঠিকানাগুলি প্রবেশ করুন। আপনার গুগল ওয়ার্কস্পেস অর্গানাইজেশন বা স্পেস সৃজন ব্যর্থতায় গুগল চ্যাট অ্যাকাউন্ট সহ তারা অবশ্যই ব্যবহারকারী হতে হবে। আপনার নিজের ইমেল ঠিকানা প্রবেশ করবেন না কারণ এটি স্বয়ংক্রিয়ভাবে অন্তর্ভুক্ত রয়েছে।
    3. প্রাথমিক বার্তায় , Testing the incident management Chat app.
  4. চ্যাট স্পেস তৈরি করুন ক্লিক করুন। একটি creating space বার্তা প্রদর্শিত হবে।

  5. স্থান তৈরি হওয়ার পরে, একটি Space created! বার্তা প্রদর্শিত হয়। ওপেন স্পেস ক্লিক করুন, যা একটি নতুন ট্যাবে চ্যাটে স্থানটি খোলে।

  6. Ally চ্ছিকভাবে, আপনি এবং অন্যান্য ঘটনার প্রতিক্রিয়াকারীরা স্থানটিতে বার্তা প্রেরণ করতে পারেন। অ্যাপ্লিকেশনটি ভার্টেক্স এআই ব্যবহার করে এই বার্তাগুলির সংক্ষিপ্তসার করে এবং একটি পূর্ববর্তী নথি ভাগ করে দেয়।

  7. ঘটনার প্রতিক্রিয়া শেষ করতে এবং রেজোলিউশন প্রক্রিয়া শুরু করতে, চ্যাট স্পেসে, টাইপ /closeIncident । একটি ঘটনা পরিচালনার ডায়ালগ খোলে।

  8. ঘনিষ্ঠ ঘটনায় , Test complete মতো ঘটনার রেজোলিউশনের জন্য একটি বিবরণ লিখুন।

  9. ঘটনা বন্ধ ক্লিক করুন।

ঘটনা পরিচালন অ্যাপ্লিকেশনটি স্পেসে বার্তাগুলি তালিকাভুক্ত করে, তাদেরকে ভার্টেক্স এআইয়ের সাথে সংক্ষিপ্তসার করে, একটি গুগল ডক্স নথিতে সংক্ষিপ্তসারটি আটকায় এবং স্পেসে নথিটি ভাগ করে দেয়।

পরিষ্কার করুন

এই টিউটোরিয়ালে ব্যবহৃত সংস্থানগুলির জন্য আপনার গুগল ক্লাউড অ্যাকাউন্টে ব্যয় করা চার্জ এড়াতে, আমরা আপনাকে ক্লাউড প্রকল্পটি মুছতে সুপারিশ করি।

  1. Google ক্লাউড কনসোলে, সম্পদ পরিচালনা পৃষ্ঠাতে যান। মেনু > আইএম এবং অ্যাডমিন > সংস্থানগুলি পরিচালনা করুন ক্লিক করুন।

    রিসোর্স ম্যানেজারে যান

  2. প্রকল্পের তালিকায়, আপনি যে প্রকল্পটি মুছতে চান তা নির্বাচন করুন এবং তারপরে মুছুন ক্লিক করুন।
  3. সংলাপে, প্রজেক্ট আইডি টাইপ করুন এবং তারপরে প্রকল্পটি মুছতে শাট ডাউন ক্লিক করুন।
,

এই টিউটোরিয়ালটি অনুমোদনের স্কোপগুলি ব্যবহার করে যা https://www.googleapis.com/auth/chat.app.* দিয়ে শুরু হয়, যা কোনও বিকাশকারী পূর্বরূপের অংশ হিসাবে উপলব্ধ, আপনার চ্যাট অ্যাপ অবশ্যই এক সময়ের প্রশাসকের অনুমোদন পেতে হবে।

এই টিউটোরিয়ালটি দেখায় যে কীভাবে একটি গুগল চ্যাট অ্যাপ্লিকেশন তৈরি করা যায় যা রিয়েল টাইমে ঘটনার প্রতিক্রিয়া জানায়। কোনও ঘটনার প্রতিক্রিয়া জানালে, অ্যাপটি একটি চ্যাট স্পেস তৈরি করে এবং পপুলেট করে, বার্তা, স্ল্যাশ কমান্ড এবং ডায়ালগগুলি সহ ঘটনার সমাধানের সুবিধার্থে এবং গুগল ডক্স নথিতে ঘটনার প্রতিক্রিয়া সংক্ষিপ্ত করতে এআই ব্যবহার করে।

একটি ঘটনা হ'ল এমন একটি ইভেন্ট যা সমাধান করার জন্য একটি দলের তাত্ক্ষণিক মনোযোগ প্রয়োজন। ঘটনার উদাহরণগুলির মধ্যে রয়েছে:

  • গ্রাহক সম্পর্ক ব্যবস্থাপনা (সিআরএম) প্ল্যাটফর্মে একটি সময় সংবেদনশীল কেস তৈরি করা হয়, একটি পরিষেবা দলকে একটি রেজোলিউশনে সহযোগিতা করার প্রয়োজন হয়।
  • একটি সিস্টেম অফলাইনে যায়, সাইটের নির্ভরযোগ্যতা ইঞ্জিনিয়ারদের (এসআরইএস) একটি গ্রুপকে সতর্ক করে যাতে তারা এটিকে অনলাইনে ফিরিয়ে আনতে একসাথে কাজ করতে পারে।
  • একটি উচ্চ মাত্রার ভূমিকম্প ঘটে এবং জরুরী কর্মীদের তাদের প্রতিক্রিয়া সমন্বয় করতে হবে।

এই টিউটোরিয়ালটির উদ্দেশ্যে, ঘটনার সতর্কতা শুরু হয় যখন কেউ কোনও ওয়েব পৃষ্ঠা থেকে একটি বোতামের সাথে ঘটনার প্রতিবেদন করে। ওয়েব পৃষ্ঠাটি ব্যবহারকারীদের প্রাথমিক ঘটনার তথ্য: শিরোনাম, বিবরণ এবং প্রতিক্রিয়াশীলদের ইমেল ঠিকানা প্রবেশ করতে বলে একটি ঘটনার অনুকরণ করে।

অ্যাকশনে ঘটনা পরিচালনার চ্যাট অ্যাপটি দেখুন:

  • যে ওয়েবসাইটটি একটি ঘটনা শুরু করে।
    চিত্র 1। ওয়েবসাইট যেখানে কেউ কোনও ঘটনার প্রতিবেদন করতে পারে।
  • বিজ্ঞপ্তি যে ঘটনা চ্যাট স্পেস তৈরি করা হয়েছে।
    চিত্র 2। বিজ্ঞপ্তি যে ঘটনা চ্যাট স্পেস তৈরি করা হয়েছে।
  • ঘটনার প্রতিক্রিয়া চ্যাট স্পেস।
    চিত্র 3। ঘটনার প্রতিক্রিয়া চ্যাট স্পেস।
  • একটি স্ল্যাশ কমান্ড দিয়ে ঘটনাটি সমাধান করা।
    চিত্র 4। স্ল্যাশ কমান্ড দিয়ে ঘটনাটি সমাধান করা।
  • ঘটনা রেজোলিউশন ডায়ালগ।
    চিত্র 5। ঘটনা রেজোলিউশন ডায়ালগ।
  • ঘটনা রেজোলিউশন গুগল ডক্স ডকুমেন্ট স্পেসে ভাগ করা।
    চিত্র 6। ঘটনার রেজোলিউশন গুগল ডক্স ডকুমেন্ট স্পেসে ভাগ করা হয়েছে।
  • এআই সংক্ষিপ্ত ঘটনার রেজোলিউশন গুগল ডক।
    চিত্র 7। এআই সংক্ষিপ্ত ঘটনার রেজোলিউশন গুগল ডক্স ডকুমেন্ট।

পূর্বশর্ত

আপনার যদি আপনার সংস্থার জন্য এই পূর্বশর্তগুলির কোনওটির প্রয়োজন হয় তবে আপনার গুগল ওয়ার্কস্পেস প্রশাসককে সেগুলি চালু করতে বলুন:

  • গুগল চ্যাট অ্যাক্সেস সহ একটি ব্যবসায় বা এন্টারপ্রাইজ গুগল ওয়ার্কস্পেস অ্যাকাউন্ট।
  • গুগল ওয়ার্কস্পেসের জন্য ডিরেক্টরি (যোগাযোগ ভাগ করে নেওয়া) চালু করা। ঘটনা অ্যাপ্লিকেশনটি নাম এবং ইমেল ঠিকানার মতো ঘটনার প্রতিক্রিয়াকারীদের যোগাযোগের তথ্য সন্ধান করতে ডিরেক্টরিটি ব্যবহার করে। ঘটনা প্রতিক্রিয়াকারীদের অবশ্যই আপনার গুগল ওয়ার্কস্পেস সংস্থায় গুগল চ্যাট অ্যাকাউন্ট সহ ব্যবহারকারী হতে হবে।

উদ্দেশ্য

  • ঘটনাগুলিতে সাড়া দেয় এমন একটি চ্যাট অ্যাপ্লিকেশন তৈরি করুন।
  • ব্যবহারকারীদের নিম্নলিখিতগুলি করে ঘটনার প্রতিক্রিয়া জানাতে সহায়তা করুন:
    • ঘটনার প্রতিক্রিয়া স্পেস তৈরি করা।
    • ঘটনা এবং প্রতিক্রিয়াগুলির সংক্ষিপ্তসার বার্তা পোস্ট করা।
    • ইন্টারেক্টিভ চ্যাট অ্যাপ্লিকেশন বৈশিষ্ট্যগুলির সাথে সহযোগিতা সমর্থন করে।
  • ভার্টেক্স এআই এর সাথে কথোপকথন এবং রেজোলিউশনগুলির সংক্ষিপ্তসার করুন।

স্থাপত্য

নিম্নলিখিত চিত্রটি ঘটনার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ্লিকেশন দ্বারা ব্যবহৃত গুগল ওয়ার্কস্পেস এবং গুগল ক্লাউড রিসোর্সগুলির আর্কিটেকচার দেখায়।

ঘটনার আর্কিটেকচার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ্লিকেশন

আর্কিটেকচারটি দেখায় যে ঘটনার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ্লিকেশনটি কোনও ঘটনা এবং রেজোলিউশন প্রক্রিয়া করে।

  1. একজন ব্যবহারকারী অ্যাপস স্ক্রিপ্টে হোস্ট করা একটি বাহ্যিক ওয়েবসাইট থেকে একটি ঘটনা শুরু করে।

  2. ওয়েবসাইটটি গুগল চ্যাট অ্যাপ্লিকেশনটিতে একটি অ্যাসিঙ্ক্রোনাস এইচটিটিপি অনুরোধ প্রেরণ করে, অ্যাপস স্ক্রিপ্টেও হোস্ট করা হয়েছে।

  3. ঘটনার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ্লিকেশন অনুরোধটি প্রক্রিয়া করে:

    1. অ্যাপস স্ক্রিপ্ট অ্যাডমিন এসডিকে পরিষেবা ব্যবহারকারী আইডি এবং ইমেল ঠিকানাগুলির মতো দলের সদস্যদের তথ্য পায়।

    2. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবাটি ব্যবহার করে চ্যাট এপিআইয়ের জন্য এইচটিটিপি অনুরোধের একটি সেট সহ, ঘটনার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ্লিকেশনটি একটি ঘটনার চ্যাট স্পেস তৈরি করে, এটি দলের সদস্যদের সাথে পপুলেট করে এবং স্থানটিতে একটি বার্তা প্রেরণ করে।

  4. দলের সদস্যরা চ্যাট স্পেসে ঘটনাটি নিয়ে আলোচনা করেন।

  5. একটি দলের সদস্য এই ঘটনার সমাধানের ইঙ্গিত দেওয়ার জন্য একটি স্ল্যাশ কমান্ডের আহ্বান জানিয়েছেন।

    1. অ্যাপস স্ক্রিপ্ট অ্যাডভান্সড চ্যাট পরিষেবা ব্যবহার করে চ্যাট এপিআইতে একটি এইচটিটিপি কল সমস্ত চ্যাট স্পেসের বার্তাগুলি তালিকাভুক্ত করে।

    2. ভার্টেক্স এআই তালিকাভুক্ত বার্তাগুলি গ্রহণ করে এবং একটি সংক্ষিপ্তসার উত্পন্ন করে।

    3. অ্যাপস স্ক্রিপ্ট DocumentApp পরিষেবা একটি ডক্স ডকুমেন্ট তৈরি করে এবং ডকুমেন্টে ভার্টেক্স এআইয়ের সংক্ষিপ্তসার যুক্ত করে।

    4. ঘটনার প্রতিক্রিয়া গুগল চ্যাট অ্যাপ চ্যাট এপিআইকে সংক্ষিপ্ত ডকস ডকুমেন্টে একটি লিঙ্ক ভাগ করে একটি বার্তা পাঠাতে চ্যাট এপিআইকে কল করে।

পরিবেশ প্রস্তুত

এই বিভাগটি চ্যাট অ্যাপ্লিকেশনটির জন্য কীভাবে একটি গুগল ক্লাউড প্রকল্প তৈরি এবং কনফিগার করতে হয় তা দেখায়।

একটি Google ক্লাউড প্রকল্প তৈরি করুন

গুগল ক্লাউড কনসোল

  1. গুগল ক্লাউড কনসোলে, মেনু যান > আইএম এবং অ্যাডমিন > একটি প্রকল্প তৈরি করুন

    একটি প্রকল্প তৈরি করতে যান

  2. প্রকল্পের নাম ক্ষেত্রে, আপনার প্রকল্পের জন্য একটি বর্ণনামূলক নাম লিখুন।

    Ption চ্ছিক: প্রকল্প আইডি সম্পাদনা করতে, সম্পাদনা ক্লিক করুন। প্রকল্পটি তৈরি হওয়ার পরে প্রকল্পের আইডি পরিবর্তন করা যায় না, সুতরাং এমন একটি আইডি চয়ন করুন যা প্রকল্পের আজীবন আপনার প্রয়োজনগুলি পূরণ করে।

  3. অবস্থান ক্ষেত্রে, আপনার প্রকল্পের সম্ভাব্য অবস্থানগুলি প্রদর্শন করতে ব্রাউজ ক্লিক করুন। তারপরে, নির্বাচন ক্লিক করুন।
  4. তৈরি করুন ক্লিক করুন। গুগল ক্লাউড কনসোল ড্যাশবোর্ড পৃষ্ঠায় নেভিগেট করে এবং আপনার প্রকল্পটি কয়েক মিনিটের মধ্যে তৈরি করা হয়।

জিক্লাউড সিএলআই

নিম্নলিখিত বিকাশের পরিবেশগুলির মধ্যে একটিতে গুগল ক্লাউড সিএলআই ( gcloud ) অ্যাক্সেস করুন:

  • ক্লাউড শেল : ইতিমধ্যে সেট আপ করা জিসিএলড সিএলআই সহ একটি অনলাইন টার্মিনাল ব্যবহার করতে, ক্লাউড শেলটি সক্রিয় করুন।
    ক্লাউড শেল সক্রিয় করুন
  • স্থানীয় শেল : স্থানীয় বিকাশের পরিবেশ ব্যবহার করতে, জিসিএলড সিএলআই ইনস্টল এবং সূচনা করুন
    একটি ক্লাউড প্রকল্প তৈরি করতে, gcloud projects create :
    gcloud projects create PROJECT_ID
    আপনি যে প্রকল্পটি তৈরি করতে চান তার জন্য আইডি সেট করে PROJECT_ID প্রতিস্থাপন করুন।

ক্লাউড প্রকল্পের জন্য বিলিং সক্ষম করুন

গুগল ক্লাউড কনসোল

  1. গুগল ক্লাউড কনসোলে, বিলিংয়ে যান। মেনু > বিলিং > আমার প্রকল্পগুলি ক্লিক করুন।

    আমার প্রকল্পগুলির জন্য বিলিংয়ে যান

  2. একটি সংস্থায় নির্বাচন করুন , আপনার গুগল ক্লাউড প্রকল্পের সাথে সম্পর্কিত সংস্থাটি চয়ন করুন।
  3. প্রকল্পের সারিতে, অ্যাকশন মেনু ( ) খুলুন, বিলিং পরিবর্তন ক্লিক করুন এবং ক্লাউড বিলিং অ্যাকাউন্টটি চয়ন করুন।
  4. সেট অ্যাকাউন্ট ক্লিক করুন।

জিক্লাউড সিএলআই

  1. উপলব্ধ বিলিং অ্যাকাউন্টগুলি তালিকাভুক্ত করতে, চালান:
    gcloud billing accounts list
  2. গুগল ক্লাউড প্রকল্পের সাথে একটি বিলিং অ্যাকাউন্ট লিঙ্ক করুন:
    gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID

    নিম্নলিখিতগুলি প্রতিস্থাপন করুন:

    • PROJECT_ID হ'ল ক্লাউড প্রকল্পের জন্য প্রকল্প আইডি যার জন্য আপনি বিলিং সক্ষম করতে চান।
    • গুগল ক্লাউড প্রকল্পের সাথে লিঙ্ক করার জন্য BILLING_ACCOUNT_ID বিলিং অ্যাকাউন্ট আইডি

APIs সক্রিয় করুন

গুগল ক্লাউড কনসোল

  1. গুগল ক্লাউড কনসোলে গুগল চ্যাট এপিআই, গুগল ডক্স এপিআই, অ্যাডমিন এসডিকে এপিআই, গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে এবং ভার্টেক্স এআই এপিআই সক্ষম করুন।

    APIs সক্রিয় করুন

  2. নিশ্চিত করুন যে আপনি সঠিক ক্লাউড প্রকল্পে এপিআই সক্ষম করছেন, তারপরে পরবর্তী ক্লিক করুন।

  3. আপনি সঠিক এপিআই সক্ষম করছেন তা নিশ্চিত করুন, তারপরে সক্ষম ক্লিক করুন।

জিক্লাউড সিএলআই

  1. যদি প্রয়োজন হয় তবে বর্তমান ক্লাউড প্রকল্পটি আপনি gcloud config set project কমান্ডের সাথে তৈরি করেছেন এমন একটিতে সেট করুন:

    gcloud config set project PROJECT_ID

    আপনার তৈরি ক্লাউড প্রকল্পের প্রকল্প আইডি দিয়ে PROJECT_ID প্রতিস্থাপন করুন।

  2. গুগল চ্যাট এপিআই, গুগল ডকস এপিআই, অ্যাডমিন এসডিকে এপিআই, গুগল ওয়ার্কস্পেস মার্কেটপ্লেস এসডিকে এবং gcloud services enable :

    gcloud services enable chat.googleapis.com docs.googleapis.com admin.googleapis.com aiplatform.googleapis.com appsmarket-component.googleapis.com

প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

চ্যাট অ্যাপ্লিকেশনটি চ্যাট অ্যাপের শংসাপত্রগুলি ব্যবহার করে গুগল চ্যাট এপিআই অ্যাক্সেস করে। অ্যাপটি ব্যবহারকারীর শংসাপত্রগুলির সাথে অ্যাডমিন এসডিকে এপিআই এবং গুগল ডক্স এপিআই অ্যাক্সেস করে।

ব্যবহারকারীর প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

প্রমাণীকরণ এবং অনুমোদন গুগল ওয়ার্কস্পেস এবং গুগল ক্লাউডে চ্যাট অ্যাপ্লিকেশন অ্যাক্সেস সংস্থানগুলিকে কোনও ঘটনার প্রতিক্রিয়া প্রক্রিয়া করতে দেয়। বিশেষত, ব্যবহারকারী প্রমাণীকরণ গুগল ডক্স এপিআই এবং অ্যাডমিন এসডিকে এপিআই কল করতে ব্যবহৃত হয়।

এই টিউটোরিয়ালে, আপনি আপনার ওয়ার্কস্পেস ডোমেনে অভ্যন্তরীণভাবে অ্যাপ্লিকেশনটি প্রকাশ করেন, সুতরাং স্থানধারীর তথ্য ব্যবহার করা গ্রহণযোগ্য। বাহ্যিকভাবে অ্যাপ্লিকেশনটি প্রকাশের আগে, সম্মতি স্ক্রিনে প্রকৃত তথ্য সহ স্থানধারক তথ্য প্রতিস্থাপন করুন।

  1. গুগল ক্লাউড কনসোলে, মেনু যান > > ব্র্যান্ডিং

    ব্র্যান্ডিংয়ে যান

  2. আপনি যদি ইতিমধ্যে কনফিগার করেছেন, আপনি ব্র্যান্ডিং , শ্রোতা এবং ডেটা অ্যাক্সেসে নিম্নলিখিত ওএথ সম্মতি স্ক্রিন সেটিংস কনফিগার করতে পারেন। আপনি যদি এমন একটি বার্তা দেখতে পান যা বলে এখনও কনফিগার করা হয়নি , শুরু করুন ক্লিক করুন:

    1. অ্যাপের তথ্যের অধীনে, অ্যাপের নামে , Incident Management টাইপ করুন।
    2. ব্যবহারকারী সমর্থন ইমেইলে , আপনার ইমেল ঠিকানা বা একটি উপযুক্ত গুগল গ্রুপ নির্বাচন করুন।
    3. পরবর্তী ক্লিক করুন.
    4. দর্শকদের অধীনে, অভ্যন্তরীণ নির্বাচন করুন। আপনি যদি অভ্যন্তরীণ নির্বাচন করতে না পারেন তবে বাহ্যিক নির্বাচন করুন।
    5. পরবর্তী ক্লিক করুন.
    6. যোগাযোগের তথ্যের অধীনে, একটি ইমেল ঠিকানা লিখুন যেখানে আপনাকে আপনার প্রকল্পের যে কোনও পরিবর্তন সম্পর্কে অবহিত করা যেতে পারে।
    7. পরবর্তী ক্লিক করুন.
    8. সমাপ্তির অধীনে, গুগল এপিআই পরিষেবাদি ব্যবহারকারী ডেটা নীতি পর্যালোচনা করুন এবং আপনি যদি সম্মত হন তবে নির্বাচন করুন আমি গুগল এপিআই পরিষেবাগুলিতে সম্মত: ব্যবহারকারী ডেটা নীতি
    9. অবিরত ক্লিক করুন.
    10. তৈরি করুন ক্লিক করুন।
    11. আপনি যদি ব্যবহারকারীর ধরণের জন্য বাহ্যিক নির্বাচন করেন তবে পরীক্ষা ব্যবহারকারীদের যুক্ত করুন:
      1. শ্রোতাদের ক্লিক করুন।
      2. পরীক্ষা ব্যবহারকারীদের অধীনে, ব্যবহারকারীদের যুক্ত করুন ক্লিক করুন।
      3. আপনার ইমেল ঠিকানা এবং অন্য কোনও অনুমোদিত পরীক্ষার ব্যবহারকারীদের প্রবেশ করান, তারপরে সংরক্ষণ করুন ক্লিক করুন।
  3. ডেটা অ্যাক্সেস > স্কোপগুলি যুক্ত করুন বা সরান ক্লিক করুন। আপনি আপনার গুগল ক্লাউড প্রকল্পে সক্ষম করেছেন এমন প্রতিটি এপিআইয়ের জন্য স্কোপগুলির একটি তালিকা সহ একটি প্যানেল উপস্থিত রয়েছে।

    1. ম্যানুয়ালি স্কোপগুলি যুক্ত করুন , নিম্নলিখিত স্কোপগুলি পেস্ট করুন:

      • https://www.googleapis.com/auth/documents
      • https://www.googleapis.com/auth/admin.directory.user.readonly
      • https://www.googleapis.com/auth/script.external_request
      • https://www.googleapis.com/auth/userinfo.email
      • https://www.googleapis.com/auth/cloud-platform
    2. টেবিলে যোগ করুন ক্লিক করুন।

    3. আপডেট ক্লিক করুন.

    4. ডেটা অ্যাক্সেস পৃষ্ঠায় আপনার অ্যাপ্লিকেশন দ্বারা প্রয়োজনীয় স্কোপগুলি নির্বাচন করার পরে, সংরক্ষণ করুন ক্লিক করুন।

অ্যাপ্লিকেশন প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

অ্যাপ্লিকেশন প্রমাণীকরণ গুগল চ্যাট এপিআই কল করতে ব্যবহৃত হয়।

গুগল ক্লাউড কনসোলে একটি পরিষেবা অ্যাকাউন্ট তৈরি করুন

একটি পরিষেবা অ্যাকাউন্ট তৈরি করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

গুগল ক্লাউড কনসোল

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. পরিষেবা অ্যাকাউন্ট তৈরি করুন ক্লিক করুন।
  3. পরিষেবা অ্যাকাউন্টের বিশদগুলি পূরণ করুন, তারপরে তৈরি করুন ক্লিক করুন এবং চালিয়ে যান
  4. Ption চ্ছিক: আপনার গুগল ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা অর্পণ করুন। আরও তথ্যের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর, পরিবর্তন এবং প্রত্যাহারকে দেখুন।
  5. অবিরত ক্লিক করুন.
  6. Ption চ্ছিক: ব্যবহারকারী বা গোষ্ঠীগুলি লিখুন যা এই পরিষেবা অ্যাকাউন্টের সাথে ক্রিয়া পরিচালনা করতে এবং সম্পাদন করতে পারে। আরও তথ্যের জন্য, পরিষেবা অ্যাকাউন্টের ছদ্মবেশ পরিচালনা করতে দেখুন।
  7. সম্পন্ন ক্লিক করুন. পরিষেবা অ্যাকাউন্টের জন্য ইমেল ঠিকানার একটি নোট তৈরি করুন।

জিক্লাউড সিএলআই

  1. পরিষেবা অ্যাকাউন্ট তৈরি করুন:
    gcloud iam service-accounts create SERVICE_ACCOUNT_NAME \
      --display-name="SERVICE_ACCOUNT_NAME"
  2. Ption চ্ছিক: আপনার গুগল ক্লাউড প্রকল্পের সংস্থানগুলিতে অ্যাক্সেস দেওয়ার জন্য আপনার পরিষেবা অ্যাকাউন্টে ভূমিকা অর্পণ করুন। আরও তথ্যের জন্য, সংস্থানগুলিতে অ্যাক্সেস মঞ্জুর, পরিবর্তন এবং প্রত্যাহারকে দেখুন।

পরিষেবা অ্যাকাউন্ট পৃষ্ঠায় প্রদর্শিত হবে। এরপরে, পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি করুন।

একটি ব্যক্তিগত কী তৈরি করুন

পরিষেবা অ্যাকাউন্টের জন্য একটি ব্যক্তিগত কী তৈরি এবং ডাউনলোড করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. আপনার পরিষেবা অ্যাকাউন্ট নির্বাচন করুন।
  3. কীগুলি ক্লিক করুন > কী যুক্ত করুন > নতুন কী তৈরি করুন
  4. JSON নির্বাচন করুন, তারপরে তৈরি ক্লিক করুন।

    আপনার নতুন পাবলিক/প্রাইভেট কী জুটি একটি নতুন ফাইল হিসাবে আপনার মেশিনে উত্পন্ন এবং ডাউনলোড করা হয়েছে। আপনার ওয়ার্কিং ডিরেক্টরিতে ডাউনলোড করা জেএসএন ফাইলটি credentials.json হিসাবে সংরক্ষণ করুন। এই ফাইলটি এই কীটির একমাত্র অনুলিপি। কীভাবে আপনার কীটি নিরাপদে সঞ্চয় করবেন সে সম্পর্কে তথ্যের জন্য, পরিষেবা অ্যাকাউন্ট কীগুলি পরিচালনা করুন।

  5. বন্ধ ক্লিক করুন.

পরিষেবা অ্যাকাউন্ট সম্পর্কে আরও তথ্যের জন্য, গুগল ক্লাউড আইএএম ডকুমেন্টেশনে পরিষেবা অ্যাকাউন্টগুলি দেখুন।

একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করুন

একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করতে, এই পদক্ষেপগুলি অনুসরণ করুন:

  1. গুগল ক্লাউড কনসোলে, মেনু > আইএএম এবং অ্যাডমিন > পরিষেবা অ্যাকাউন্টে যান।

    পরিষেবা অ্যাকাউন্টে যান

  2. আপনার চ্যাট অ্যাপের জন্য আপনি তৈরি পরিষেবা অ্যাকাউন্টটি ক্লিক করুন।

  3. Advanced settings এ ক্লিক করুন।

  4. গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ ওআউথ ক্লায়েন্ট তৈরি করুন ক্লিক করুন।

  5. অবিরত ক্লিক করুন.

একটি নিশ্চিতকরণ বার্তা উপস্থিত হয় যা বলে যে একটি গুগল ওয়ার্কস্পেস মার্কেটপ্লেস-সামঞ্জস্যপূর্ণ OAuth ক্লায়েন্ট তৈরি করা হয়েছে।

চ্যাট অ্যাপ্লিকেশন তৈরি এবং স্থাপন করুন

নিম্নলিখিত বিভাগে, আপনি একটি সম্পূর্ণ অ্যাপ্লিকেশন স্ক্রিপ্ট প্রকল্পটি অনুলিপি এবং আপডেট করেছেন যাতে আপনার চ্যাট অ্যাপের জন্য প্রয়োজনীয় সমস্ত অ্যাপ্লিকেশন কোড রয়েছে, সুতরাং প্রতিটি ফাইল অনুলিপি এবং পেস্ট করার দরকার নেই।

কিছু ফাংশনগুলির মধ্যে তাদের নামগুলির শেষে আন্ডারস্কোর অন্তর্ভুক্ত রয়েছে, যেমন ChatApp.gs থেকে processSlashCommand_() । ব্রাউজারে খোলা থাকাকালীন আন্ডারস্কোর ঘটনার সূচনা ওয়েব পৃষ্ঠা থেকে ফাংশনটি লুকিয়ে রাখে। আরও তথ্যের জন্য, ব্যক্তিগত ফাংশনগুলি দেখুন।

অ্যাপ্লিকেশন স্ক্রিপ্ট দুটি ফাইল প্রকার, .gs স্ক্রিপ্ট এবং .html ফাইল সমর্থন করে। এই সমর্থনটি মেনে চলার জন্য, অ্যাপের ক্লায়েন্ট-সাইড জাভাস্ক্রিপ্টটি <script /> ট্যাগগুলির ভিতরে অন্তর্ভুক্ত করা হয়েছে এবং এর সিএসএস এইচটিএমএল ফাইলের অভ্যন্তরে <style /> ট্যাগগুলির মধ্যে অন্তর্ভুক্ত রয়েছে।

Ally চ্ছিকভাবে, আপনি গিটহাবের পুরো প্রকল্পটি দেখতে পারেন।

GitHub এ দেখুন

প্রতিটি ফাইলের একটি ওভারভিউ এখানে:

Consts.gs

আপনার ক্লাউড প্রজেক্ট আইডি, ভার্টেক্স এআই লোকেশন আইডি, পরিষেবা অ্যাকাউন্টের জন্য অ্যাপ্লিকেশন শংসাপত্র এবং কোনও ঘটনা বন্ধ করার জন্য স্ল্যাশ কমান্ড আইডি সহ অন্যান্য কোড ফাইলগুলি দ্বারা রেফারেন্সযুক্ত ধ্রুবকগুলি সংজ্ঞায়িত করে।

Consts.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/কনস্টস.জি.এস.
const PROJECT_ID = 'replace-with-your-project-id';
const CLOSE_INCIDENT_COMMAND_ID = 1;
const APP_CREDENTIALS = 'replace-with-your-app-credentials';
const APP_CREDENTIALS_SCOPES = 'https://www.googleapis.com/auth/chat.bot https://www.googleapis.com/auth/chat.app.memberships https://www.googleapis.com/auth/chat.app.spaces.create';
const VERTEX_AI_LOCATION_ID = 'us-central1';
const MODEL_ID = 'gemini-1.5-flash-002';
ChatApp.gs

বার্তা, কার্ড ক্লিক, স্ল্যাশ কমান্ড এবং ডায়ালগ সহ চ্যাট ইন্টারঅ্যাকশন ইভেন্টগুলি পরিচালনা করে। ঘটনার রেজোলিউশনের বিশদ সংগ্রহ করতে একটি ডায়ালগ খোলার মাধ্যমে /closeIncident স্ল্যাশ কমান্ডের প্রতিক্রিয়া। spaces.messages.list কল করে স্পেসে বার্তাগুলি পড়ুন Ch চ্যাট এপিআই -তে লিস্ট পদ্ধতি। অ্যাপস স্ক্রিপ্টে অ্যাডমিন এসডিকে ডিরেক্টরি পরিষেবা ব্যবহার করে ব্যবহারকারী আইডি পান।

ChatApp.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/চ্যাট অ্যাপ.জি.এস
/**
 * Responds to a MESSAGE event in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident").
 * It will respond to any other message with a simple "Hello" text message.
 *
 * @param {Object} event the event object from Google Chat
 */
function onMessage(event) {
  if (event.message.slashCommand) {
    return processSlashCommand_(event);
  }
  return { "text": "Hello from Incident Response app!" };
}

/**
 * Responds to a CARD_CLICKED event in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 *
 * @param {Object} event the event object from Google Chat
 */
function onCardClick(event) {
  if (event.isDialogEvent) {
    if (event.dialogEventType == 'SUBMIT_DIALOG') {
      return processSubmitDialog_(event);
    }
    return {
      actionResponse: {
        type: "DIALOG",
        dialogAction: {
          actionStatus: "OK"
        }
      }
    };
  }
}

/**
 * Responds to a MESSAGE event with a Slash command in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident")
 * by returning a Dialog.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSlashCommand_(event) {
  if (event.message.slashCommand.commandId != CLOSE_INCIDENT_COMMAND_ID) {
    return {
      "text": "Command not recognized. Use the command `/closeIncident` to close the incident managed by this space."
    };
  }
  const sections = [
    {
      header: "Close Incident",
      widgets: [
        {
          textInput: {
            label: "Please describe the incident resolution",
            type: "MULTIPLE_LINE",
            name: "description"
          }
        },
        {
          buttonList: {
            buttons: [
              {
                text: "Close Incident",
                onClick: {
                  action: {
                    function: "closeIncident"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  ];
  return {
    actionResponse: {
      type: "DIALOG",
      dialogAction: {
        dialog: {
          body: {
            sections,
          }
        }
      }
    }
  };
}

/**
 * Responds to a CARD_CLICKED event with a Dialog submission in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 * It creates a Doc with a summary of the incident information and posts a message
 * to the space with a link to the Doc.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSubmitDialog_(event) {
  const resolution = event.common.formInputs.description[""].stringInputs.value[0];
  const chatHistory = concatenateAllSpaceMessages_(event.space.name);
  const chatSummary = summarizeChatHistory_(chatHistory);
  const docUrl = createDoc_(event.space.displayName, resolution, chatHistory, chatSummary);
  return {
    actionResponse: {
      type: "NEW_MESSAGE",
    },
    text: `Incident closed with the following resolution: ${resolution}\n\nHere is the automatically generated post-mortem:\n${docUrl}`
  };
}

/**
 * Lists all the messages in the Chat space, then concatenate all of them into
 * a single text containing the full Chat history.
 *
 * For simplicity for this demo, it only fetches the first 100 messages.
 *
 * Messages with slash commands are filtered out, so the returned history will
 * contain only the conversations between users and not app command invocations.
 *
 * @return {string} a text containing all the messages in the space in the format:
 *          Sender's name: Message
 */
function concatenateAllSpaceMessages_(spaceName) {
  // Call Chat API method spaces.messages.list
  const response = Chat.Spaces.Messages.list(spaceName, { 'pageSize': 100 });
  const messages = response.messages;
  // Fetch the display names of the message senders and returns a text
  // concatenating all the messages.
  let userMap = new Map();
  return messages
    .filter(message => message.slashCommand === undefined)
    .map(message => `${getUserDisplayName_(userMap, message.sender.name)}: ${message.text}`)
    .join('\n');
}

/**
 * Obtains the display name of a user by using the Admin Directory API.
 *
 * The fetched display name is cached in the provided map, so we only call the API
 * once per user.
 *
 * If the user does not have a display name, then the full name is used.
 *
 * @param {Map} userMap a map containing the display names previously fetched
 * @param {string} userName the resource name of the user
 * @return {string} the user's display name
 */
function getUserDisplayName_(userMap, userName) {
  if (userMap.has(userName)) {
    return userMap.get(userName);
  }
  let displayName = 'Unknown User';
  try {
    const user = AdminDirectory.Users.get(
      userName.replace("users/", ""),
      { projection: 'BASIC', viewType: 'domain_public' });
    displayName = user.name.displayName ? user.name.displayName : user.name.fullName;
  } catch (e) {
    // Ignore error if the API call fails (for example, because it's an
    // out-of-domain user or Chat app)) and just use 'Unknown User'.
  }
  userMap.set(userName, displayName);
  return displayName;
}
ChatSpaceCreator.gs

ফর্ম ডেটা ব্যবহারকারীরা ঘটনার সূচনা ওয়েব পৃষ্ঠায় প্রবেশ করে এবং এটি তৈরি এবং পপুলেট করে একটি চ্যাট স্পেস সেট আপ করতে এটি ব্যবহার করে এবং তারপরে ঘটনা সম্পর্কে একটি বার্তা পোস্ট করে।

ChatSpaceCreator.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/চ্যাটস্পেসেক্রেটর.জি.এস
/**
 * Handles an incident by creating a chat space, adding members, and posting a message.
 * All the actions are done using application credentials.
 *
 * @param {Object} formData - The data submitted by the user. It should contain the fields:
 *                           - title: The display name of the chat space.
 *                           - description: The description of the incident.
 *                           - users: A comma-separated string of user emails to be added to the space.
 * @return {string} The resource name of the new space.
 */
function handleIncident(formData) {
  const users = formData.users.trim().length > 0 ? formData.users.split(',') : [];
  const service = getService_();
  if (!service.hasAccess()) {
    console.error(service.getLastError());
    return;
   }
  const spaceName = createChatSpace_(formData.title, service);
  createHumanMembership_(spaceName, getUserEmail(), service);
  for (const user of users ){
    createHumanMembership_(spaceName, user, service);
  }
  createMessage_(spaceName, formData.description, service);
  return spaceName;
}
/**
 * Creates a chat space with application credentials.
 *
 * @param {string} displayName - The name of the chat space.
 * @param {object} service - The credentials of the service account.
 * @returns {string} The resource name of the new space.
*/
function createChatSpace_(displayName, service) {
  try {
    // For private apps, the alias can be used
    const my_customer_alias = "customers/my_customer";
    // Specify the space to create.
    const space = {
        displayName: displayName,
        spaceType: 'SPACE',                
        customer: my_customer_alias
    };
    // Call Chat API with a service account to create a message.
    const createdSpace = Chat.Spaces.create(
        space,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});
    return createdSpace.name;
  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create space with error %s', err.message);
  }
}
/*
 * Creates a chat message with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} message - The text to be posted.
 * @param {object} service - The credentials of the service account.
 * @return {string} the resource name of the new space.
 */
function createMessage_(spaceName, message, service) {
  try {
    // Call Chat API with a service account to create a message.
    const result = Chat.Spaces.Messages.create(
        {'text': message},
        spaceName,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});

  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create message with error %s', err.message);
  }
}
/**
 * Creates a human membership in a chat space with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} email - The email of the user to be added.
 * @param {object} service - The credentials of the service account.
 */
function createHumanMembership_(spaceName, email, service){
  try{
    const membership = {
      member: {
        name: 'users/'+email,
        // User type for the membership
        type: 'HUMAN'
      }
    };
    const result = Chat.Spaces.Members.create(
      membership,
      spaceName,
      {},
      {'Authorization': 'Bearer ' + service.getAccessToken()}
    );
  } catch (err){
    console.log('Failed to create membership with error %s', err.message)
  }

}

 /*
 * Creates a service for the service account.
 * @return {object}  - The credentials of the service account.
 */
function getService_() {
  return OAuth2.createService(APP_CREDENTIALS.client_email)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(APP_CREDENTIALS.private_key)
      .setIssuer(APP_CREDENTIALS.client_email)
      .setSubject(APP_CREDENTIALS.client_email)
      .setScope(APP_CREDENTIALS_SCOPES)
      .setPropertyStore(PropertiesService.getScriptProperties());
}
DocsApi.gs

গুগল ডক্স এপিআইকে কোনও ব্যবহারকারীর গুগল ড্রাইভে একটি গুগল ডক্স ডকুমেন্ট তৈরি করতে কল করে এবং ডকুমেন্টে VertexAiApi.gs তৈরি ঘটনার তথ্যের সংক্ষিপ্তসার লিখেছেন।

DocsApi.gs কোড দেখুন

অ্যাপস-স্ক্রিপ্ট/ঘটনা-প্রতিক্রিয়া-অ্যাপ-এথ/ডকসাপি.জি.এস
/**
 * Creates a Doc in the user's Google Drive and writes a summary of the incident information to it.
 *
 * @param {string} title The title of the incident
 * @param {string} resolution Incident resolution described by the user
 * @param {string} chatHistory The whole Chat history be included in the document
 * @param {string} chatSummary A summary of the Chat conversation to be included in the document
 * @return {string} the URL of the created Doc
 */
function createDoc_(title, resolution, chatHistory, chatSummary) {
  let doc = DocumentApp.create(title);
  let body = doc.getBody();
  body.appendParagraph(`Post-Mortem: ${title}`).setHeading(DocumentApp.ParagraphHeading.TITLE);
  body.appendParagraph("Resolution").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(resolution);
  body.appendParagraph("Summary of the conversation").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatSummary);
  body.appendParagraph("Full Chat history").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatHistory);
  return doc.getUrl();
}
VertexAiApi.gs

ভার্টেক্স এআই এপিআই ব্যবহার করে চ্যাট স্পেসে কথোপকথনের সংক্ষিপ্তসার করে। এই সংক্ষিপ্তসারটি DocsAPI.gs একটি বিশেষভাবে তৈরি ডকুমেন্টে পোস্ট করা হয়েছে।

View VertexAiApi.gs code

apps-script/incident-response-app-auth/VertexAiApi.gs
/**
 * Summarizes a Chat conversation using the Vertex AI text prediction API.
 *
 * @param {string} chatHistory The Chat history that will be summarized.
 * @return {string} The content from the text prediction response.
 */


function summarizeChatHistory_(chatHistory) {

  const API_ENDPOINT = `https://${VERTEX_AI_LOCATION_ID}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${VERTEX_AI_LOCATION_ID}/publishers/google/models/${MODEL_ID}:generateContent`;
  const prompt = "Summarize the following conversation between Engineers resolving an incident"
      + " in a few sentences. Use only the information from the conversation.\n\n" + chatHistory;
  // Get the access token.
  const accessToken = ScriptApp.getOAuthToken();

  const headers = {
    'Authorization': 'Bearer ' + accessToken,
    'Content-Type': 'application/json',
  };
  const payload = {
    'contents': {
      'role': 'user',
      'parts' : [
        {
          'text': prompt
        }
      ]
    }
  }
  const options = {
    'method': 'post',
    'headers': headers,
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true,
  };
  try {
    const response = UrlFetchApp.fetch(API_ENDPOINT, options);
    const responseCode = response.getResponseCode();
    const responseText = response.getContentText();

    if (responseCode === 200) {
      const jsonResponse = JSON.parse(responseText);
      console.log(jsonResponse)
      if (jsonResponse.candidates && jsonResponse.candidates.length > 0) {
        return jsonResponse.candidates[0].content.parts[0].text; // Access the summarized text
      } else {
        return "No summary found in response.";
      }

    } else {
      console.error("Vertex AI API Error:", responseCode, responseText);
      return `Error: ${responseCode} - ${responseText}`;
    }
  } catch (e) {
    console.error("UrlFetchApp Error:", e);
    return "Error: " + e.toString();
  }
}
WebController.gs

Serves the incident initialization website.

View WebController.gs code

apps-script/incident-response-app-auth/WebController.gs
/**
 * Serves the web page from Index.html.
 */
function doGet() {
  return HtmlService
    .createTemplateFromFile('Index')
    .evaluate();
}

/**
 * Serves the web content from the specified filename.
 */
function include(filename) {
  return HtmlService
    .createHtmlOutputFromFile(filename)
    .getContent();
}

/**
 * Returns the email address of the user running the script.
 */
function getUserEmail() {
  return Session.getActiveUser().getEmail();
}
Index.html

The HTML comprising the incident initialization website.

View Index.html code

apps-script/incident-response-app-auth/Index.html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
    <?!= include('Stylesheet'); ?>
  </head>
  <body>
    <div class="container">
      <div class="content">
        <h1>Incident Manager</h1>
        <form id="incident-form" onsubmit="handleFormSubmit(this)">
          <div id="form">
            <p>
              <label for="title">Incident title</label><br/>
              <input type="text" name="title" id="title" />
            </p>
            <p>
              <label for="users">Incident responders</label><br/>
              <small>
                Please enter a comma-separated list of email addresses of the users
                that should be added to the space.
                Do not include <?= getUserEmail() ?> as it will be added automatically.
              </small><br/>
              <input type="text" name="users" id="users" />
            </p>
            <p>
              <label for="description">Initial message</label></br>
              <small>This message will be posted after the space is created.</small><br/>
              <textarea name="description" id="description"></textarea>
            </p>
            <p class="text-center">
              <input type="submit" value="CREATE CHAT SPACE" />
            </p>
          </div>
          <div id="output" class="hidden"></div>
          <div id="clear" class="hidden">
            <input type="reset" value="CREATE ANOTHER INCIDENT" onclick="onReset()" />
          </div>
        </form>
      </div>
    </div>
    <?!= include('JavaScript'); ?>
  </body>
</html>
JavaScript.html

Handles form behavior including submits, errors, and clears, for the incident initialization website. It's included into Index.html by the custom include function in WebController.gs .

View JavaScript.html code

apps-script/incident-response-app-auth/JavaScript.html
<script>
  var formDiv = document.getElementById('form');
  var outputDiv = document.getElementById('output');
  var clearDiv = document.getElementById('clear');

  function handleFormSubmit(formObject) {
    event.preventDefault();
    outputDiv.innerHTML = 'Please wait while we create the space...';
    hide(formDiv);
    show(outputDiv);
    google.script.run
      .withSuccessHandler(updateOutput)
      .withFailureHandler(onFailure)
      .handleIncident(formObject);
  }

  function updateOutput(response) {
    var spaceId = response.replace('spaces/', '');
    outputDiv.innerHTML =
      '<p>Space created!</p><p><a href="https://mail.google.com/chat/#chat/space/'
        + spaceId
        + '" target="_blank">Open space</a></p>';
    show(outputDiv);
    show(clearDiv);
  }

  function onFailure(error) {
    outputDiv.innerHTML = 'ERROR: ' + error.message;
    outputDiv.classList.add('error');
    show(outputDiv);
    show(clearDiv);
  }

  function onReset() {
    outputDiv.innerHTML = '';
    outputDiv.classList.remove('error');
    show(formDiv);
    hide(outputDiv);
    hide(clearDiv);
  }

  function hide(element) {
    element.classList.add('hidden');
  }

  function show(element) {
    element.classList.remove('hidden');
  }
</script>
Stylesheet.html

The CSS for the incident initialization website. It's included into Index.html by the custom include function in WebController.gs .

View Stylesheet.html code

apps-script/incident-response-app-auth/Stylesheet.html
<style>
  * {
    box-sizing: border-box;
  }
  body {
    font-family: Roboto, Arial, Helvetica, sans-serif;
  }
  div.container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
  }
  div.content {
    width: 80%;
    max-width: 1000px;
    padding: 1rem;
    border: 1px solid #999;
    border-radius: 0.25rem;
    box-shadow: 0 2px 2px 0 rgba(66, 66, 66, 0.08), 0 2px 4px 2px rgba(66, 66, 66, 0.16);
  }
  h1 {
    text-align: center;
    padding-bottom: 1rem;
    margin: 0 -1rem 1rem -1rem;
    border-bottom: 1px solid #999;
  }
 #output {
    text-align: center;
    min-height: 250px;
  }
  div#clear {
    text-align: center;
    padding-top: 1rem;
    margin: 1rem -1rem 0 -1rem;
    border-top: 1px solid #999;
  }
  input[type=text], textarea {
    width: 100%;
    padding: 1rem 0.5rem;
    margin: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid #999;
    background-color: #f0f0f0;
  }
  textarea {
    height: 5rem;
  }
  small {
    color: #999;
  }
  input[type=submit], input[type=reset] {
    padding: 1rem;
    border: none;
    background-color: #6200ee;
    color: #fff;
    border-radius: 0.25rem;
    width: 25%;
  }
  .hidden {
    display: none;
  }
  .text-center {
    text-align: center;
  }
  .error {
    color: red;
  }
</style>

Find your Cloud project number and ID

  1. In the Google Cloud console, go to your Cloud project.

    Go to Google Cloud console

  2. Click Settings and Utilities > Project settings .

  3. Note the values in the Project number and Project ID fields. You use them in the following sections.

অ্যাপস স্ক্রিপ্ট প্রকল্প তৈরি করুন

To create an Apps Script project and connect it with your Cloud project:

  1. Click the following button to open the Respond to incidents with Google Chat Apps Script project.
    Open the project
  2. Click Overview .
  3. On the overview page, click একটি অনুলিপি তৈরি করার জন্য আইকন Make a copy .
  4. Name your copy of the Apps Script project:

    1. Click Copy of Respond to incidents with Google Chat .

    2. In Project title , type Incident Management Chat app .

    3. পুনঃনামকরণ ক্লিক করুন।

  5. In your copy of the Apps Script project, go to the Consts.gs file and replace YOUR_PROJECT_ID with the ID of your Cloud project.

Set the Apps Script project's Cloud project

  1. In your Apps Script project, click The icon for project settings প্রকল্প সেটিংস
  2. Google ক্লাউড প্ল্যাটফর্ম (GCP) প্রকল্পের অধীনে, প্রকল্প পরিবর্তন করুন ক্লিক করুন।
  3. In GCP project number , paste the project number of your Cloud project.
  4. Click Set project . The Cloud project and Apps Script project are now connected.

Create an Apps Script deployment

Now that all the code is in place, deploy the Apps Script project. You use the deployment ID when you configure the Chat app in the Google Cloud.

  1. In Apps Script, open the incident response app's project.

    Go to Apps Script

  2. Click Deploy > New deployment .

  3. If Add-on and Web app aren't already selected, next to Select type , click deployment types The icon for project settings and select Add-on and Web app .

  4. In Description , enter a description for this version, like Complete version of incident management app .

  5. In Execute as , select User accessing the web app

  6. In Who has access , select Anyone within your Workspace organization , where "your Workspace organization" is the name of your Google Workspace organization.

  7. ডিপ্লোয় ক্লিক করুন। Apps Script reports successful deployment and provides a deployment ID and a URL for the incident initialization web page.

  8. Make note of the Web app URL to visit later when you start an incident. Copy the Deployment ID . You use this ID while configuring the Chat app in Google Cloud console.

  9. সম্পন্ন ক্লিক করুন.

Configure the Chat app in the Google Cloud console

This section shows how to configure the Google Chat API in the Google Cloud console with information about your Chat app, including the ID of the deployment that you just created from your Apps Script project.

  1. In the Google Cloud console, click Menu > More products > Google Workspace > Product Library > Google Chat API > Manage > Configuration .

    Go to Chat API configuration

  2. In App name , type Incident Management .

  3. In Avatar URL , type https://developers.google.com/chat/images/quickstart-app-avatar.png .

  4. In Description , type Responds to incidents. .

  5. Click the Enable Interactive features toggle to the on position.

  6. Under Functionality , select Receive 1:1 messages , Join spaces and group conversations .

  7. Under Connection settings , select Apps Script .

  8. In Deployment ID , paste the Apps Script Deployment ID that you copied earlier from the Apps Script project deployment.

  9. Register a slash command that the fully implemented Chat app uses:

    1. Under Commands , click Add a command .

    2. In Command ID , type 1 .

    3. In Description , type Closes the incident being discussed in the space.

    4. Under Command type , select Slash command .

    5. In Slash command name , type /closeIncident .

    6. Select Opens a dialog .

    7. সম্পন্ন ক্লিক করুন. The slash command is registered and listed.

  10. Under Visibility , select Make this Chat app available to specific people and groups in Your Workspace Domain and enter your email address.

  11. Under Logs , select Log errors to Logging .

  12. সংরক্ষণ করুন ক্লিক করুন. A configuration saved message appears, meaning the app is ready to test.

Receive administrator approval

To receive administrator approval, you must configure the Chat app in the Google Workspace Marketplace SDK.

Configure the Chat app in the Google Workspace Marketplace SDK

To configure the Chat app in the Google Workspace Marketplace SDK, follow these steps:

  1. In the Google Cloud console, go to go to Menu > APIs & Services > Enabled APIs & services > Google Workspace Marketplace SDK > App Configuration .

    Go to App Configuration

  2. Complete the App Configuration page. How you configure your Chat app depends on who your intended audience is and other factors. For help completing the app configuration page, see Configure your app in the Google Workspace Marketplace SDK . For the purposes of this guide, enter the following information:

    1. Under App visibility , select Private .
    2. Under Installation settings , select Admin install .
    3. Under App integrations , select Chat app .
    4. Under OAuth scopes , enter the following scopes:
      • https://www.googleapis.com/auth/chat.app.spaces
      • https://www.googleapis.com/auth/chat.app.memberships
    5. Under Developer information , enter your Developer name , Developer website URL , and Developer email .
    6. খসড়া সংরক্ষণ করুন ক্লিক করুন.

After configuring the app, update the store listing:

  1. In the Google Cloud console, go to go to Menu > APIs & Services > Enabled APIs & services > Google Workspace Marketplace SDK > Store Listing .
  2. In App details , select Web Development as a Category.
  3. In Graphic Assets , upload applications icons in requested formats.
  4. In Screenshots , upload a screenshot of the application.
  5. In Support Links , populate a Terms of Service URL, Privacy URL and Support URL.
  6. In Distribution , Select the regions where this application will be available.
  7. প্রকাশ করুন ক্লিক করুন.

Get administrator approval

Now that your service account is configured to receive administrator approval, obtain it from a Google Workspace administrator who can grant approval by following the steps in Set up authorization for Chat apps .

Test the Chat app

To test the incident management Chat app, initiate an incident from the web page and verify that the Chat app works as expected:

  1. Go to the Apps Script deployment web app URL.

  2. When Apps Script asks permission to access your data, click Review permissions , sign in with an appropriate Google Account in your Google Workspace domain, and click Allow .

  3. The incident initialization web page opens. Enter test information:

    1. In Incident title , type The First Incident .
    2. Optionally, in Incident responders , enter the email addresses of your fellow incident responders. They must be users with a Google Chat account in your Google Workspace organization or space creation fails. Don't enter your own email address because it's included automatically.
    3. In Initial message , type Testing the incident management Chat app.
  4. Click Create Chat Space . A creating space message appears.

  5. After the space is created, a Space created! বার্তা প্রদর্শিত হয়। Click Open space , which opens the space in Chat in a new tab.

  6. Optionally, you and the other incident responders can send messages in the space. The app summarizes these messages using Vertex AI and shares a retrospective document.

  7. To end the incident response and begin the resolution process, in the Chat space, type /closeIncident . An incident management dialog opens.

  8. In Close incident , enter a description for the incident resolution, like Test complete .

  9. Click Close Incident .

The Incident Management app lists the messages in the space, summarizes them with Vertex AI, pastes the summary in a Google Docs document, and shares the document in the space.

পরিষ্কার করুন

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, we recommend that you delete the Cloud project.

  1. Google ক্লাউড কনসোলে, সম্পদ পরিচালনা পৃষ্ঠাতে যান। Click Menu > IAM & Admin > Manage Resources .

    Go to Resource Manager

  2. In the project list, select the project you want to delete and then click Delete .
  3. In the dialog, type the project ID and then click Shut down to delete the project.
,

This tutorial uses authorization scopes that begins with https://www.googleapis.com/auth/chat.app.* , which are available as part of a Developer Preview, your Chat app must get a one-time administrator approval .

This tutorial shows how to make a Google Chat app that responds to incidents in real time. When responding to an incident, the app creates and populates a Chat space, facilitates incident resolution with messages, slash commands, and dialogs, and uses AI to summarize the incident response in a Google Docs document.

An incident is an event that requires the immediate attention of a team of people to resolve. Examples of incidents include:

  • A time-sensitive case is created in a Customer Relationship Management (CRM) platform, requiring a service team to collaborate on a resolution.
  • A system goes offline, alerting a group of site reliability engineers (SREs) so that they can work together to bring it back online.
  • A high magnitude earthquake occurs, and emergency workers need to coordinate their response.

For the purposes of this tutorial, the incident alert starts when someone reports the incident with a button click from a web page. The web page simulates an incident by asking users to enter basic incident information: title, description, and email addresses of the responders.

See the incident management Chat app in action:

  • The website that starts an incident.
    Figure 1. The website where someone can report an incident.
  • Notification that the incident Chat space is created.
    Figure 2. Notification that the incident Chat space is created.
  • The incident response Chat space.
    Figure 3. The incident response Chat space.
  • Resolving the incident with a slash command.
    Figure 4. Resolving the incident with a slash command.
  • Incident resolution dialog.
    Figure 5. Incident resolution dialog.
  • Incident resolution Google Docs document shared in space.
    Figure 6. Incident resolution Google Docs document shared in space.
  • The AI summary incident resolution Google Doc.
    Figure 7. The AI summary incident resolution Google Docs document.

পূর্বশর্ত

If you need any of these prerequisites turned on for your organization, ask your Google Workspace administrator to turn them on:

  • A Business or Enterprise Google Workspace account with access to Google Chat .
  • To have Directory (contact sharing) turned on for Google Workspace. The incident app uses the directory to look up the incident responders' contact info, like name and email address. Incident responders must be users with a Google Chat account in your Google Workspace organization.

উদ্দেশ্য

  • Build a Chat app that responds to incidents.
  • Help users respond to incidents by doing the following:
    • Creating incident response spaces.
    • Posting messages summarizing incidents and responses.
    • Supporting collaboration with interactive Chat app features.
  • Summarize conversations and resolutions with Vertex AI.

স্থাপত্য

The following diagram shows the architecture of the Google Workspace and Google Cloud resources used by the incident response Google Chat app.

Architecture of the incident response Google Chat app

The architecture shows how the incident response Google Chat app processes an incident and resolution.

  1. A user starts an incident from an external website hosted on Apps Script.

  2. The website sends an asynchronous HTTP request to the Google Chat app, also hosted on Apps Script.

  3. The incident response Google Chat app processes the request:

    1. The Apps Script Admin SDK service gets team member information, like user ID and email address.

    2. With a set of HTTP requests to Chat API using the Apps Script Advanced Chat service, the incident response Google Chat app creates an incident Chat space, populates it with team members, and sends a message to the space.

  4. Team members discuss the incident in the Chat space.

  5. A team member invokes a slash command to signal a resolution to the incident.

    1. An HTTP call to Chat API using the Apps Script Advanced Chat service lists all the Chat space's messages.

    2. Vertex AI receives the listed messages and generates a summary.

    3. The Apps Script DocumentApp service creates a Docs document and adds Vertex AI's summary to the document.

    4. The incident response Google Chat app calls Chat API to send a message sharing a link to the summary Docs document.

Prepare the environment

This section shows how to create and configure a Google Cloud project for the Chat app.

একটি Google ক্লাউড প্রকল্প তৈরি করুন

গুগল ক্লাউড কনসোল

  1. In the Google Cloud console, go to Menu > IAM & Admin > Create a Project .

    Go to Create a Project

  2. প্রকল্পের নাম ক্ষেত্রে, আপনার প্রকল্পের জন্য একটি বর্ণনামূলক নাম লিখুন।

    Optional: To edit the Project ID , click Edit . The project ID can't be changed after the project is created, so choose an ID that meets your needs for the lifetime of the project.

  3. অবস্থান ক্ষেত্রে, আপনার প্রকল্পের সম্ভাব্য অবস্থানগুলি প্রদর্শন করতে ব্রাউজ ক্লিক করুন। Then, click Select .
  4. তৈরি করুন ক্লিক করুন। The Google Cloud console navigates to the Dashboard page and your project is created within a few minutes.

জিক্লাউড সিএলআই

In one of the following development environments, access the Google Cloud CLI ( gcloud ):

  • Cloud Shell : To use an online terminal with the gcloud CLI already set up, activate Cloud Shell.
    ক্লাউড শেল সক্রিয় করুন
  • Local Shell : To use a local development environment, install and initialize the gcloud CLI.
    To create a Cloud project, use the gcloud projects create command:
    gcloud projects create PROJECT_ID
    Replace PROJECT_ID by setting the ID for the project you want to create.

Enable billing for the Cloud project

গুগল ক্লাউড কনসোল

  1. In the Google Cloud console, go to Billing . Click Menu > Billing > My Projects .

    Go to Billing for My Projects

  2. In Select an organization , choose the organization associated with your Google Cloud project.
  3. In the project row, open the Actions menu ( ), click Change billing , and choose the Cloud Billing account.
  4. Click Set account .

জিক্লাউড সিএলআই

  1. To list available billing accounts, run:
    gcloud billing accounts list
  2. Link a billing account with a Google Cloud project:
    gcloud billing projects link PROJECT_ID --billing-account=BILLING_ACCOUNT_ID

    নিম্নলিখিতগুলি প্রতিস্থাপন করুন:

    • PROJECT_ID is the Project ID for the Cloud project for which you want to enable billing.
    • BILLING_ACCOUNT_ID is the billing account ID to link with the Google Cloud project.

APIs সক্রিয় করুন

গুগল ক্লাউড কনসোল

  1. In the Google Cloud console, enable the Google Chat API, the Google Docs API, the Admin SDK API, the Google Workspace Marketplace SDK, and the Vertex AI API.

    APIs সক্রিয় করুন

  2. Confirm that you're enabling the APIs in the correct Cloud project, then click Next .

  3. Confirm that you're enabling the correct APIs, then click Enable .

জিক্লাউড সিএলআই

  1. If necessary, set the current Cloud project to the one you created with the gcloud config set project command:

    gcloud config set project PROJECT_ID

    Replace PROJECT_ID with the Project ID of the Cloud project you created.

  2. Enable the Google Chat API, Google Docs API, Admin SDK API, Google Workspace Marketplace SDK, and Vertex AI API with the gcloud services enable command:

    gcloud services enable chat.googleapis.com docs.googleapis.com admin.googleapis.com aiplatform.googleapis.com appsmarket-component.googleapis.com

প্রমাণীকরণ এবং অনুমোদন সেট আপ করুন

The Chat app accesses Google Chat API using the Chat app's credentials. The app accesses the Admin SDK API and Google Docs API with user credentials.

Set up user authentication and authorization

Authentication and authorization lets the Chat app access resources in Google Workspace and Google Cloud to process an incident response. specifically, user authentication is used to call Google Docs API and Admin SDK API.

In this tutorial, you publish the app internally to your Workspace domain, so it's acceptable to use placeholder information. Before publishing the app externally, replace placeholder information with real information in the consent screen.

  1. In the Google Cloud console, go to Menu > > Branding .

    Go to Branding

  2. If you have already configured the, you can configure the following OAuth Consent Screen settings in Branding , Audience , and Data Access . If you see a message that says not configured yet , click Get Started :

    1. Under App Information , in App name , type Incident Management .
    2. In User support email , select your email address or an appropriate Google group.
    3. পরবর্তী ক্লিক করুন.
    4. Under Audience , select Internal . If you can't select Internal , select External .
    5. পরবর্তী ক্লিক করুন.
    6. Under Contact Information , enter an Email address where you can be notified about any changes to your project.
    7. পরবর্তী ক্লিক করুন.
    8. Under Finish , review the Google API Services User Data Policy and if you agree, select I agree to the Google API Services: User Data Policy .
    9. অবিরত ক্লিক করুন.
    10. তৈরি করুন ক্লিক করুন।
    11. If you selected External for user type, add test users:
      1. Click Audience .
      2. Under Test users , click Add users .
      3. Enter your email address and any other authorized test users, then click Save .
  3. Click Data Access > Add or Remove Scopes . A panel appears with a list of scopes for each API that you've enabled in your Google Cloud project.

    1. Under Manually add scopes , paste the following scopes:

      • https://www.googleapis.com/auth/documents
      • https://www.googleapis.com/auth/admin.directory.user.readonly
      • https://www.googleapis.com/auth/script.external_request
      • https://www.googleapis.com/auth/userinfo.email
      • https://www.googleapis.com/auth/cloud-platform
    2. Click Add to Table .

    3. আপডেট ক্লিক করুন.

    4. After selecting the scopes required by your app, on the Data Access page, click Save .

Set up app authentication and authorization

App Authentication is used to call Google Chat API.

Create a service account in Google Cloud console

To create a service account, follow these steps:

গুগল ক্লাউড কনসোল

  1. In the Google Cloud console, go to Menu > IAM & Admin > Service Accounts .

    Go to Service Accounts

  2. পরিষেবা অ্যাকাউন্ট তৈরি করুন ক্লিক করুন।
  3. Fill in the service account details, then click Create and continue .
  4. Optional: Assign roles to your service account to grant access to your Google Cloud project's resources. For more details, refer to Granting, changing, and revoking access to resources .
  5. অবিরত ক্লিক করুন.
  6. Optional: Enter users or groups that can manage and perform actions with this service account. For more details, refer to Managing service account impersonation .
  7. সম্পন্ন ক্লিক করুন. Make a note of the email address for the service account.

জিক্লাউড সিএলআই

  1. Create the service account:
    gcloud iam service-accounts create SERVICE_ACCOUNT_NAME \
      --display-name="SERVICE_ACCOUNT_NAME"
  2. Optional: Assign roles to your service account to grant access to your Google Cloud project's resources. For more details, refer to Granting, changing, and revoking access to resources .

The service account appears on the service account page. Next, create a private key for the service account.

Create a private key

To create and download a private key for the service account, follow these steps:

  1. In the Google Cloud console, go to Menu > IAM & Admin > Service Accounts .

    Go to Service Accounts

  2. Select your service account.
  3. Click Keys > Add key > Create new key .
  4. Select JSON , then click Create .

    Your new public/private key pair is generated and downloaded to your machine as a new file. Save the downloaded JSON file as credentials.json in your working directory. This file is the only copy of this key. For information about how to store your key securely, see Managing service account keys .

  5. বন্ধ ক্লিক করুন.

For more information about service accounts, see service accounts in the Google Cloud IAM documentation.

Create a Google Workspace Marketplace-compatible OAuth client

To create a Google Workspace Marketplace-compatible OAuth client, follow these steps:

  1. In the Google Cloud console, go to Menu > IAM & Admin > Service Accounts .

    Go to Service Accounts

  2. Click the service account you created for your Chat app.

  3. Advanced settings এ ক্লিক করুন।

  4. Click Create Google Workspace Marketplace-compatible OAuth client .

  5. অবিরত ক্লিক করুন.

A confirmation message appears that says a Google Workspace Marketplace-compatible OAuth client has been created.

Create and deploy the Chat app

In the following section, you copy and update an entire Apps Script project that contains all the required application code for your Chat app, so there's no need to copy and paste each file.

Some functions include underscores at the end of their names, like processSlashCommand_() from ChatApp.gs . The underscore hides the function from the incident initialization web page when it's open in a browser. For more information, see Private functions .

Apps Script supports two file types, .gs scripts and .html files. To abide by this support, the app's client-side JavaScript is included inside <script /> tags and its CSS is included inside <style /> tags inside an HTML file.

Optionally, you can view the entire project on GitHub.

GitHub এ দেখুন

Here's an overview of each file:

Consts.gs

Defines constants referenced by other code files, including your Cloud project ID, Vertex AI location ID, app credentials for the service account and the slash command ID for closing an incident.

View Consts.gs code

apps-script/incident-response-app-auth/Consts.gs
const PROJECT_ID = 'replace-with-your-project-id';
const CLOSE_INCIDENT_COMMAND_ID = 1;
const APP_CREDENTIALS = 'replace-with-your-app-credentials';
const APP_CREDENTIALS_SCOPES = 'https://www.googleapis.com/auth/chat.bot https://www.googleapis.com/auth/chat.app.memberships https://www.googleapis.com/auth/chat.app.spaces.create';
const VERTEX_AI_LOCATION_ID = 'us-central1';
const MODEL_ID = 'gemini-1.5-flash-002';
ChatApp.gs

Handles Chat interaction events, including messages, card clicks, slash commands, and dialogs. Responds to the /closeIncident slash command by opening a dialog to gather incident resolution details. Reads messages in the space by calling the spaces.messages.list method in the Chat API. Gets user IDs using the Admin SDK Directory service in Apps Script.

View ChatApp.gs code

apps-script/incident-response-app-auth/ChatApp.gs
/**
 * Responds to a MESSAGE event in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident").
 * It will respond to any other message with a simple "Hello" text message.
 *
 * @param {Object} event the event object from Google Chat
 */
function onMessage(event) {
  if (event.message.slashCommand) {
    return processSlashCommand_(event);
  }
  return { "text": "Hello from Incident Response app!" };
}

/**
 * Responds to a CARD_CLICKED event in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 *
 * @param {Object} event the event object from Google Chat
 */
function onCardClick(event) {
  if (event.isDialogEvent) {
    if (event.dialogEventType == 'SUBMIT_DIALOG') {
      return processSubmitDialog_(event);
    }
    return {
      actionResponse: {
        type: "DIALOG",
        dialogAction: {
          actionStatus: "OK"
        }
      }
    };
  }
}

/**
 * Responds to a MESSAGE event with a Slash command in Google Chat.
 *
 * This app only responds to a slash command with the ID 1 ("/closeIncident")
 * by returning a Dialog.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSlashCommand_(event) {
  if (event.message.slashCommand.commandId != CLOSE_INCIDENT_COMMAND_ID) {
    return {
      "text": "Command not recognized. Use the command `/closeIncident` to close the incident managed by this space."
    };
  }
  const sections = [
    {
      header: "Close Incident",
      widgets: [
        {
          textInput: {
            label: "Please describe the incident resolution",
            type: "MULTIPLE_LINE",
            name: "description"
          }
        },
        {
          buttonList: {
            buttons: [
              {
                text: "Close Incident",
                onClick: {
                  action: {
                    function: "closeIncident"
                  }
                }
              }
            ]
          }
        }
      ]
    }
  ];
  return {
    actionResponse: {
      type: "DIALOG",
      dialogAction: {
        dialog: {
          body: {
            sections,
          }
        }
      }
    }
  };
}

/**
 * Responds to a CARD_CLICKED event with a Dialog submission in Google Chat.
 *
 * This app only responds to one kind of dialog (Close Incident).
 * It creates a Doc with a summary of the incident information and posts a message
 * to the space with a link to the Doc.
 *
 * @param {Object} event the event object from Google Chat
 */
function processSubmitDialog_(event) {
  const resolution = event.common.formInputs.description[""].stringInputs.value[0];
  const chatHistory = concatenateAllSpaceMessages_(event.space.name);
  const chatSummary = summarizeChatHistory_(chatHistory);
  const docUrl = createDoc_(event.space.displayName, resolution, chatHistory, chatSummary);
  return {
    actionResponse: {
      type: "NEW_MESSAGE",
    },
    text: `Incident closed with the following resolution: ${resolution}\n\nHere is the automatically generated post-mortem:\n${docUrl}`
  };
}

/**
 * Lists all the messages in the Chat space, then concatenate all of them into
 * a single text containing the full Chat history.
 *
 * For simplicity for this demo, it only fetches the first 100 messages.
 *
 * Messages with slash commands are filtered out, so the returned history will
 * contain only the conversations between users and not app command invocations.
 *
 * @return {string} a text containing all the messages in the space in the format:
 *          Sender's name: Message
 */
function concatenateAllSpaceMessages_(spaceName) {
  // Call Chat API method spaces.messages.list
  const response = Chat.Spaces.Messages.list(spaceName, { 'pageSize': 100 });
  const messages = response.messages;
  // Fetch the display names of the message senders and returns a text
  // concatenating all the messages.
  let userMap = new Map();
  return messages
    .filter(message => message.slashCommand === undefined)
    .map(message => `${getUserDisplayName_(userMap, message.sender.name)}: ${message.text}`)
    .join('\n');
}

/**
 * Obtains the display name of a user by using the Admin Directory API.
 *
 * The fetched display name is cached in the provided map, so we only call the API
 * once per user.
 *
 * If the user does not have a display name, then the full name is used.
 *
 * @param {Map} userMap a map containing the display names previously fetched
 * @param {string} userName the resource name of the user
 * @return {string} the user's display name
 */
function getUserDisplayName_(userMap, userName) {
  if (userMap.has(userName)) {
    return userMap.get(userName);
  }
  let displayName = 'Unknown User';
  try {
    const user = AdminDirectory.Users.get(
      userName.replace("users/", ""),
      { projection: 'BASIC', viewType: 'domain_public' });
    displayName = user.name.displayName ? user.name.displayName : user.name.fullName;
  } catch (e) {
    // Ignore error if the API call fails (for example, because it's an
    // out-of-domain user or Chat app)) and just use 'Unknown User'.
  }
  userMap.set(userName, displayName);
  return displayName;
}
ChatSpaceCreator.gs

Receives form data users enter on the incident initialization web page, and uses it to set up a Chat space by creating and populating it, and then posts a message about the incident.

View ChatSpaceCreator.gs code

apps-script/incident-response-app-auth/ChatSpaceCreator.gs
/**
 * Handles an incident by creating a chat space, adding members, and posting a message.
 * All the actions are done using application credentials.
 *
 * @param {Object} formData - The data submitted by the user. It should contain the fields:
 *                           - title: The display name of the chat space.
 *                           - description: The description of the incident.
 *                           - users: A comma-separated string of user emails to be added to the space.
 * @return {string} The resource name of the new space.
 */
function handleIncident(formData) {
  const users = formData.users.trim().length > 0 ? formData.users.split(',') : [];
  const service = getService_();
  if (!service.hasAccess()) {
    console.error(service.getLastError());
    return;
   }
  const spaceName = createChatSpace_(formData.title, service);
  createHumanMembership_(spaceName, getUserEmail(), service);
  for (const user of users ){
    createHumanMembership_(spaceName, user, service);
  }
  createMessage_(spaceName, formData.description, service);
  return spaceName;
}
/**
 * Creates a chat space with application credentials.
 *
 * @param {string} displayName - The name of the chat space.
 * @param {object} service - The credentials of the service account.
 * @returns {string} The resource name of the new space.
*/
function createChatSpace_(displayName, service) {
  try {
    // For private apps, the alias can be used
    const my_customer_alias = "customers/my_customer";
    // Specify the space to create.
    const space = {
        displayName: displayName,
        spaceType: 'SPACE',                
        customer: my_customer_alias
    };
    // Call Chat API with a service account to create a message.
    const createdSpace = Chat.Spaces.create(
        space,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});
    return createdSpace.name;
  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create space with error %s', err.message);
  }
}
/*
 * Creates a chat message with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} message - The text to be posted.
 * @param {object} service - The credentials of the service account.
 * @return {string} the resource name of the new space.
 */
function createMessage_(spaceName, message, service) {
  try {
    // Call Chat API with a service account to create a message.
    const result = Chat.Spaces.Messages.create(
        {'text': message},
        spaceName,
        {},
        // Authenticate with the service account token.
        {'Authorization': 'Bearer ' + service.getAccessToken()});

  } catch (err) {
    // TODO (developer) - Handle exception.
    console.log('Failed to create message with error %s', err.message);
  }
}
/**
 * Creates a human membership in a chat space with application credentials.
 *
 * @param {string} spaceName - The resource name of the space.
 * @param {string} email - The email of the user to be added.
 * @param {object} service - The credentials of the service account.
 */
function createHumanMembership_(spaceName, email, service){
  try{
    const membership = {
      member: {
        name: 'users/'+email,
        // User type for the membership
        type: 'HUMAN'
      }
    };
    const result = Chat.Spaces.Members.create(
      membership,
      spaceName,
      {},
      {'Authorization': 'Bearer ' + service.getAccessToken()}
    );
  } catch (err){
    console.log('Failed to create membership with error %s', err.message)
  }

}

 /*
 * Creates a service for the service account.
 * @return {object}  - The credentials of the service account.
 */
function getService_() {
  return OAuth2.createService(APP_CREDENTIALS.client_email)
      .setTokenUrl('https://oauth2.googleapis.com/token')
      .setPrivateKey(APP_CREDENTIALS.private_key)
      .setIssuer(APP_CREDENTIALS.client_email)
      .setSubject(APP_CREDENTIALS.client_email)
      .setScope(APP_CREDENTIALS_SCOPES)
      .setPropertyStore(PropertiesService.getScriptProperties());
}
DocsApi.gs

Calls the Google Docs API to create a Google Docs document in a user's Google Drive and writes a summary of the incident information, created in VertexAiApi.gs , to the document.

View DocsApi.gs code

apps-script/incident-response-app-auth/DocsApi.gs
/**
 * Creates a Doc in the user's Google Drive and writes a summary of the incident information to it.
 *
 * @param {string} title The title of the incident
 * @param {string} resolution Incident resolution described by the user
 * @param {string} chatHistory The whole Chat history be included in the document
 * @param {string} chatSummary A summary of the Chat conversation to be included in the document
 * @return {string} the URL of the created Doc
 */
function createDoc_(title, resolution, chatHistory, chatSummary) {
  let doc = DocumentApp.create(title);
  let body = doc.getBody();
  body.appendParagraph(`Post-Mortem: ${title}`).setHeading(DocumentApp.ParagraphHeading.TITLE);
  body.appendParagraph("Resolution").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(resolution);
  body.appendParagraph("Summary of the conversation").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatSummary);
  body.appendParagraph("Full Chat history").setHeading(DocumentApp.ParagraphHeading.HEADING1);
  body.appendParagraph(chatHistory);
  return doc.getUrl();
}
VertexAiApi.gs

Summarizes the conversation in the Chat space using Vertex AI API. This summary is posted in a specially-created document in DocsAPI.gs .

View VertexAiApi.gs code

apps-script/incident-response-app-auth/VertexAiApi.gs
/**
 * Summarizes a Chat conversation using the Vertex AI text prediction API.
 *
 * @param {string} chatHistory The Chat history that will be summarized.
 * @return {string} The content from the text prediction response.
 */


function summarizeChatHistory_(chatHistory) {

  const API_ENDPOINT = `https://${VERTEX_AI_LOCATION_ID}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${VERTEX_AI_LOCATION_ID}/publishers/google/models/${MODEL_ID}:generateContent`;
  const prompt = "Summarize the following conversation between Engineers resolving an incident"
      + " in a few sentences. Use only the information from the conversation.\n\n" + chatHistory;
  // Get the access token.
  const accessToken = ScriptApp.getOAuthToken();

  const headers = {
    'Authorization': 'Bearer ' + accessToken,
    'Content-Type': 'application/json',
  };
  const payload = {
    'contents': {
      'role': 'user',
      'parts' : [
        {
          'text': prompt
        }
      ]
    }
  }
  const options = {
    'method': 'post',
    'headers': headers,
    'payload': JSON.stringify(payload),
    'muteHttpExceptions': true,
  };
  try {
    const response = UrlFetchApp.fetch(API_ENDPOINT, options);
    const responseCode = response.getResponseCode();
    const responseText = response.getContentText();

    if (responseCode === 200) {
      const jsonResponse = JSON.parse(responseText);
      console.log(jsonResponse)
      if (jsonResponse.candidates && jsonResponse.candidates.length > 0) {
        return jsonResponse.candidates[0].content.parts[0].text; // Access the summarized text
      } else {
        return "No summary found in response.";
      }

    } else {
      console.error("Vertex AI API Error:", responseCode, responseText);
      return `Error: ${responseCode} - ${responseText}`;
    }
  } catch (e) {
    console.error("UrlFetchApp Error:", e);
    return "Error: " + e.toString();
  }
}
WebController.gs

Serves the incident initialization website.

View WebController.gs code

apps-script/incident-response-app-auth/WebController.gs
/**
 * Serves the web page from Index.html.
 */
function doGet() {
  return HtmlService
    .createTemplateFromFile('Index')
    .evaluate();
}

/**
 * Serves the web content from the specified filename.
 */
function include(filename) {
  return HtmlService
    .createHtmlOutputFromFile(filename)
    .getContent();
}

/**
 * Returns the email address of the user running the script.
 */
function getUserEmail() {
  return Session.getActiveUser().getEmail();
}
Index.html

The HTML comprising the incident initialization website.

View Index.html code

apps-script/incident-response-app-auth/Index.html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
    <?!= include('Stylesheet'); ?>
  </head>
  <body>
    <div class="container">
      <div class="content">
        <h1>Incident Manager</h1>
        <form id="incident-form" onsubmit="handleFormSubmit(this)">
          <div id="form">
            <p>
              <label for="title">Incident title</label><br/>
              <input type="text" name="title" id="title" />
            </p>
            <p>
              <label for="users">Incident responders</label><br/>
              <small>
                Please enter a comma-separated list of email addresses of the users
                that should be added to the space.
                Do not include <?= getUserEmail() ?> as it will be added automatically.
              </small><br/>
              <input type="text" name="users" id="users" />
            </p>
            <p>
              <label for="description">Initial message</label></br>
              <small>This message will be posted after the space is created.</small><br/>
              <textarea name="description" id="description"></textarea>
            </p>
            <p class="text-center">
              <input type="submit" value="CREATE CHAT SPACE" />
            </p>
          </div>
          <div id="output" class="hidden"></div>
          <div id="clear" class="hidden">
            <input type="reset" value="CREATE ANOTHER INCIDENT" onclick="onReset()" />
          </div>
        </form>
      </div>
    </div>
    <?!= include('JavaScript'); ?>
  </body>
</html>
JavaScript.html

Handles form behavior including submits, errors, and clears, for the incident initialization website. It's included into Index.html by the custom include function in WebController.gs .

View JavaScript.html code

apps-script/incident-response-app-auth/JavaScript.html
<script>
  var formDiv = document.getElementById('form');
  var outputDiv = document.getElementById('output');
  var clearDiv = document.getElementById('clear');

  function handleFormSubmit(formObject) {
    event.preventDefault();
    outputDiv.innerHTML = 'Please wait while we create the space...';
    hide(formDiv);
    show(outputDiv);
    google.script.run
      .withSuccessHandler(updateOutput)
      .withFailureHandler(onFailure)
      .handleIncident(formObject);
  }

  function updateOutput(response) {
    var spaceId = response.replace('spaces/', '');
    outputDiv.innerHTML =
      '<p>Space created!</p><p><a href="https://mail.google.com/chat/#chat/space/'
        + spaceId
        + '" target="_blank">Open space</a></p>';
    show(outputDiv);
    show(clearDiv);
  }

  function onFailure(error) {
    outputDiv.innerHTML = 'ERROR: ' + error.message;
    outputDiv.classList.add('error');
    show(outputDiv);
    show(clearDiv);
  }

  function onReset() {
    outputDiv.innerHTML = '';
    outputDiv.classList.remove('error');
    show(formDiv);
    hide(outputDiv);
    hide(clearDiv);
  }

  function hide(element) {
    element.classList.add('hidden');
  }

  function show(element) {
    element.classList.remove('hidden');
  }
</script>
Stylesheet.html

The CSS for the incident initialization website. It's included into Index.html by the custom include function in WebController.gs .

View Stylesheet.html code

apps-script/incident-response-app-auth/Stylesheet.html
<style>
  * {
    box-sizing: border-box;
  }
  body {
    font-family: Roboto, Arial, Helvetica, sans-serif;
  }
  div.container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
  }
  div.content {
    width: 80%;
    max-width: 1000px;
    padding: 1rem;
    border: 1px solid #999;
    border-radius: 0.25rem;
    box-shadow: 0 2px 2px 0 rgba(66, 66, 66, 0.08), 0 2px 4px 2px rgba(66, 66, 66, 0.16);
  }
  h1 {
    text-align: center;
    padding-bottom: 1rem;
    margin: 0 -1rem 1rem -1rem;
    border-bottom: 1px solid #999;
  }
 #output {
    text-align: center;
    min-height: 250px;
  }
  div#clear {
    text-align: center;
    padding-top: 1rem;
    margin: 1rem -1rem 0 -1rem;
    border-top: 1px solid #999;
  }
  input[type=text], textarea {
    width: 100%;
    padding: 1rem 0.5rem;
    margin: 0.5rem 0;
    border: 0;
    border-bottom: 1px solid #999;
    background-color: #f0f0f0;
  }
  textarea {
    height: 5rem;
  }
  small {
    color: #999;
  }
  input[type=submit], input[type=reset] {
    padding: 1rem;
    border: none;
    background-color: #6200ee;
    color: #fff;
    border-radius: 0.25rem;
    width: 25%;
  }
  .hidden {
    display: none;
  }
  .text-center {
    text-align: center;
  }
  .error {
    color: red;
  }
</style>

Find your Cloud project number and ID

  1. In the Google Cloud console, go to your Cloud project.

    Go to Google Cloud console

  2. Click Settings and Utilities > Project settings .

  3. Note the values in the Project number and Project ID fields. You use them in the following sections.

অ্যাপস স্ক্রিপ্ট প্রকল্প তৈরি করুন

To create an Apps Script project and connect it with your Cloud project:

  1. Click the following button to open the Respond to incidents with Google Chat Apps Script project.
    Open the project
  2. Click Overview .
  3. On the overview page, click একটি অনুলিপি তৈরি করার জন্য আইকন Make a copy .
  4. Name your copy of the Apps Script project:

    1. Click Copy of Respond to incidents with Google Chat .

    2. In Project title , type Incident Management Chat app .

    3. পুনঃনামকরণ ক্লিক করুন।

  5. In your copy of the Apps Script project, go to the Consts.gs file and replace YOUR_PROJECT_ID with the ID of your Cloud project.

Set the Apps Script project's Cloud project

  1. In your Apps Script project, click The icon for project settings প্রকল্প সেটিংস
  2. Google ক্লাউড প্ল্যাটফর্ম (GCP) প্রকল্পের অধীনে, প্রকল্প পরিবর্তন করুন ক্লিক করুন।
  3. In GCP project number , paste the project number of your Cloud project.
  4. Click Set project . The Cloud project and Apps Script project are now connected.

Create an Apps Script deployment

Now that all the code is in place, deploy the Apps Script project. You use the deployment ID when you configure the Chat app in the Google Cloud.

  1. In Apps Script, open the incident response app's project.

    Go to Apps Script

  2. Click Deploy > New deployment .

  3. If Add-on and Web app aren't already selected, next to Select type , click deployment types The icon for project settings and select Add-on and Web app .

  4. In Description , enter a description for this version, like Complete version of incident management app .

  5. In Execute as , select User accessing the web app

  6. In Who has access , select Anyone within your Workspace organization , where "your Workspace organization" is the name of your Google Workspace organization.

  7. ডিপ্লোয় ক্লিক করুন। Apps Script reports successful deployment and provides a deployment ID and a URL for the incident initialization web page.

  8. Make note of the Web app URL to visit later when you start an incident. Copy the Deployment ID . You use this ID while configuring the Chat app in Google Cloud console.

  9. সম্পন্ন ক্লিক করুন.

Configure the Chat app in the Google Cloud console

This section shows how to configure the Google Chat API in the Google Cloud console with information about your Chat app, including the ID of the deployment that you just created from your Apps Script project.

  1. In the Google Cloud console, click Menu > More products > Google Workspace > Product Library > Google Chat API > Manage > Configuration .

    Go to Chat API configuration

  2. In App name , type Incident Management .

  3. In Avatar URL , type https://developers.google.com/chat/images/quickstart-app-avatar.png .

  4. In Description , type Responds to incidents. .

  5. Click the Enable Interactive features toggle to the on position.

  6. Under Functionality , select Receive 1:1 messages , Join spaces and group conversations .

  7. Under Connection settings , select Apps Script .

  8. In Deployment ID , paste the Apps Script Deployment ID that you copied earlier from the Apps Script project deployment.

  9. Register a slash command that the fully implemented Chat app uses:

    1. Under Commands , click Add a command .

    2. In Command ID , type 1 .

    3. In Description , type Closes the incident being discussed in the space.

    4. Under Command type , select Slash command .

    5. In Slash command name , type /closeIncident .

    6. Select Opens a dialog .

    7. সম্পন্ন ক্লিক করুন. The slash command is registered and listed.

  10. Under Visibility , select Make this Chat app available to specific people and groups in Your Workspace Domain and enter your email address.

  11. Under Logs , select Log errors to Logging .

  12. সংরক্ষণ করুন ক্লিক করুন. A configuration saved message appears, meaning the app is ready to test.

Receive administrator approval

To receive administrator approval, you must configure the Chat app in the Google Workspace Marketplace SDK.

Configure the Chat app in the Google Workspace Marketplace SDK

To configure the Chat app in the Google Workspace Marketplace SDK, follow these steps:

  1. In the Google Cloud console, go to go to Menu > APIs & Services > Enabled APIs & services > Google Workspace Marketplace SDK > App Configuration .

    Go to App Configuration

  2. Complete the App Configuration page. How you configure your Chat app depends on who your intended audience is and other factors. For help completing the app configuration page, see Configure your app in the Google Workspace Marketplace SDK . For the purposes of this guide, enter the following information:

    1. Under App visibility , select Private .
    2. Under Installation settings , select Admin install .
    3. Under App integrations , select Chat app .
    4. Under OAuth scopes , enter the following scopes:
      • https://www.googleapis.com/auth/chat.app.spaces
      • https://www.googleapis.com/auth/chat.app.memberships
    5. Under Developer information , enter your Developer name , Developer website URL , and Developer email .
    6. খসড়া সংরক্ষণ করুন ক্লিক করুন.

After configuring the app, update the store listing:

  1. In the Google Cloud console, go to go to Menu > APIs & Services > Enabled APIs & services > Google Workspace Marketplace SDK > Store Listing .
  2. In App details , select Web Development as a Category.
  3. In Graphic Assets , upload applications icons in requested formats.
  4. In Screenshots , upload a screenshot of the application.
  5. In Support Links , populate a Terms of Service URL, Privacy URL and Support URL.
  6. In Distribution , Select the regions where this application will be available.
  7. প্রকাশ করুন ক্লিক করুন.

Get administrator approval

Now that your service account is configured to receive administrator approval, obtain it from a Google Workspace administrator who can grant approval by following the steps in Set up authorization for Chat apps .

Test the Chat app

To test the incident management Chat app, initiate an incident from the web page and verify that the Chat app works as expected:

  1. Go to the Apps Script deployment web app URL.

  2. When Apps Script asks permission to access your data, click Review permissions , sign in with an appropriate Google Account in your Google Workspace domain, and click Allow .

  3. The incident initialization web page opens. Enter test information:

    1. In Incident title , type The First Incident .
    2. Optionally, in Incident responders , enter the email addresses of your fellow incident responders. They must be users with a Google Chat account in your Google Workspace organization or space creation fails. Don't enter your own email address because it's included automatically.
    3. In Initial message , type Testing the incident management Chat app.
  4. Click Create Chat Space . A creating space message appears.

  5. After the space is created, a Space created! বার্তা প্রদর্শিত হয়। Click Open space , which opens the space in Chat in a new tab.

  6. Optionally, you and the other incident responders can send messages in the space. The app summarizes these messages using Vertex AI and shares a retrospective document.

  7. To end the incident response and begin the resolution process, in the Chat space, type /closeIncident . An incident management dialog opens.

  8. In Close incident , enter a description for the incident resolution, like Test complete .

  9. Click Close Incident .

The Incident Management app lists the messages in the space, summarizes them with Vertex AI, pastes the summary in a Google Docs document, and shares the document in the space.

পরিষ্কার করুন

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, we recommend that you delete the Cloud project.

  1. Google ক্লাউড কনসোলে, সম্পদ পরিচালনা পৃষ্ঠাতে যান। Click Menu > IAM & Admin > Manage Resources .

    Go to Resource Manager

  2. In the project list, select the project you want to delete and then click Delete .
  3. In the dialog, type the project ID and then click Shut down to delete the project.