Google Workspace সাবস্ক্রিপশন মুছুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই পৃষ্ঠাটি ব্যাখ্যা করে যে কীভাবে subscriptions.delete()
পদ্ধতি ব্যবহার করে Google Workspace সাবস্ক্রিপশন মুছে ফেলা যায়।
আপনি সাবস্ক্রিপশন মুছে দিলে, আপনার অ্যাপ আর কোনো ইভেন্ট পায় না। সাবস্ক্রিপশনের মেয়াদ শেষ হলে, Google Workspace Events API সেটি অটোমেটিক মুছে দেয়।
পূর্বশর্ত
অ্যাপস স্ক্রিপ্ট
- একটি Apps স্ক্রিপ্ট প্রকল্প:
পাইথন
- পাইথন 3.6 বা তার বেশি
- পাইপ প্যাকেজ ম্যানেজমেন্ট টুল
- পাইথনের জন্য সর্বশেষ Google ক্লায়েন্ট লাইব্রেরি। এগুলি ইনস্টল বা আপডেট করতে, আপনার কমান্ড-লাইন ইন্টারফেসে নিম্নলিখিত কমান্ডটি চালান:
pip3 install --upgrade google-api-python-client google-auth-oauthlib
- একটি Google Workspace সদস্যতা। একটি তৈরি করতে, একটি সদস্যতা তৈরি করুন দেখুন।
প্রমাণীকরণ প্রয়োজন:
- ব্যবহারকারীর প্রমাণীকরণের জন্য, সাবস্ক্রিপশনের জন্য অন্তত একটি ইভেন্ট প্রকারকে সমর্থন করে এমন একটি সুযোগ প্রয়োজন৷ একটি সুযোগ শনাক্ত করতে, ইভেন্টের ধরন অনুসারে স্কোপগুলি দেখুন।
- অ্যাপ প্রমাণীকরণের জন্য,
chat.bot
সুযোগ প্রয়োজন (শুধুমাত্র Google Chat অ্যাপ)।
ব্যবহারকারীর দ্বারা অনুমোদিত একটি সদস্যতা মুছুন
নিম্নলিখিত কোড নমুনা ব্যবহারকারী প্রমাণীকরণ ব্যবহার করে একটি Subscription
সংস্থান মুছে দেয়।
একটি সদস্যতা মুছে ফেলার জন্য:
অ্যাপস স্ক্রিপ্ট
আপনার অ্যাপস স্ক্রিপ্ট প্রকল্পে, deleteSubscription
নামে একটি নতুন স্ক্রিপ্ট ফাইল তৈরি করুন এবং নিম্নলিখিত কোড যোগ করুন:
function deleteSubscription() {
// The name of the subscription to delete.
const name = 'subscriptions/SUBSCRIPTION_ID';
// Call the Workspace Events API using the advanced service.
const response = WorkspaceEvents.Subscriptions.remove(name);
console.log(response);
}
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
-
SUBSCRIPTION_ID
: সদস্যতার আইডি। আইডি পেতে, আপনি নিম্নলিখিত যে কোনো একটি ব্যবহার করতে পারেন:-
uid
ক্ষেত্রের মান। -
name
ক্ষেত্রে প্রতিনিধিত্ব করা সম্পদ নামের ID। উদাহরণস্বরূপ, যদি সম্পদের নাম হয় subscriptions/subscription-123
, subscription-123
ব্যবহার করুন।
সাবস্ক্রিপশন মুছে ফেলতে, আপনার অ্যাপস স্ক্রিপ্ট প্রোজেক্টে deleteSubscription
ফাংশনটি চালান।
পাইথন
আপনার কাজের ডিরেক্টরিতে, delete_subscription.py
নামে একটি ফাইল তৈরি করুন এবং নিম্নলিখিত কোড যোগ করুন:
"""Delete subscription."""
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
# Specify required scopes.
SCOPES = ['SCOPE']
# Authenticate with Google Workspace and get user authentication.
flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
CREDENTIALS = flow.run_local_server()
# Call the Workspace Events API using the service endpoint.
service = build(
'workspaceevents',
'v1',
credentials=CREDENTIALS,
)
NAME = 'subscriptions/SUBSCRIPTION_ID'
response = service.subscriptions().delete(name=NAME).execute()
print(response)
নিম্নলিখিতগুলি প্রতিস্থাপন করুন:
-
SCOPE
: একটি OAuth স্কোপ যা সদস্যতা থেকে অন্তত একটি ইভেন্ট প্রকারকে সমর্থন করে । উদাহরণস্বরূপ, যদি আপনার সদস্যতা ইভেন্টগুলি একটি আপডেট করা চ্যাট স্পেস পায়, https://www.googleapis.com/auth/chat.spaces.readonly
। -
SUBSCRIPTION_ID
: সদস্যতার আইডি। আইডি পেতে, আপনি নিম্নলিখিত যে কোনো একটি ব্যবহার করতে পারেন:-
uid
ক্ষেত্রের মান। -
name
ক্ষেত্রে প্রতিনিধিত্ব করা সম্পদ নামের ID। উদাহরণস্বরূপ, যদি সম্পদের নাম হয় subscriptions/subscription-123
, subscription-123
ব্যবহার করুন।
আপনার কাজের ডিরেক্টরিতে, নিশ্চিত করুন যে আপনি আপনার OAuth ক্লায়েন্ট আইডি শংসাপত্রগুলি সংরক্ষণ করেছেন এবং ফাইলটির নাম দিয়েছেন credentials.json
। কোড নমুনা এই JSON ফাইলটি Google Workspace-এর সাথে প্রমাণীকরণ করতে এবং ব্যবহারকারীর শংসাপত্র পেতে ব্যবহার করে। নির্দেশাবলীর জন্য, OAuth ক্লায়েন্ট আইডি শংসাপত্র তৈরি করুন দেখুন।
সদস্যতা মুছে ফেলার জন্য, আপনার টার্মিনালে নিম্নলিখিত চালান:
python3 delete_subscription.py
Google Workspace Events API একটি
দীর্ঘমেয়াদী অপারেশন প্রদান করে যাতে
Subscription
রিসোর্সের উদাহরণ থাকে।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-13 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-13 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eThis page provides instructions for deleting a Google Workspace subscription using the \u003ccode\u003esubscriptions.delete()\u003c/code\u003e method, which stops event delivery to your app.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a subscription is permanent and requires user authentication with appropriate scopes.\u003c/p\u003e\n"],["\u003cp\u003eCode samples are provided in Apps Script and Python, demonstrating how to delete a subscription authorized by a user.\u003c/p\u003e\n"],["\u003cp\u003eTo successfully execute the code samples, you need a Google Workspace subscription, necessary authentication credentials, and a correctly configured development environment.\u003c/p\u003e\n"],["\u003cp\u003eOnce the subscription is deleted, the Google Workspace Events API returns a long-running operation confirming the removal.\u003c/p\u003e\n"]]],["To delete a Google Workspace subscription, use the `subscriptions.delete()` method. In Apps Script, create a `deleteSubscription` function, specify the subscription ID, and run the function. In Python, create a `delete_subscription.py` file, authenticate with Google Workspace using OAuth credentials, then specify the subscription ID and execute the `delete()` method. Ensure you have the required scopes and the same OAuth client ID used to create the subscription. After deletion, the app stops receiving events.\n"],null,["# Delete a Google Workspace subscription\n\nThis page explains how to delete a Google Workspace subscription using the\n[`subscriptions.delete()`](/workspace/events/reference/rest/v1/subscriptions/delete)\nmethod.\n\nWhen you delete a subscription, your app no longer receives any events. If a\nsubscription expires, the Google Workspace Events API deletes it automatically.\n\nPrerequisites\n-------------\n\n### Apps Script\n\n- \u003cbr /\u003e\n\n A Google Workspace subscription. To create one, see [Create a subscription](/workspace/events/guides/create-subscription).\n\n \u003cbr /\u003e\n\n- Requires user authentication with one or more\n [scopes that support all event types for\n the subscription](/workspace/events/guides/auth#scopes-event-type).\n\n | **Note:** To run the code sample in this guide, you must use the same [OAuth client\n | ID credentials](/workspace/events/guides/create-subscription#create-oauth) that you used to create the subscription.\n\n\u003c!-- --\u003e\n\n- An Apps Script project:\n - Use your Google Cloud project instead of the default one created automatically by Apps Script.\n - For all scopes that you added to configure the OAuth consent screen, you must also add the scopes to the `appsscript.json` file in your Apps Script project. For example, if you specified the `chat.messages` scope, then add the following: \n\n ```console\n \"oauthScopes\": [\n \"https://www.googleapis.com/auth/chat.messages\"\n ]\n \n ```\n - [Enable](/apps-script/guides/services/advanced#enable_advanced_services) the `Google Workspace Events` advanced service.\n\n### Python\n\n- Python 3.6 or greater\n- The [pip](https://pypi.org/project/pip/) package management tool\n- The latest Google client libraries for Python. To install or update them, run the following command in your command-line interface: \n\n ```console\n pip3 install --upgrade google-api-python-client google-auth-oauthlib\n \n ```\n\n\u003c!-- --\u003e\n\n- \u003cbr /\u003e\n\n A Google Workspace subscription. To create one, see [Create a subscription](/workspace/events/guides/create-subscription).\n\n \u003cbr /\u003e\n\n- Requires [authentication](/workspace/events/guides/auth):\n\n - For user authentication, requires a scope that supports at least one of the event types for the subscription. To identify a scope, see [Scopes by event type](/workspace/events/guides/auth#scopes-event-type). **Note:** To run the code sample in this guide, you must use the same [OAuth\n | client ID credentials](/workspace/events/guides/create-subscription#create-oauth) that you used to create the subscription.\n - For app authentication, requires the `chat.bot` scope (Google Chat apps only).\n\nDelete a subscription authorized by a user\n------------------------------------------\n\nThe following code sample deletes a\n[`Subscription`](/workspace/events/reference/rest/v1/subscriptions) resource\nusing user authentication.\n\nTo delete a subscription: \n\n### Apps Script\n\n1. In your Apps Script project, create a new script file\n named `deleteSubscription` and add the following code:\n\n function deleteSubscription() {\n // The name of the subscription to delete.\n const name = 'subscriptions/\u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e';\n\n // Call the Workspace Events API using the advanced service.\n const response = WorkspaceEvents.Subscriptions.remove(name);\n console.log(response);\n }\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e: The ID of the subscription. To get the ID, you can use any of the following:\n - The value of the [`uid`](/workspace/events/reference/rest/v1/subscriptions#Subscription.FIELDS.uid) field.\n - The ID of the resource name represented in the [`name`](/workspace/events/reference/rest/v1/subscriptions#Subscription.FIELDS.name) field. For example, if the resource name is `subscriptions/subscription-123`, use `subscription-123`.\n2. To delete the subscription, run the function `deleteSubscription` in your\n Apps Script project.\n\n### Python\n\n1. In your working directory, create a file named `delete_subscription.py`\n and add the following code:\n\n \"\"\"Delete subscription.\"\"\"\n\n from google_auth_oauthlib.flow import InstalledAppFlow\n from googleapiclient.discovery import build\n\n # Specify required scopes.\n SCOPES = ['\u003cvar translate=\"no\"\u003eSCOPE\u003c/var\u003e']\n\n # Authenticate with Google Workspace and get user authentication.\n flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)\n CREDENTIALS = flow.run_local_server()\n\n # Call the Workspace Events API using the service endpoint.\n service = build(\n 'workspaceevents',\n 'v1',\n credentials=CREDENTIALS,\n )\n\n NAME = 'subscriptions/\u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e'\n response = service.subscriptions().delete(name=NAME).execute()\n print(response)\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSCOPE\u003c/var\u003e: An OAuth scope that [supports at least\n one event type from the subscription](/workspace/events/guides/auth#scopes-event-type). For example, if your subscription receives events an updated Chat space, `https://www.googleapis.com/auth/chat.spaces.readonly`.\n - \u003cvar translate=\"no\"\u003eSUBSCRIPTION_ID\u003c/var\u003e: The ID of the subscription. To get the ID, you can use any of the following:\n - The value of the [`uid`](/workspace/events/reference/rest/v1/subscriptions#Subscription.FIELDS.uid) field.\n - The ID of the resource name represented in the [`name`](/workspace/events/reference/rest/v1/subscriptions#Subscription.FIELDS.name) field. For example, if the resource name is `subscriptions/subscription-123`, use `subscription-123`.\n2. In your working directory, make sure you've stored your OAuth client ID\n credentials and named the file `credentials.json`. The code sample uses this JSON\n file to authenticate with Google Workspace and get user credentials. For instructions,\n see [Create OAuth client ID\n credentials](/workspace/events/guides/create-subscription#create-oauth).\n\n3. To delete the subscription, run the following in your terminal:\n\n python3 delete_subscription.py\n\nThe Google Workspace Events API returns a [long-running operation](/workspace/events/reference/rest/v1/operations) that contains the instance of the `Subscription` resource.\n\nRelated topics\n--------------\n\n- [Create a subscription](/workspace/events/guides/create-subscription)\n- [Get a subscription](/workspace/events/guides/get-subscription)\n- [List subscriptions](/workspace/events/guides/list-subscriptions)\n- [Update or renew a subscription](/workspace/events/guides/update-subscription)\n- [Resolve errors and reactivate a subscription](/workspace/events/guides/reactivate-subscription)"]]