RCS for Business temsilcileri, mesaj gönderip alarak kullanıcılarla iletişim kurar. Kullanıcılara mesaj göndermek için temsilciniz, RCS Business Mesajlaşma API'sine mesaj istekleri gönderir. Tek bir istek metin , zengin kartlar , medya ve PDF dosyaları , önerilen yanıtlar ve önerilen eylemler içerebilir.
RCS for Business platformu, mesaj iletimini yönetmenize yardımcı olmak için belirli durumlarda hatalar döndürür:
- RCS'yi desteklemeyen veya RCS'nin etkinleştirilmediği bir cihaza mesaj gönderirseniz, RCS for Business platformu 404 NOT_FOUND hatası döndürür. Bu durumda, altyapınızda tanımlanan yedek yöntemler aracılığıyla kullanıcıya ulaşmayı deneyebilirsiniz.
- Eğer RCS aracınızın henüz başlatılmadığı veya RCS trafiğinin etkinleştirilmediği bir ağdaki bir RCS kullanıcısına mesaj gönderirseniz, RCS for Business platformu 404 NOT_FOUND hatası döndürür.
- Kullanıcının cihazının desteklemediği özelliklere sahip bir mesaj gönderirseniz, RCS for Business platformu 400 INVALID_ARGUMENT hatası döndürür ve mesajınızı iletmez.
Çok kanallı mesajlaşma stratejinizin bir parçası olarak, makul bir süre sonra teslim edilmeyen mesajları iptal edip farklı bir kanal üzerinden göndermek en iyisidir. Mesajları önceden tanımlanmış bir zamanda otomatik olarak iptal etmek için, mesaj son kullanma tarihi belirleyin.
Alıcı çevrimdışı.
RCS for Business platformu, alıcı çevrimdışı olsa bile mesajı teslim etmeyi kabul eder. 200 OK yanıtı alırsınız ve RCS for Business platformu mesajı 30 gün boyunca saklar ve yeniden teslim etmeyi dener. RCS for Business'tan mesajı tekrar göndermesini istemenize gerek yoktur.
RCS for Business, gönderilme tarihinden 30 gün sonra teslim edilmemiş tüm mesajları siler.
Temsilcinizin kullanım senaryosuna bağlı olarak, 30 günlük zaman aşımı süresi dolmadan önce teslim edilmemiş bir mesajı iptal etmek isteyebilirsiniz. İptal işlemi, çevrimdışı kullanıcıların tekrar çevrimiçi olduklarında güncel olmayan bir mesaj almalarını önleyebilir. Bir mesajı iptal etmenin birden fazla yolu vardır:
- İptal işlemini başlatmak için bir iptal talebi gönderin .
- Mesajın geçerlilik süresini ayarlayarak , uygun zamanda mesajın otomatik olarak iptal edilmesini sağlayabilirsiniz.
Mesajın geçerlilik süresinin dolmasını ayarlayın.
Temsilcinizin mesajı zaman açısından hassas mı? Örneğin, OTP'ler yalnızca kısa bir süre için geçerlidir. Sınırlı süreli teklifler sona erer. Ve randevu hatırlatıcıları, randevu tarihinden sonra geçerliliğini yitirir. Mesajların zamanında ve alakalı kalması için bir mesaj son kullanma tarihi belirleyin. Bu, çevrimdışı kullanıcıların tekrar çevrimiçi olduklarında eski içerik almasını önleyebilir. Son kullanma tarihi ayrıca, kullanıcıların ihtiyaç duydukları bilgileri zamanında alabilmeleri için yedek mesajlaşma stratejinizi devreye sokmak için de iyi bir işarettir.
Mesajın geçerlilik süresinin dolmasını ayarlamak için, aracı mesajında aşağıdaki alanlardan birini belirtin:
-
expireTime: Mesajın süresinin dolacağı tam UTC saati. -
ttl(yaşam süresi): Mesajın süresinin dolmasına kadar geçen süre.
Biçimlendirme ve değer seçenekleri için AgentMessage bakın.
ttl ve expireTime için maksimum değer, mesaj gönderildikten sonra 15 gündür .
ttl ve expireTime minimum bir değer olmamakla birlikte, mesaj gönderildikten sonra en az 10 saniye geçmesi, hem iptal hem de teslimat bildirimlerinin alınma olasılığını önemli ölçüde azaltır.
Mesaj için yaşanacak zaman (TTL)
RCS for Business mesajı için bir TTL (Yaşam Süresi) belirlediğinizde, mesajın ne kadar süreyle geçerli ve teslim edilebilir olarak kabul edilmesi gerektiğini belirtirsiniz. Mesaj bu TTL süresi içinde kullanıcının cihazına başarıyla teslim edilmezse, RCS for Business platformu otomatik olarak mesajı iptal etmeye çalışır.
Bir mesaj iptali başlattığınızda, RCS for Business platformundan o belirli mesajın teslimatını durdurmasını talep edersiniz. Ancak bu işlem yalnızca gelecekteki teslimat girişimlerini etkiler. Kullanıcının cihazı mesajı zaten başarıyla almışsa, mesaj işleniyor demektir ve RCS for Business platformu mesajı kullanıcının cihazından iptal edemez.
Bildirimlerle ilgili olarak şunları bekleyebilirsiniz:
TTL süresi içinde iletilen mesaj: Kullanıcının cihazı çevrimiçi olur ve TTL süresi dolmadan önce mesajı alırsa, "
DELIVERED" bildirimi alırsınız. Mesaj başarıyla iletildiği için iptal bildirimi gönderilmez. Bu, en yaygın ve beklenen senaryodur.TTL süresi dolmadan önce mesaj teslim edilmedi: Eğer TTL süresi mesaj kullanıcının cihazına ulaşmadan önce dolarsa (örneğin, cihaz çevrimdışıysa), RCS for Business platformu mesajı iptal etmeye çalışır. Mesajın teslimat kuyruğundan başarıyla kaldırıldığını gösteren bir
TTL_EXPIRATION_REVOKEDbildirimi alırsınız. Bu durumda, kullanıcı mesajı almaz.
Uç durumların ele alınmasına yönelik öneriler
Sistemimiz RCS for Business mesajlarının teslimini ve TTL sürelerinin dolmasını paralel olarak işler. Bu nedenle, çok nadir durumlarda bildirimlerin zamanlamasının beklenmedik olduğu uç durumlarla karşılaşabilirsiniz. Örneğin, hem teslim hem de TTL bildirimi alabilirsiniz veya hiçbirini almayabilirsiniz.
RCS for Business mesaj bildirimlerini yönetmek için önerilerimiz şunlardır:
DELIVEREDbildirimi: Bir mesaj içinDELIVEREDbildirimi alırsanız, mesajın kullanıcıya ulaştığı doğrulanır. Bu mesaj için daha sonraki TTL bildirimlerini güvenle dikkate almayabilirsiniz.TTL_EXPIRATION_REVOKEDbildirimi:TTL_EXPIRATION_REVOKEDdurumunda bir TTL bildirimi alırsanız, bu RCS for Business sisteminin söz konusu mesajın teslimatını denetlemeyi durdurduğu anlamına gelir. Bu mesajı teslim edilmemiş olarak kabul etmeli ve gerekirse yedek stratejinizi uygulamalısınız.Diğer durum kodlu TTL bildirimi: Eğer diğer durum kodlu bir TTL bildirimi alırsanız, bu sonuçsuz bir iptal girişimini gösterir.
- Tek kullanımlık şifreler (OTP'ler) gibi kritik mesajlar için yedek yönteminizi devreye sokun.
- Kritik olmayan mesajlar için yedekleme işleminin başlatılıp başlatılmayacağına karar verin.
- Bildirim yok: Nadir durumlarda, sistem TTL bildirimi göndermekte başarısız olabilir ve istemci de teslimat bildirimi oluşturmakta başarısız olabilir. Bu son derece nadir bir durumdur.
Mesaj trafiği türünü ayarlayın.
RBM API'si, mesajları kategorize etmek için bir messageTrafficType alanı içerir. Ajan kullanım senaryoları hala ajan davranışını ve hangi iş kurallarının uygulanacağını tanımlarken, messageTrafficType mesaj içeriğinin daha ayrıntılı kategorizasyonuna olanak tanır. Sonuç olarak, bu, tek bir ajanın birden fazla kullanım senaryosunu ele almasını mümkün kılar. Şu anda mevcut ajan kullanım senaryoları veya iş kuralları üzerinde herhangi bir etkisi yoktur.
Bu alan isteğe bağlıdır, ancak alan zorunlu hale geldiğinde hata almamak için şimdi ayarlamanız önerilir.
Mesaj trafiği türünü ayarlamak için, her mesajın içeriğine göre uygun messageTrafficType değerini atayın. RCS for Business aşağıdaki trafik türlerini destekler.
| Trafik türü | Mesaj içeriği | Ajan kullanım örneği |
|---|---|---|
AUTHENTICATION | Kimlik doğrulama mesajları için. | OTP |
TRANSACTION | Kullanıcının mevcut hizmetleri veya ürünleriyle ilgili mesajlar için. Örneğin: onaylar, ödeme makbuzları veya rezervasyon detayları. | İşlemsel veya Çok Amaçlı |
PROMOTION | Teklifler, indirimler, duyurular veya diğer tanıtım içerikleri gibi promosyon mesajları için. | Tanıtım amaçlı veya çok amaçlı |
SERVICEREQUEST | Kullanıcının açıkça talep ettiği hizmetlerle ilgili mesajlar için. | OTP, İşlemsel, Tanıtım Amaçlı veya Çok Amaçlı |
ACKNOWLEDGEMENT | Kullanıcının eylemini, özellikle abonelikten çıkma isteğini onaylamak için kullanılan mesajlar. Bu, kullanıcının isteğinin alındığını ve işleme alındığını doğrular. | OTP, İşlemsel, Tanıtım Amaçlı veya Çok Amaçlı |
Herhangi bir trafik türü ayarlanmamışsa, sistem aracının kullanım senaryosuna ilişkin varsayılan türü atar.
| Ajan kullanım örneği | Varsayılan trafik türü |
|---|---|
| OTP | AUTHENTICATION |
| İşlemsel | TRANSACTION |
| Tanıtım amaçlı | PROMOTION |
| Çok amaçlı | MESSAGE_TRAFFIC_TYPE_UNSPECIFIED |
Çok amaçlı aracıların varsayılan trafik türü yoktur. Her mesaj için trafik türünü içeriğine göre açıkça ayarlamanız gerekir. MESSAGE_TRAFFIC_TYPE_UNSPECIFIED değerini değiştirmezseniz hata oluşur.
Mesaj boyutu sınırları
Tüm metin haline getirilmiş AgentMessage'ın maksimum boyutu 250 KB'dir. Mesajın metin kısmı ise 3072 karakterle sınırlıdır.
Kullanıcılar için beklenmedik veri tüketimini önlemek amacıyla, RCS for Business üzerinden gönderilebilecek bir dosyanın maksimum boyutu 100 MiB'dir ve tek bir RCS for Business mesajı içindeki tüm medya ve PDF eklerinin toplam boyutu 100 MiB'yi geçmemelidir (1 MiB = 1.048.576 bayt). Daha fazla bilgi için medya ve PDF dosyalarına bakın.
Metin
En basit mesajlar metinden oluşur. Metin mesajları, görsel, karmaşık etkileşim veya yanıt gerektirmeden bilgi iletmek için en uygun yöntemdir.
Örnek
Aşağıdaki kod düz metin mesajı gönderir. Biçimlendirme ve değer seçenekleri için phones.agentMessages.create yöntemine bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!" }, "messageTrafficType": "PROMOTION" }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); let params = { messageText: 'Hello, world!', msisdn: '+12223334444', }; // Send a simple message to the device rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Send simple text message to user rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444" ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create a simple RBM text message message_text = messages.TextMessage('Hello, world!') # Send text message to the device messages.MessageCluster().append_message(message_text).send_to_msisdn('+12223334444')
C#
using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", );
Temel Mesaj içeriği - SMS'in dönüştürülmesi
Operatörler, SMS mesajlarının RCS for Business'a geçişini desteklemek için faturalandırma modelleri uygulamaya koydu. 160 adede kadar UTF-8 karakter içeren bir RCS for Business mesajına Temel Mesaj denir.
Temel Mesaj gönderme isteği oluştururken, karakterlerin 1 bayt (UTF-8) olarak sayıldığını unutmayın. Emoji veya çok baytlı karakter seti gibi özel karakterler içeren bir mesaj gönderirseniz, her karakter 2-4 UTF-8 karakteri veya daha fazlası olarak sayılır.
Uzunluğunu kontrol etmek için kutuya bir metin girin:
Metin mesajı içeriği ve bağlantı önizlemeleri
RCS istemcileri bağlantı önizlemeleri uygulayabilir. Yalnızca metin içeren bir RCS for Business mesajı, OpenGraph etiketleri içeren bir web sitesinin URL'sini içeriyorsa, istemci bir önizleme (resim, başlık vb.) oluşturarak daha zengin bir deneyim sağlayabilir. Örneğin, URL önizlemesi içeren temel bir mesaja bakın.
RCS istemcisinin kullanıcının bağlantı önizlemelerini devre dışı bırakmasına izin verebileceğini unutmayın.
Kullanıcı doğrulaması için tek kullanımlık şifreler
RCS for Business'ı kullanarak SMS Retriever API'si ile otomatik kullanıcı doğrulaması için tek kullanımlık şifreler (OTP'ler) gönderebilirsiniz. RCS for Business üzerinden gelen OTP'leri okumak için özel bir API bulunmamaktadır.
Android için nasıl çalışır?
SMS Retriever API'sine kayıtlı Android uygulamaları için API, doğru formatlanmış bir RCS for Business mesajını dinler. Bu mesaj hem OTP'yi hem de uygulamanızı tanımlayan benzersiz bir karma kodu içermelidir.
Doğru formatta bir RCS for Business mesajı alındığında, SMS Retriever API'si bunu tıpkı bir SMS OTP'si gibi işler. Karma değer uygulamanızla eşleştirildikten sonra, OTP çıkarılır ve otomatik kullanıcı doğrulaması için uygulamanıza iletilir.
- Kullanıcı doğrulaması için örnek RCS for Business metin mesajı:
Your code is <OTP><app hash>. - Örnek:
Your code is 123456 M8tue43FGT.
SMS Retriever ve ilgili API'ler hakkında daha fazla bilgi edinmek için SMS Retriever dokümantasyonuna bakın. SMS Retriever API'sine kayıtlı uygulamalarda otomatik kullanıcı doğrulaması hakkında ayrıntılı bilgi için bu akış diyagramına bakın.
iOS için nasıl çalışır?
iOS için, sistemin yerleşik OTP işleme özelliği, tıpkı SMS OTP'lerinde olduğu gibi, RCS for Business OTP'lerini otomatik olarak algılar ve otomatik doldurma için önerir. iOS uygulamasının OTP'yi okuması için özel bir API entegrasyonuna gerek yoktur.
Medya ve PDF dosyaları
Resim, video, ses veya PDF dosyası içeren bir mesaj gönderdiğinizde, temsilcinizin içeriğe ait herkese açık bir URL sağlaması veya dosyayı doğrudan yüklemesi gerekir.
Gönderilebilecek dosyanın maksimum boyutu 100 MiB'dir ve tek bir mesaj içindeki tüm medya ve PDF eklerinin toplam boyutu 100 MiB'yi geçmemelidir.
Medya sıkıştırma ve kod dönüştürme
RCS for Business platformu, medya dosyalarını (resimler ve videolar gibi) göndermeden önce otomatik olarak dönüştürür ve sıkıştırır; böylece farklı ağlarda ve cihazlarda hızlı yüklenmelerini ve iyi çalışmalarını sağlar.
Sıkıştırma, dosya boyutu sınırlarından ziyade giriş ortamının kalitesine dayanır. Bu, dosya boyutu 100 MiB'lık maksimum sınırın çok altında olsa bile dosyanın sıkıştırılabileceği anlamına gelir. Kod dönüştürme standartları sürekli değiştiği için, kod dönüştürmenin ne zaman atlanacağını belirleyen sabit bir dosya boyutu sınırı yoktur. Yükleriniz için en uygun dengeyi bulmak için farklı medya formatları, boyutları ve sıkıştırma oranlarıyla denemeler yapın.
Küçük resim özellikleri
Medya dosyaları için, kullanıcıların tıklamadan önce içeriği önizlemesini sağlayan bir küçük resim de belirtebilirsiniz. Ses dosyaları için ise varsayılan ses widget'ı yer tutucu olarak kullanılır.
- Küçük resmin maksimum dosya boyutu 100 kB'dir. En iyi kullanıcı deneyimi için 50 kB veya daha az olmasını öneririz.
- Küçük resmin en boy oranı, orijinal dosyanın oranıyla eşleşmelidir.
Önbellekleme ve URL yönetimi
RCS for Business platformu dosyaları 60 gün boyunca önbelleğe alır ve API, temsilcinizin kullanıcılara gönderdiği mesajlara ekleyebileceği bir dosya kimliği döndürür. 60 gün sonra RCS for Business dosyaları önbellekten kaldırır.
Dosyaları URL ile belirtirken, contentMessage.forceRefresh özelliğini false olarak ayarlamak en iyi uygulamadır. contentMessage.forceRefresh özelliğini true olarak ayarlamak, RCS for Business'ın URL içeriği önbelleğe alınmış olsa bile yeni içeriği belirtilen URL'den almasını zorlar ve bu da kullanıcılar için mesaj teslim sürelerini uzatır.
Dosya URL örneği
Aşağıdaki kod bir resim gönderir. Biçimlendirme ve değer seçenekleri için AgentContentMessage bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "contentInfo": { "fileUrl": "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif", "forceRefresh": false } } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); let params = { fileUrl: 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif', msisdn: '+12223334444', }; // Send an image/video to a device rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.AgentContentMessage; import com.google.api.services.rcsbusinessmessaging.v1.model.AgentMessage; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); String fileUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; // create media only message AgentContentMessage agentContentMessage = new AgentContentMessage(); agentContentMessage.setContentInfo(new ContentInfo().setFileUrl(fileUrl)); // attach content to message AgentMessage agentMessage = new AgentMessage(); agentMessage.setContentMessage(agentContentMessage); rbmApiHelper.sendAgentMessage(agentMessage, "+12223334444"); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create media file attachment file_message = messages.FileMessage('http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif') messages.MessageCluster().append_message(file_message).send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); string fileUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; // Create content info with the file url ContentInfo contentInfo = new ContentInfo { FileUrl = fileUrl }; // Attach content info to a message AgentContentMessage agentContentMessage = new AgentContentMessage { ContentInfo = contentInfo, }; // Attach content to message AgentMessage agentMessage = new AgentMessage { ContentMessage = agentContentMessage }; rbmApiHelper.SendAgentMessage(agentMessage, "+12223334444");
Alternatif olarak, files.create kullanarak mesajda göndermeden önce medyayı yükleyebilirsiniz.
Dosya yükleme örneği
Aşağıdaki kod, bir video dosyası ve bir küçük resim dosyası yükler ve ardından her iki dosyayı da bir mesaj içinde gönderir. Biçimlendirme ve değer seçenekleri için files.create ve AgentContentMessage bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/upload/v1/files?agentId=AGENT_ID" \ -H "Content-Type: video/mp4" \ -H "User-Agent: curl/rcs-business-messaging" \ -H "`oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY rcsbusinessmessaging`" \ --upload-file "FULL_PATH_TO_VIDEO_MEDIA_FILE"# Capture server-specified video file name from response body JSONcurl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/upload/v1/files?agentId=AGENT_ID" \ -H "Content-Type: image/jpeg" \ -H "User-Agent: curl/rcs-business-messaging" \ -H "`oauth2l header --json PATH_TO_SERVICE_ACCOUNT_KEY rcsbusinessmessaging`" \ --upload-file "FULL_PATH_TO_THUMBNAIL_MEDIA_FILE"# Capture server-specified image file name from response body JSONcurl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "uploadedRbmFile": { "fileName": "SERVER-SPECIFIED_VIDEO_FILE_NAME", "thumbnailName": "SERVER-SPECIFIED_THUMBNAIL_FILE_NAME" } } }'
Desteklenen medya türleri
RCS for Business aşağıdaki medya türlerini destekler. Küçük resimler için yalnızca image/jpeg, image/jpg, image/gif ve image/png formatları desteklenmektedir.
| Medya türü | Belge türü | Eklenti | Zengin kartlarla çalışır. |
|---|---|---|---|
| uygulama/ogg | OGG ses dosyası | .ogx | HAYIR |
| uygulama/pdf | Evet (Sadece Hindistan'daki Google Mesajlar için geçerlidir) | ||
| ses/aac | AAC ses | .aac | HAYIR |
| ses/mp3 | MP3 ses dosyası | .mp3 | HAYIR |
| ses/mpeg | MPEG ses | .mpeg | HAYIR |
| ses/mpg | MPG ses | .mp3 | HAYIR |
| ses/mp4 | MP4 ses dosyası | .mp4 | HAYIR |
| ses/mp4-latm | MP4-latm ses | .mp4 | HAYIR |
| ses/3gpp | 3GPP ses | .3gp | HAYIR |
| resim/jpeg | JPEG | .jpeg, .jpg | Evet |
| resim/gif | GIF | .gif | Evet |
| resim/png | PNG | .png | Evet |
| video/h263 | H263 videosu | .h263 | Evet |
| video/m4v | M4V videosu | .m4v | Evet |
| video/mp4 | MP4 video | .mp4 | Evet |
| video/mpeg4 | MPEG-4 video | .mp4, .m4p | Evet |
| video/mpeg | MPEG video | .mpeg | Evet |
| video/webm | WEBM videosu | .webm | Evet |
Öneriler
Temsilciniz , öneri çip listelerinde veya zengin kartlarda öneriler (önerilen yanıtlar ve önerilen eylemler) gönderir.
Önerilen yanıtlar
Önerilen yanıtlar, temsilcinizin nasıl tepki vereceğini bildiği yanıtlar sağlayarak kullanıcılara konuşmalar boyunca yol gösterir.
Kullanıcı önerilen bir yanıta dokunduğunda, temsilciniz yanıtın metnini ve geri gönderme verilerini içeren bir olay alır. Veri yükü en fazla 2048 karakter uzunluğundadır.
Örnek
Aşağıdaki kod, iki önerilen yanıt içeren bir metin gönderir. Biçimlendirme ve değer seçenekleri için SuggestedReply bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "reply": { "text": "Suggestion #1", "postbackData": "suggestion_1" } }, { "reply": { "text": "Suggestion #2", "postbackData": "suggestion_2" } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); let suggestions = [ { reply: { 'text': 'Suggestion #1', 'postbackData': 'suggestion_1', }, }, { reply: { 'text': 'Suggestion #2', 'postbackData': 'suggestion_2', }, }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with suggestion chips to the device rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; import com.google.rbm.SuggestionHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); suggestions.add( new SuggestionHelper("Suggestion #1", "suggestion_1").getSuggestedReply()); suggestions.add( new SuggestionHelper("Suggestion #2", "suggestion_2").getSuggestedReply()); // Send simple text message to user rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggested replies for the message to send to the user cluster.append_suggestion_chip(messages.SuggestedReply('Suggestion #1', 'reply:suggestion_1')) cluster.append_suggestion_chip(messages.SuggestedReply('Suggestion #2', 'reply:suggestion_2')) # Send a simple message with suggestion chips to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); List<Suggestion> suggestions = new List<Suggestion> { // Create suggestion chips new SuggestionHelper("Suggestion #1", "suggestion_1").SuggestedReply(), new SuggestionHelper("Suggestion #2", "suggestion_2").SuggestedReply() }; // Send simple text message with suggestions to user rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Önerilen eylemler
Önerilen eylemler, kullanıcıları cihazlarının yerleşik işlevselliğinden yararlanarak konuşmalar boyunca yönlendirir. Temsilciniz, kullanıcılara bir numara çevirmelerini, haritada bir konum açmalarını, bir konum paylaşmalarını, bir URL açmalarını veya bir takvim etkinliği oluşturmalarını önerebilir.
Önerilen her işlem için isteğe bağlı olarak bir yedek URL (en fazla 2048 karakter) sağlayabilirsiniz. Bu URL, kullanıcının cihazı önerilen işlemi desteklemiyorsa yeni bir tarayıcı penceresinde açılır.
Kullanıcı önerilen bir eyleme dokunduğunda, aracınız eylemin geri gönderme verilerini içeren bir olay alır.
Biçimlendirme ve değer seçenekleri için SuggestedAction bakın.
Öneri ekranı
Önerileri görüntülemenin iki yolu vardır:
- Kalıcı : Mesaj balonu içinde görüntülenen ve konuşma boyunca sabit kalan önerilen eylemler veya yanıtlar.
- Geçici : Mesaj balonunun dışında görüntülenen ve konuşma devam ettiğinde kaybolan öneriler.
Desteklenen mesaj formatları
- Kalıcı öneriler: Bağımsız metin mesajları ve zengin kartlarla çalışın.
- Geçici öneriler: Bağımsız metin mesajları, medya mesajları ve zengin kartlarla çalışın.
Önerileri birleştirin
Aynı mesajda veya zengin kartta kalıcı ve geçici önerileri bir arada kullanabilirsiniz.
- Metin mesajları: Öneriler varsayılan olarak geçicidir. Bunların kalıcı olmasını sağlamak için, onları kalıcı olarak yapılandırmanız gerekir.
- Zengin kartlar: Bunlar varsayılan olarak en fazla dört kalıcı öneriyi destekler. Daha sonra kartın altına "çip listesi" olarak geçici öneriler ekleyebilirsiniz.
Öneri sınırları
Tek bir metin mesajı toplamda en fazla 11 öneriyi destekler. Eklediğiniz kalıcı öneriler bu toplam sınıra dahildir. Örneğin, 4 kalıcı öneri eklerseniz, en fazla 7 geçici öneri ekleyebilirsiniz.
| Öneri türü | Sınır | Göründükleri yerler |
|---|---|---|
| Israrcı | 4'e kadar | Mesaj balonunun içinde |
| Geçici | 11'e kadar | Balonun dışında (cips olarak) |
Karakter sınırı
Her öneri en fazla 25 karakter uzunluğunda olabilir.
Önerilen eylemlerde URL şeffaflığı
Kullanıcı güvenini oluşturmak için, "URL aç" önerilen eylemleri için öneri düğmesinin içinde ikinci bir metin satırı olarak temel URL görüntülenir. Bu tutarlı davranış, bağımsız metin mesajlarında, zengin kartlarda ve slayt gösterilerinde geçerlidir.
Sürekli önerileri için müşterilere destek sağlandı.
- Desteklenen uygulama: Google Mesajlar (sürüm
20260225.00veya üzeri). - Desteklenmeyen uygulamalar: Google Mesajlar'ın
20260225.00önceki sürümleri, iOS ve Samsung Mesajlar.
Bir numara çevirin
Arama işlemi, kullanıcının temsilciniz tarafından belirtilen bir telefon numarasını aramasını sağlar. Telefon numaraları yalnızca rakamlar ( 0-9 ), artı işareti ( + ), yıldız işareti ( * ) ve sayı işareti ( # ) içerebilir. E.164 uluslararası formatı (örneğin, +14155555555 ) desteklenir ancak zorunlu değildir. Yani, hem +14155555555 hem de 1011 geçerli girişlerdir.
Örnek
Aşağıdaki kod bir arama işlemi gönderir. Biçimlendirme ve değer seçenekleri için DialAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "Call", "postbackData": "postback_data_1234", "fallbackUrl": "https://www.google.com/contact/", "dialAction": { "phoneNumber": "+15556667777" } } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Define a dial suggested action let suggestions = [ { action: { text: 'Call', postbackData: 'postback_data_1234', dialAction: { phoneNumber: '+15556667777' } } }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with a dial suggested action rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.DialAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // creating a dial suggested action DialAction dialAction = new DialAction(); dialAction.setPhoneNumber("+15556667777"); // creating a suggested action based on a dial action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setText("Call"); suggestedAction.setPostbackData("postback_data_1234"); suggestedAction.setDialAction(dialAction); // attaching action to a suggestion Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); suggestions.add(suggestion); // Send simple text message with the suggestion action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create a dial suggested action suggestions = [ messages.DialAction('Call', 'reply:postback_data_1234', '+15556667777') ] # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggestions for the message to send to the user for suggestion in suggestions: cluster.append_suggestion_chip(suggestion) # Send a simple message with suggested action to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // Create a dial an agent suggested action DialAction dialAction = new DialAction { PhoneNumber = "+15556667777" }; // Creating a suggested action based on a dial action SuggestedAction suggestedAction = new SuggestedAction { Text = "Call", PostbackData = "postback_data_1234", DialAction = dialAction }; // Attach action to a suggestion Suggestion suggestion = new Suggestion { Action = suggestedAction }; List<Suggestion> suggestions = new List<Suggestion> { suggestion }; rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Bir konumu görüntüle
"Konumu Görüntüle" eylemi, kullanıcının varsayılan harita uygulamasında bir konum görüntüler. Konumu enlem ve boylam ile veya kullanıcının mevcut konumuna dayalı bir sorgu ile belirtebilirsiniz. Ayrıca harita uygulamasında görüntülenen işaretleyici için özel bir etiket de ayarlayabilirsiniz.
Örnek
Aşağıdaki kod bir konum görüntüleme eylemi gönderir. Biçimlendirme ve değer seçenekleri için ViewLocationAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "View map", "postbackData": "postback_data_1234", "fallbackUrl": "https://www.google.com/maps/@37.4220188,-122.0844786,15z", "viewLocationAction": { "latLong": { "latitude": "37.4220188", "longitude": "-122.0844786" }, "label": "Googleplex" } } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Define a view location suggested action let suggestions = [ { action: { text: 'View map', postbackData: 'postback_data_1234', viewLocationAction: { latLong: { latitude: 37.4220188, longitude: -122.0844786 }, label: 'Googleplex' } } }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with a view location suggested action rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.ViewLocationAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // creating a view location suggested action ViewLocationAction viewLocationAction = new ViewLocationAction(); viewLocationAction.setQuery("Googleplex, Mountain View, CA"); // creating a suggested action based on a view location action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setText("View map"); suggestedAction.setPostbackData("postback_data_1234"); suggestedAction.setViewLocationAction(viewLocationAction); // attaching action to a suggestion Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); suggestions.add(suggestion); // Send simple text message with the suggestion action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create a view location suggested action suggestions = [ messages.ViewLocationAction('View map', 'reply:postback_data_1234', query='Googleplex, Mountain View, CA') ] # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggestions for the message to send to the user for suggestion in suggestions: cluster.append_suggestion_chip(suggestion) # Send a simple message with suggested action to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // create an view location action ViewLocationAction viewLocationAction = new ViewLocationAction { Query = "Googleplex Mountain View, CA" }; // Attach the view location action to a suggested action SuggestedAction suggestedAction = new SuggestedAction { ViewLocationAction = viewLocationAction, Text = "View map", PostbackData = "postback_data_1234" }; // Attach the action to a suggestion object Suggestion suggestion = new Suggestion { Action = suggestedAction }; List<Suggestion> suggestions = new List<Suggestion> { suggestion }; rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Konum paylaş
Konum Paylaşma özelliği, kullanıcının konumunu temsilcinizle paylaşmasına olanak tanır. Kullanıcı, mevcut konumunu veya Haritalar uygulamasından manuel olarak seçtiği bir konumu paylaşabilir.
Örnek
Aşağıdaki kod, konum paylaşma eylemini gönderir. Biçimlendirme ve değer seçenekleri için ShareLocationAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "Share your location", "postbackData": "postback_data_1234", "shareLocationAction": {} } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Define a share location suggested action let suggestions = [ { action: { text: 'Share your location', postbackData: 'postback_data_1234', shareLocationAction: { } } }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with a share location suggested action rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.ShareLocationAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // creating a share location suggested action ShareLocationAction shareLocationAction = new ShareLocationAction(); // creating a suggested action based on a share location action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setText("Share location"); suggestedAction.setPostbackData("postback_data_1234"); suggestedAction.setShareLocationAction(shareLocationAction); // attaching action to a suggestion Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); suggestions.add(suggestion); // Send simple text message with the suggestion action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create a share location suggested action suggestions = [ messages.ShareLocationAction('Share location', 'reply:postback_data_1234') ] # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggestions for the message to send to the user for suggestion in suggestions: cluster.append_suggestion_chip(suggestion) # Send a simple message with suggested action to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // Create a share location action ShareLocationAction shareLocationAction = new ShareLocationAction(); // Attach the share location action to a suggested action SuggestedAction suggestedAction = new SuggestedAction { ShareLocationAction = shareLocationAction, Text = "Share location", PostbackData = "postback_data_1234" }; // Attach the action to a suggestion object Suggestion suggestion = new Suggestion { Action = suggestedAction }; List<Suggestion> suggestions = new List<Suggestion> { suggestion }; rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Bir URL açın
URL Açma eylemi, kullanıcıları aracınız tarafından belirtilen bir web sayfasına yönlendirmenizi sağlar. Varsayılan olarak, web sayfası kullanıcının tarayıcısında açılır. Web sayfasının bir web görünümünde açılmasını da ayarlayabilirsiniz. Ayrıntılar için Web görünümüyle URL açma bölümüne bakın.
Yalnızca Google Mesajlar'da
Altta yatan URL'nin görüntülenmesi : A2P mesajlaşmasında şeffaflığı artırmak için Google Mesajlar, 'URL aç' önerilen eylemlerinde altta yatan URL adresini görüntüler. Bu değişiklik, standart zengin kartlardaki ve zengin kart karusellerindeki önerilen eylemleri etkiler.

Web bağlantıları için uygulama simgesi görüntüleme : Kullanıcının web sayfası için yapılandırılmış varsayılan bir uygulaması varsa, tarayıcı veya web görünümü yerine bu uygulama açılır ve öneri düğmesi uygulamanın simgesini gösterir. Google Mesajlar'da uygulama simgesinin görünmesi için tam ve doğrudan URL'yi sağlamanız gerekir. Kısaltılmış bir URL kullanırsanız, bunun yerine varsayılan "URL'yi Aç" simgesi görüntülenir.

Örnek
Aşağıdaki kod bir URL açma eylemi gönderir. Biçimlendirme ve değer seçenekleri için OpenUrlAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "Open Google", "postbackData": "postback_data_1234", "openUrlAction": { "url": "https://www.google.com" } } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Define an open URL suggested action let suggestions = [ { action: { text: 'Open Google', postbackData: 'postback_data_1234', openUrlAction: { url: 'https://www.google.com' } } }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with an open URL suggested action rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.OpenUrlAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // creating an open url suggested action OpenUrlAction openUrlAction = new OpenUrlAction(); openUrlAction.setUrl("https://www.google.com"); // creating a suggested action based on an open url action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setText("Open Google"); suggestedAction.setPostbackData("postback_data_1234"); suggestedAction.setOpenUrlAction(openUrlAction); // attaching action to a suggestion Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); suggestions.add(suggestion); // Send simple text message with the suggestion action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create an open url suggested action suggestions = [ messages.OpenUrlAction('Open Google', 'reply:postback_data_1234', 'https://www.google.com') ] # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggestions for the message to send to the user for suggestion in suggestions: cluster.append_suggestion_chip(suggestion) # Send a simple message with suggested action to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // Create an open url action OpenUrlAction openUrlAction = new OpenUrlAction { Url = "https://www.google.com" }; // Attach the open url action to a suggested action SuggestedAction suggestedAction = new SuggestedAction { OpenUrlAction = openUrlAction, Text = "Open Google", PostbackData = "postback_data_1234" }; // Attach the action to a suggestion object Suggestion suggestion = new Suggestion { Action = suggestedAction }; List<Suggestion> suggestions = new List<Suggestion> { suggestion }; rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Webview ile bir URL açın
"Web görünümüyle URL aç" eylemi, belirtilen web sayfasını varsayılan tarayıcınızın oluşturma motoruyla mesajlaşma uygulaması içinde yükler. Bu, kullanıcının RCS for Business görüşmesinden ayrılmadan web sayfasıyla etkileşim kurmasına olanak tanır. Kullanıcının cihazı web görünümlerini desteklemiyorsa, web sayfası bunun yerine kullanıcının tarayıcısında açılır. Web görünümlerini etkinleştirmek için bkz. OpenURLApplication .
Web görünümlerinin üç görüntüleme modu vardır. Biçimlendirme ve değer seçenekleri için WebviewViewMode bakın.
- Tam ekran: Web sayfası ekranın tamamını kaplar.
- Yarısı: Web sayfası ekranın yarısını kaplıyor.
- Uzun: Web sayfası ekranın dörtte üçünü kaplıyor.
Örnek
Aşağıdaki kod, webview ile URL açma eylemini gönderir. Biçimlendirme ve değer seçenekleri için OpenURLAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "Open Google", "postbackData": "postback_data_1234", "openUrlAction": { "url": "https://www.google.com", "application": "WEBVIEW", "webviewViewMode": "FULL", "description": "Accessibility description" } } } ] } }'
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.OpenUrlAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { String URL = "https://www.google.com"; // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // Create suggestion to view webpage in full mode Suggestion viewInFullMode = getUrlActionInWebview(URL, "FULL") suggestions.add(viewInFullMode); // create suggestion to view webpage in half mode Suggestion viewInHalfMode = getUrlActionInWebview(URL, "HALF") suggestions.add(viewInHalfMode); // create suggestion to view webpage in tall mode Suggestion viewInTallMode = getUrlActionInWebview(URL, "TALL") suggestions.add(viewInTallMode); // Send simple text message with the suggested action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); } /** * Creates a suggested action to open URL in webview. * * @return a suggestion object for an open URL in webview action . */ private Suggestion getUrlActionInWebview(String url, String viewMode) { // create an open url action OpenUrlAction openUrlAction = new OpenUrlAction(); openUrlAction.setUrl(url); openUrlAction.setApplication("WEBVIEW"); openUrlAction.setWebviewViewMode(viewMode); openUrlAction.setDescription("Accessibility description"); // attach the open url action to a suggested action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setOpenUrlAction(openUrlAction); suggestedAction.setText('display_text'); suggestedAction.setPostbackData('postback_data_123'); // attach the action to a suggestion object Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); return suggestion; }
Takvim etkinliği oluştur
"Takvim etkinliği oluştur" eylemi, kullanıcının takvim uygulamasını açar ve belirtilen bilgilerle yeni bir etkinlik oluşturmaya başlar.
Takvim etkinliği başlığı zorunludur. En fazla 100 karakter uzunluğundadır. Takvim etkinliği açıklaması isteğe bağlıdır ve en fazla 500 karakter uzunluğundadır.
Örnek
Aşağıdaki kod, takvim etkinliği oluşturma eylemini gönderir. Biçimlendirme ve değer seçenekleri için CreateCalendarEventAction bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "text": "Hello, world!", "suggestions": [ { "action": { "text": "Save to calendar", "postbackData": "postback_data_1234", "fallbackUrl": "https://www.google.com/calendar", "createCalendarEventAction": { "startTime": "2020-06-30T19:00:00Z", "endTime": "2020-06-30T20:00:00Z", "title": "My calendar event", "description": "Description of the calendar event" } } } ] } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Define a create calendar event suggested action let suggestions = [ { action: { text: 'Save to calendar', postbackData: 'postback_data_1234', createCalendarEventAction: { startTime: '2020-06-30T19:00:00Z', endTime: '2020-06-30T20:00:00Z', title: 'My calendar event', description: 'Description of the calendar event', }, } }, ]; let params = { messageText: 'Hello, world!', msisdn: '+12223334444', suggestions: suggestions, }; // Send a simple message with a create calendar event suggested action rbmApiHelper.sendMessage(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.CreateCalendarEventAction; import com.google.api.services.rcsbusinessmessaging.v1.model.SuggestedAction; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.RbmApiHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); // creating a create calendar event suggested action CreateCalendarEventAction createCalendarEventAction = new CreateCalendarEventAction(); calendarEventAction.setTitle("My calendar event"); calendarEventAction.setDescription("Description of the calendar event"); calendarEventAction.setStartTime("2020-06-30T19:00:00Z"); calendarEventAction.setEndTime("2020-06-30T20:00:00Z"); // creating a suggested action based on a create calendar event action SuggestedAction suggestedAction = new SuggestedAction(); suggestedAction.setText("Save to calendar"); suggestedAction.setPostbackData("postback_data_1234"); suggestedAction.setCreateCalendarEventAction(createCalendarEventAction); // attaching action to a suggestion Suggestion suggestion = new Suggestion(); suggestion.setAction(suggestedAction); suggestions.add(suggestion); // Send simple text message with the suggestion action rbmApiHelper.sendTextMessage( "Hello, world!", "+12223334444", suggestions ); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Create a calendar event suggested action suggestions = [ messages.CreateCalendarEventAction('Save to Calendar', 'reply:postback_data_1234', '2020-06-30T19:00:00Z', '2020-06-30T20:00:00Z', 'My calendar event', 'Description of the calendar event') ] # Create text message to send to user text_msg = messages.TextMessage('Hello, world!') cluster = messages.MessageCluster().append_message(text_msg) # Append suggestions for the message to send to the user for suggestion in suggestions: cluster.append_suggestion_chip(suggestion) # Send a simple message with suggested action to the device cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // Create a calendar event action CreateCalendarEventAction calendarEventAction = new CreateCalendarEventAction { Title = "My calendar event", Description = "Description of the calendar event", StartTime = "2020-06-30T19:00:00Z", EndTime = "2020-06-30T20:00:00Z" }; // Attach the calendar event action to a suggested action SuggestedAction suggestedAction = new SuggestedAction { CreateCalendarEventAction = calendarEventAction, Text = "Save to calendar", PostbackData = "postback_data_1234" }; // Attach the action to a suggestion object Suggestion suggestion = new Suggestion { Action = suggestedAction }; List<Suggestion> suggestions = new List<Suggestion> { suggestion }; rbmApiHelper.SendTextMessage( "Hello, world!", "+12223334444", suggestions );
Öneri çip listesi
Temsilciniz, kullanıcıların sonraki eylemlerine rehberlik etmek için mesajlarla birlikte öneri çip listeleri gönderir. Çip listesi yalnızca ilgili mesaj konuşmanın en altında olduğunda görüntülenir. Konuşmadaki sonraki tüm mesajlar (kullanıcıdan veya temsilcinizden) çip listesinin üzerine yazılır.
Listedeki simgeler , önerilen yanıtlar ve önerilen eylemlerdir .
Çip listeleri en fazla 11 öneri çipi içerebilir ve her çip etiketi en fazla 25 karakter içerebilir.
Biçimlendirme ve değer seçenekleri için AgentContentMessage bakın.
Zengin kartlar
Zengin kartlar, medyayı, metni ve etkileşimli önerileri tek bir mesajda birleştirir. İlgili bilgileri (örneğin, bir ürünün görseli, adı ve fiyatı) sunmak ve kullanıcılara "Detayları görüntüle" önerisi gibi net bir sonraki adımla yönlendirmek için idealdirler.
Zengin içerikli bir kart şunları içerebilir:
- Medya (resim, GIF veya video)
- Başlık metni
- Açıklama metni
- Önerilen yanıtlar ve önerilen eylemler (en fazla 4)
Bu alanların her biri isteğe bağlıdır, ancak 1-3 arasındaki alanlardan en az birinin zenginleştirilmiş kartta yer alması gerekir.
Birden fazla kart, yatay olarak kaydırılan bir döner menüde birlikte gönderilebilir.
Zengin özelliklere sahip bir kart için toplam veri yükünün 250 KB olduğunu unutmayın.
Tüm teknik detaylar için Zengin kartlar dokümanına bakın.
Kart yüksekliği
Zengin içerikli kartlar, içeriklerine uyacak şekilde dikey olarak genişler. Minimum yükseklikleri 112 DP, maksimum yükseklikleri ise 344 DP'dir. Kart içeriği minimum kart yüksekliğini dolduracak kadar büyük değilse, kart genişler ve fazladan yüksekliği boşlukla doldurur.
Zengin içerikli kartlardaki medya öğelerinin üç yükseklikten birine uyması gerekir:
- Kısa: 112 DP
- Orta: 168 DP
- Uzun: 264 DP
Seçilen yüksekliğe göre medya kart içindeki boyutlara uymuyorsa, medya önizlemesi yakınlaştırılıp kırpılarak seçilir.
Örnek
Aşağıdaki kod, bir resim ve önerilen yanıtlar içeren zenginleştirilmiş bir kart gönderir. Biçimlendirme ve değer seçenekleri için RichCard bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "richCard": { "standaloneCard": { "thumbnailImageAlignment": "RIGHT", "cardOrientation": "VERTICAL", "cardContent": { "title": "Hello, world!", "description": "RBM is awesome!", "media": { "height": "TALL", "contentInfo":{ "fileUrl": "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif", "forceRefresh": false } }, "suggestions": [ { "reply": { "text": "Suggestion #1", "postbackData": "suggestion_1" } }, { "reply": { "text": "Suggestion #2", "postbackData": "suggestion_2" } } ] } } } } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Suggested replies to be used in the card let suggestions = [ { reply: { 'text': 'Suggestion #1', 'postbackData': 'suggestion_1', }, }, { reply: { 'text': 'Suggestion #2', 'postbackData': 'suggestion_2', }, }, ]; // Image to be displayed by the card let imageUrl = 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif'; // Definition of the card parameters let params = { messageText: 'Hello, world!', messageDescription: 'RBM is awesome!', msisdn: '+12223334444', suggestions: suggestions, imageUrl: imageUrl, height: 'TALL', }; // Send rich card to device rbmApiHelper.sendRichCard(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.StandaloneCard; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.cards.CardOrientation; import com.google.rbm.cards.MediaHeight; import com.google.rbm.RbmApiHelper; import com.google.rbm.SuggestionHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); // Create suggestions for chip list List<Suggestion> suggestions = new ArrayList<Suggestion>(); suggestions.add( new SuggestionHelper("Suggestion #1", "suggestion_1").getSuggestedReply()); suggestions.add( new SuggestionHelper("Suggestion #2", "suggestion_2").getSuggestedReply()); String imageUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; // Create a standalone rich card to send to the user StandaloneCard standaloneCard = rbmApiHelper.createStandaloneCard( "Hello, world!", "RBM is awesome!", imageUrl, MediaHeight.MEDIUM, CardOrientation.VERTICAL, suggestions ); rbmApiHelper.sendStandaloneCard(standaloneCard, "+12223334444"); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Suggested replies to be used in the card suggestions = [ messages.SuggestedReply('Suggestion #1', 'reply:suggestion_1'), messages.SuggestedReply('Suggestion #2', 'reply:suggestion_2') ] # Image to be displayed by the card image_url = 'http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif'; # Define rich card structure rich_card = messages.StandaloneCard('VERTICAL', 'Hello, world!', 'RBM is awesome!', suggestions, image_url, None, None, 'MEDIUM') # Append rich card and send to the user cluster = messages.MessageCluster().append_message(rich_card) cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; using RCSBusinessMessaging.Cards; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); List<Suggestion> suggestions = new List<Suggestion> { // Create suggestion chips new SuggestionHelper("Suggestion #1", "suggestion_1").SuggestedReply(), new SuggestionHelper("Suggestion #2", "suggestion_2").SuggestedReply() }; string imageUrl = "http://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; // Create rich card with suggestions StandaloneCard standaloneCard = rbmApiHelper.CreateStandaloneCard( "Hello, world!", "RBM is awesome", imageUrl, MediaHeight.TALL, CardOrientation.VERTICAL, suggestions ); // Send rich card to user rbmApiHelper.SendStandaloneCard(standaloneCard, "+12223334444");
Zengin kartlı döner kartlar
Dönen kartlar (carousel), birden fazla zengin kartı bir araya getirerek kullanıcıların öğeleri karşılaştırmasına ve her birine ayrı ayrı tepki vermesine olanak tanır.
Döndürme slaytları en az iki ve en fazla on zengin kart içerebilir. Döndürme slaytları içindeki zengin kartlar, Zengin kartlar dokümanında açıklanan içerik ve yükseklik açısından genel zengin kart gereksinimlerine uymalıdır. Döndürme slaytı düzeni ve özellikleri hakkında daha fazla bilgi için Döndürme slaytı dokümanına bakın.
Örnek
Aşağıdaki kod zengin içerikli bir kart döngüsü gönderir. Biçimlendirme ve değer seçenekleri için RichCard bakın.
cURL
curl -X POST "https://REGION-rcsbusinessmessaging.googleapis.com/v1/phones/PHONE_NUMBER/agentMessages?messageId=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`" \ -d '{ "contentMessage": { "richCard": { "carouselCard": { "cardWidth": "MEDIUM", "cardContents": [ { "title": "Card #1", "description": "The description for card #1", "suggestions": [ { "reply": { "text": "Card #1", "postbackData": "card_1" } } ], "media": { "height": "MEDIUM", "contentInfo": { "fileUrl": "https://storage.googleapis.com/welcome-bot-sample-images/200.jpg", "forceRefresh": false } } }, { "title": "Card #2", "description": "The description for card #2", "suggestions": [ { "reply": { "text": "Card #2", "postbackData": "card_2" } } ], "media": { "height": "MEDIUM", "contentInfo": { "fileUrl": "https://storage.googleapis.com/welcome-bot-sample-images/201.jpg", "forceRefresh": false } } } ] } } } }'
Node.js
// Reference to RBM API helper const rbmApiHelper = require('@google/rcsbusinessmessaging'); // Images for the carousel cards let card1Image = 'https://storage.googleapis.com/welcome-bot-sample-images/200.jpg'; let card2Image = 'https://storage.googleapis.com/welcome-bot-sample-images/201.jpg'; // Define the card contents for a carousel with two cards, each with one suggested reply let cardContents = [ { title: 'Card #1', description: 'The description for card #1', suggestions: [ { reply: { text: 'Card #1', postbackData: 'card_1', } } ], media: { height: 'MEDIUM', contentInfo: { fileUrl: card1Image, forceRefresh: false, }, }, }, { title: 'Card #2', description: 'The description for card #2', suggestions: [ { reply: { text: 'Card #2', postbackData: 'card_2', } } ], media: { height: 'MEDIUM', contentInfo: { fileUrl: card2Image, forceRefresh: false, }, }, }, ]; // Definition of carousel card let params = { msisdn: '+12223334444', cardContents: cardContents, }; // Send the device the carousel card defined above rbmApiHelper.sendCarouselCard(params, function(response) { console.log(response); });
Java
import com.google.api.services.rcsbusinessmessaging.v1.model.CardContent; import com.google.api.services.rcsbusinessmessaging.v1.model.Suggestion; import com.google.rbm.cards.CardOrientation; import com.google.rbm.cards.CardWidth; import com.google.rbm.cards.MediaHeight; import com.google.rbm.RbmApiHelper; import com.google.rbm.SuggestionHelper; … try { // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(); List cardContents = new ArrayList(); // Images for the carousel cards String card1Image = "https://storage.googleapis.com/welcome-bot-sample-images/200.jpg"; // Create suggestions for first carousel card List card1Suggestions = new ArrayList(); card1Suggestions.add( new SuggestionHelper("Card #1", "card_1")); cardContents.add( new StandaloneCardHelper( "Card #1", "The description for card #1", card1Image, card1Suggestions) .getCardContent(MediaHeight.SHORT) ); // Images for the carousel cards String card2Image = "https://storage.googleapis.com/welcome-bot-sample-images/201.jpg"; // Create suggestions for second carousel card List card2Suggestions = new ArrayList(); card2Suggestions.add( new SuggestionHelper("Card #2", "card_2")); cardContents.add( new StandaloneCardHelper( "Card #2", "The description for card #2", card2Image, card2Suggestions) .getCardContent(MediaHeight.SHORT) ); // Send the carousel to the user rbmApiHelper.sendCarouselCards(cardContents, CardWidth.MEDIUM, "+12223334444"); } catch(Exception e) { e.printStackTrace(); }
Python
# Reference to RBM Python client helper and messaging object structure from rcs_business_messaging import rbm_service from rcs_business_messaging import messages # Images for the carousel cards card_image_1 = 'https://storage.googleapis.com/welcome-bot-sample-images/200.jpg'; card_image_2 = 'https://storage.googleapis.com/welcome-bot-sample-images/201.jpg'; # Suggested replies to be used in the cards suggestions1 = [ messages.SuggestedReply('Card #1', 'reply:card_1') ] suggestions2 = [ messages.SuggestedReply('Card #2', 'reply:card_2') ] # Define the card contents for a carousel with two cards, # each with one suggested reply card_contents = [] card_contents.append(messages.CardContent('Card #1', 'The description for card #1', card_image_1, 'MEDIUM', suggestions1)) card_contents.append(messages.CardContent('Card #2', 'The description for card #2', card_image_2, 'MEDIUM', suggestions2)) # Send the device the carousel card defined above carousel_card = messages.CarouselCard('MEDIUM', card_contents) cluster = messages.MessageCluster().append_message(carousel_card) cluster.send_to_msisdn('+12223334444')
C#
using Google.Apis.RCSBusinessMessaging.v1.Data; using RCSBusinessMessaging; using RCSBusinessMessaging.Cards; … // Create an instance of the RBM API helper RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation, projectId); // Image references to be used in the carousel cards string card1Image = "https://storage.googleapis.com/welcome-bot-sample-images/200.jpg"; string card2Image = "https://storage.googleapis.com/welcome-bot-sample-images/201.jpg"; // Suggestion chip lists to be used in carousel cards List<Suggestion> suggestions1 = new List<Suggestion> { new SuggestionHelper("Card #1", "card_1").SuggestedReply() }; List<Suggestion> suggestions2 = new List<Suggestion> { new SuggestionHelper("Card #2", "card_2").SuggestedReply() }; // Create the card content for the carousel List<CardContent> cardContents = new List<CardContent> { // Add items as card content new StandaloneCardHelper( "Card #1", "The description for card #1", card1Image, suggestions1).GetCardContent(), new StandaloneCardHelper( "Card #2", "The description for card #2", card2Image, suggestions2).GetCardContent() }; // Send the carousel to the user rbmApiHelper.SendCarouselCards(cardContents, CardWidth.MEDIUM, msisdn);