new_releases Güncellemeler: Yeni özellikler ve ürün güncellemeleri için
sürüm notlarına bakın.
İletileri iptal etme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Temsilciniz, gönderilmiş ancak henüz teslim edilmemiş bir mesajı iptal edebilir. Teslim edilmeyen mesajları eski hale gelmeden önce iptal etmeniz önerilir. Zamanlama, temsilcinizin kullanım alanına bağlıdır. Örneğin, bir OTP mesajını on dakika sonra iptal edebilirken bir promosyon mesajını belirli bir geçerlilik bitiş tarihinde iptal edebilirsiniz. İletilerin zamanında teslim edilmesi için, SMS gibi alternatif bir rota üzerinden gönderebilmeniz amacıyla iletileri zamanında iptal ettiğinizden emin olun.
İletileri geri almanın iki yolu vardır:
İptal işlemini tetiklemek için iptal isteği gönderin. 200 OK yanıtı, mesajın iptal edildiğini ve kullanıcının sırasından silindiğini onaylar. 404 Bulunamadı yanıtı, ileti teslim edildiği için iptal etme girişiminin başarısız olduğu anlamına gelir.
İletiyi uygun zamanda otomatik olarak iptal etmek için ileti geçerlilik bitiş tarihi belirleyin. RBM platformu, mesajın süresi dolduğunda temsilcinizi bilgilendirir ve mesajın başarıyla iptal edilip edilmediğini onaylar. Daha fazla bilgi için Sunucu tarafından oluşturulan etkinlikler başlıklı makaleyi inceleyin.
Nadir durumlarda iptal işlemi başarısız olabilir. Örneğin, aracınız RBM platformu iletiyi teslim etme sürecindeyken iletiyi iptal etmeye çalışabilir. İptal işlemi başarısız olursa webhook'unuzda DELIVERED
etkinliği olup olmadığını kontrol edin. İleti teslim edilmediyse yeni bir iptal isteği gönderebilir ve ardından iletiyi zamanında teslimat için SMS gibi alternatif bir kanala yönlendirebilirsiniz.
Örnek
Aşağıdaki kod, iptal isteği gönderir. Biçimlendirme ve değer bilgileri için phones.agentMessages.delete
konusuna bakın.
cURL
curl -X DELETE "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages/MESSAGE_ID?agentId=AGENT_ID" \
-H "Content-Type: application/json" \
-H "User-Agent: curl/rcs-business-messaging" \
-H "`oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY rcsbusinessmessaging`"
Node.js
// Reference to RBM API helper
const rbmApiHelper = require('@google/rcsbusinessmessaging');
// Stop the message associated with messageId from being delivered
rbmApiHelper.revokeMessage('+12223334444', messageId, function(err, response) {
console.log(response);
});
Bu kod, RBM örnek temsilcisinden alınmıştır.
Java
import com.google.rbm.RbmApiHelper;
…
try {
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper();
// Stop the message associated with messageId from being delivered
rbmApiHelper.revokeMessage(messageId, "+12223334444");
} catch(Exception e) {
e.printStackTrace();
}
Bu kod, RBM örnek temsilcisinden alınmıştır.
Python
# Reference to RBM Python client helper and messaging object structure
from rcs_business_messaging import rbm_service
# Stop the message associated with message_id from being delivered
rbm_service.revoke('+12223334444', message_id)
Bu kod, RBM örnek temsilcisinden alınmıştır.
C#
using RCSBusinessMessaging;
…
// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
projectId);
// Stop the message associated with messageId from being delivered
rbmApiHelper.RevokeMessage(messageId, "+12223334444");
Bu kod, RBM örnek temsilcisinden alınmıştır.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-01 UTC.
[null,null,["Son güncelleme tarihi: 2025-08-01 UTC."],[[["\u003cp\u003eAgents can revoke undelivered messages, with the optimal timing for revocation depending on the message's context, such as revoking an OTP after ten minutes versus a promotional message on a specific date.\u003c/p\u003e\n"],["\u003cp\u003eMessage revocation can be initiated through a revocation request, which triggers a 200 OK response from the RBM platform without guaranteeing successful revocation; success results in the message being deleted from the user's queue.\u003c/p\u003e\n"],["\u003cp\u003eSetting a message expiration time enables automatic revocation, with the RBM platform confirming whether the message was successfully revoked upon expiration.\u003c/p\u003e\n"],["\u003cp\u003eIn the rare event that revocation fails, an agent can check for a \u003ccode\u003eDELIVERED\u003c/code\u003e event and resend a revocation request before routing the message via an alternative channel, like SMS, to ensure delivery.\u003c/p\u003e\n"],["\u003cp\u003eThe code examples show how to revoke a message through a revocation request in cURL, Node.js, Java, Python, and C#, demonstrating the practical application of message revocation.\u003c/p\u003e\n"]]],[],null,["# Revoke messages\n\nYour agent can revoke a message that has been sent but not yet delivered. It's\nbest to revoke undelivered messages before they go stale. The timing depends on\nyour agent's use case. For example, you might revoke an OTP message after ten\nminutes but revoke a promotional message on a specific expiration date. For\ntimely message delivery, be sure to revoke messages in time for you to send them\nby an alternate route like SMS.\n\nThere are two ways to revoke a message:\n\n- [Send a revocation request](/business-communications/rcs-business-messaging/guides/build/messages/revoke#example)\n to trigger the revocation. The 200 OK response confirms that the message was\n revoked and deleted from the user's queue. A 404 Not Found response means\n the revocation attempt has failed because the message was delivered.\n\n- [Set a message expiration](/business-communications/rcs-business-messaging/guides/build/messages/send#expire)\n to automatically revoke the message at the appropriate time. The RBM\n platform notifies your agent when the message has expired and confirms\n whether or not it was successfully revoked. See [Server-generated events](/business-communications/rcs-business-messaging/guides/build/events#server-generated_events)\n for more information.\n\nRevocation could fail on rare occasions. For example, your agent may attempt to\nrevoke a message while the RBM platform is in the process of delivering it. If\nrevocation fails, check for a [`DELIVERED` event](/business-communications/rcs-business-messaging/guides/build/events#delivered)\nat your webhook. If the message hasn't been delivered, you can send a new\n[revocation request](/business-communications/rcs-business-messaging/guides/build/messages/revoke#example)\nand then route the message to an alternate channel like SMS for timely delivery.\n\nExample\n-------\n\nThe following code sends a revocation request. For formatting and value\ninformation, see\n[`phones.agentMessages.delete`](/business-communications/rcs-business-messaging/reference/rest/v1/phones.agentMessages/delete). \n\n### cURL\n\n```console\ncurl -X DELETE \"https://\u003cvar fieldvalues=\"asia,europe,us\" translate=\"no\"\u003eREGION\u003c/var\u003e-rcsbusinessmessaging.googleapis.com/v1/phones/\u003cvar translate=\"no\"\u003ePHONE_NUMBER\u003c/var\u003e/agentMessages/\u003cvar fieldlabel=\"Message ID\" translate=\"no\"\u003eMESSAGE_ID\u003c/var\u003e?agentId=\u003cvar translate=\"no\"\u003eAGENT_ID\u003c/var\u003e\" \\\n-H \"Content-Type: application/json\" \\\n-H \"User-Agent: curl/rcs-business-messaging\" \\\n-H \"`oauth2l header --json \u003cvar translate=\"no\"\u003ePATH_TO_SERVICE_ACCOUNT_KEY\u003c/var\u003e rcsbusinessmessaging`\"\n```\n\n### Node.js\n\n```javascript\n// Reference to RBM API helper\nconst rbmApiHelper = require('@google/rcsbusinessmessaging');\n\n// Stop the message associated with messageId from being delivered\nrbmApiHelper.revokeMessage('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', messageId, function(err, response) {\n console.log(response);\n});\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Java\n\n```java\nimport com.google.rbm.RbmApiHelper;\n...\n\ntry {\n // Create an instance of the RBM API helper\n RbmApiHelper rbmApiHelper = new RbmApiHelper();\n\n // Stop the message associated with messageId from being delivered\n rbmApiHelper.revokeMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n} catch(Exception e) {\n e.printStackTrace();\n}\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### Python\n\n```python\n# Reference to RBM Python client helper and messaging object structure\nfrom rcs_business_messaging import rbm_service\n\n# Stop the message associated with message_id from being delivered\nrbm_service.revoke('\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e', message_id)\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples).\n\n### C#\n\n```c#\nusing RCSBusinessMessaging;\n...\n\n// Create an instance of the RBM API helper\nRbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,\n projectId);\n\n// Stop the message associated with messageId from being delivered\nrbmApiHelper.RevokeMessage(messageId, \"\u003cvar fieldlabel=\"Phone number\" translate=\"no\"\u003e+12223334444\u003c/var\u003e\");\n```\nThis code is an excerpt from an [RBM sample agent](/business-communications/rcs-business-messaging/samples)."]]