메시지 보내기

비즈니스용 RCS 에이전트는 메시지를 주고받아 사용자와 소통합니다. 사용자에게 메시지를 보내기 위해 에이전트는 RCS Business Messaging API에 메시지 요청을 보냅니다. 단일 요청에는 텍스트, 리치 카드, 미디어 및 PDF 파일, 추천 답장, 추천 작업이 포함될 수 있습니다.

비즈니스용 RCS 플랫폼은 메시지 전송을 관리하는 데 도움이 되도록 특정 상황에서 오류를 반환합니다.

  • 기기에서 RCS를 지원하지 않거나 RCS가 사용 설정되지 않은 사용자에게 메시지를 보내면 비즈니스용 RCS 플랫폼에서 404 NOT_FOUND 오류를 반환합니다. 이 경우 인프라에 정의된 대체 방법을 통해 사용자에게 도달할 수 있습니다.
  • 에이전트가 아직 실행되지 않은 네트워크 또는 RCS 트래픽을 사용 설정하지 않은 네트워크에서 RCS 사용자에게 메시지를 보내면 비즈니스용 RCS 플랫폼에서 404 NOT_FOUND 오류를 반환합니다.
  • 사용자의 기기에서 지원하지 않는 기능이 포함된 메시지를 보내면 비즈니스용 RCS 플랫폼에서 400 INVALID_ARGUMENT 오류를 반환하고 메시지를 전송하지 않습니다.

다중 채널 메시지 전략의 일환으로 적절한 시간 후에 전송되지 않은 메시지를 취소하고 다른 채널을 통해 전송하는 것이 좋습니다. 사전 정의된 시간에 메시지를 자동으로 취소하려면 메시지 만료를 설정합니다.

수신자가 오프라인 상태임

비즈니스용 RCS 플랫폼은 수신자가 오프라인 상태인 경우에도 전송할 메시지를 수락합니다. 200 OK 응답을 수신하고 비즈니스용 RCS 플랫폼은 메시지를 보관하고 30일 동안 재전송을 시도합니다. 비즈니스용 RCS에 메시지를 다시 보내달라고 요청할 필요가 없습니다.

비즈니스용 RCS는 제출 후 30일이 지나면 전송되지 않은 메시지를 삭제합니다.

에이전트의 사용 사례에 따라 이 30일 제한 시간 전에 전송되지 않은 메시지를 취소할 수 있습니다. 취소를 사용하면 오프라인 사용자가 다시 온라인 상태가 되었을 때 오래된 메시지를 받지 않도록 할 수 있습니다. 메시지를 취소하는 방법에는 여러 가지가 있습니다.

메일 만료 설정

에이전트의 메시지가 시간에 민감한가요? 예를 들어 OTP는 짧은 기간 동안만 유효합니다. 기간 한정 혜택이 만료됩니다. 약속 알림은 약속 날짜가 지나면 관련성이 없어집니다. 메시지를 시의적절하고 관련성 있게 유지하려면 메시지 만료를 설정하세요. 이렇게 하면 오프라인 사용자가 다시 온라인 상태가 될 때 오래된 콘텐츠를 수신하지 못하게 할 수 있습니다. 만료는 대체 메시지 전략을 호출하여 사용자가 필요한 정보를 제때 받을 수 있도록 하는 좋은 신호이기도 합니다.

메시지 만료를 설정하려면 에이전트 메시지에서 다음 필드 중 하나를 지정합니다.

  • expireTime: 메시지가 만료되는 정확한 시간(UTC)입니다.
  • ttl(수명): 메시지가 만료되기 전까지의 시간입니다.

형식 및 값 옵션은 AgentMessage를 참고하세요.

ttl 및 expireTime의 최댓값은 메시지 제출 후 15일입니다.

ttl 및 expireTime의 최솟값은 메시지 제출 후 6초입니다.

메일 만료 설정에 관한 권장사항

  • 인증(OTP) 메시지: 메시지 제출 후 ttl를 15초 이상으로 설정하여 전송 및 취소 경합 상태의 가능성을 크게 줄입니다.

  • 거래 및 프로모션 메시지: 기기에서 메시지를 스캔하고 리치 미디어 콘텐츠를 다운로드하거나 처리하는 데 추가 시간이 필요하고 사용자가 엘리베이터나 터널 등에서 일시적인 연결 끊김을 경험할 수 있으므로 만료 시간을 더 길게(최소 60초 또는 사용 사례에 따라 몇 분에서 몇 시간) 설정합니다.

메시지의 TTL(수명)

비즈니스용 RCS 메시지에 TTL을 설정할 때는 메시지가 유효하고 전송 가능한 것으로 간주되는 기간을 지정합니다. 이 TTL 기간 내에 메시지가 사용자의 기기에 전송되지 않으면 비즈니스용 RCS 플랫폼에서 자동으로 메시지 취소를 시도합니다.

메시지 취소를 시작하면 비즈니스용 RCS 플랫폼에 특정 메시지 전송 시도를 중지하도록 요청합니다. 하지만 이 작업은 향후 전송 시도에만 영향을 미칩니다. 사용자의 기기에서 이미 메시지를 가져온 경우 메시지가 처리 중이며 비즈니스용 RCS 플랫폼에서 사용자의 기기에서 메시지를 취소할 수 없습니다.

알림과 관련하여 다음과 같은 사항을 참고하세요.

  • TTL 내에 전송된 메시지: TTL이 만료되기 전에 사용자 기기가 온라인 상태가 되고 메시지를 수신하면 DELIVERED 알림을 받습니다. 메일이 전송되었으므로 취소 알림이 전송되지 않습니다. 가장 일반적이고 예상되는 시나리오입니다.

  • TTL 만료 전에 메시지가 전송되지 않음: 메시지가 사용자 기기에 도달하기 전에 TTL이 만료되면(예: 기기가 오프라인 상태인 경우) 비즈니스용 RCS 플랫폼에서 메시지 취소를 시도합니다. 메시지가 전송 대기열에서 삭제되었음을 나타내는 TTL_EXPIRATION_REVOKED 알림이 수신됩니다. 이 경우 사용자는 메시지를 수신하지 않습니다.

특이 사례 처리를 위한 권장사항

Google 시스템은 비즈니스용 RCS 메시지 전송과 TTL 만료를 동시에 처리합니다. 이로 인해 알림 타이밍이 예상치 못한 특이 사례가 매우 드물게 발생할 수 있습니다. 예를 들어 전송 및 TTL 알림을 모두 받거나 둘 다 받지 못할 수 있습니다.

다음은 비즈니스용 RCS 메시지 알림을 처리하기 위한 권장사항입니다.

  • DELIVERED 알림: 메시지에 대한 DELIVERED 알림을 받으면 메시지가 사용자에게 도달했음을 확인합니다. 해당 메시지에 대한 후속 TTL 알림은 무시해도 됩니다.

  • TTL_EXPIRATION_REVOKED 알림: 상태가 TTL_EXPIRATION_REVOKED인 TTL 알림을 받으면 비즈니스용 RCS 시스템이 해당 메시지의 전송 시도를 중지한다는 의미입니다. 이 메시지를 전송되지 않은 것으로 처리하고 필요한 경우 대체 전략을 진행해야 합니다.

  • 다른 상태의 TTL 알림: 다른 상태의 TTL 알림을 받으면 취소 시도가 완료되지 않았음을 나타냅니다.

    • 일회용 비밀번호(OTP)와 같은 중요한 메시지의 경우 대체 방법을 시작합니다.
    • 중요하지 않은 메시지의 경우 대체 메시지를 시작할지 여부를 결정합니다.
  • 알림 없음: 드문 경우지만 시스템에서 TTL 알림을 전송하지 못하고 클라이언트에서 전송 알림을 생성하지 못할 수 있습니다. 이는 매우 드문 경우입니다.

메시지 트래픽 유형 설정

RBM API에는 메시지를 분류하는 messageTrafficType 필드가 포함되어 있습니다. 에이전트 사용 사례는 여전히 에이전트 동작과 적용되는 비즈니스 규칙을 정의하지만, messageTrafficType는 메시지 콘텐츠를 더 세부적으로 분류할 수 있습니다. 궁극적으로 이를 통해 단일 에이전트가 여러 사용 사례를 처리할 수 있습니다. 현재 기존 상담사 사용 사례나 비즈니스 규칙에는 영향을 미치지 않습니다.

이 필드는 선택사항이지만, 필드가 필수가 될 때 오류가 발생하지 않도록 지금 설정하는 것이 좋습니다.

메시지 트래픽 유형을 설정하려면 콘텐츠에 따라 각 메시지에 적절한 messageTrafficType를 할당합니다. 다음 표에는 지원되는 트래픽 유형과 예상되는 에이전트 사용 사례가 나와 있습니다. 이 매핑은 예상 사용량에 관한 권장사항이며 현재 API에서 적용하는 제한사항이 아닙니다.

트래픽 유형 메시지 내용 권장 에이전트 사용 사례
AUTHENTICATION 인증 메시지용입니다. OTP
TRANSACTION 사용자의 기존 서비스 또는 제품에 관한 메시지입니다. 예: 확인, 결제 영수증, 예약 세부정보 거래 또는 다회성
PROMOTION 혜택, 할인, 공지사항 또는 기타 프로모션 콘텐츠와 같은 프로모션 메시지입니다. 프로모션 또는 다회성
SERVICEREQUEST 사용자가 명시적으로 요청한 서비스에 관한 메시지입니다. OTP, 거래, 프로모션 또는 다용도
ACKNOWLEDGEMENT 사용자의 작업, 특히 구독 취소 요청을 확인하는 데 사용되는 메시지입니다. 이를 통해 사용자의 요청이 접수되어 처리 중임을 확인할 수 있습니다. OTP, 거래, 프로모션 또는 다용도

트래픽 유형이 설정되지 않은 경우 시스템은 에이전트의 사용 사례에 기본 유형을 할당합니다.

에이전트 사용 사례 기본 트래픽 유형
OTP AUTHENTICATION
트랜잭션 TRANSACTION
프로모션 PROMOTION
다회성 MESSAGE_TRAFFIC_TYPE_UNSPECIFIED

다용도 에이전트에는 기본 트래픽 유형이 없습니다. 콘텐츠에 따라 각 메시지의 트래픽 유형을 명시적으로 설정해야 합니다. MESSAGE_TRAFFIC_TYPE_UNSPECIFIED 값을 바꾸지 않으면 메시지가 계속 수락되고 특정 트래픽 유형 분류 없이 전송됩니다.

메일 크기 한도

문자열화된 전체 AgentMessage의 최대 크기는 250KB입니다. 메시지의 텍스트 부분에는 3,072자(영문 기준)의 자체 한도가 있습니다.

사용자의 예기치 않은 데이터 소비를 방지하기 위해 비즈니스용 RCS를 통해 전송할 수 있는 파일의 최대 크기는 100MiB이며, 단일 비즈니스용 RCS 메시지 내의 모든 미디어 및 PDF 첨부파일의 총 크기는 100MiB를 초과해서는 안 됩니다. (1MiB = 1,048,576바이트) 자세한 내용은 미디어 및 PDF 파일을 참고하세요.

텍스트

가장 간단한 메시지는 텍스트로 구성됩니다. 문자 메시지는 시각적 요소, 복잡한 상호작용 또는 응답 없이 정보를 전달하는 데 가장 적합합니다.

예

다음 코드는 일반 텍스트 메시지를 전송합니다. 형식 및 값 옵션은 phones.agentMessages.create를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

C#

using RCSBusinessMessaging;
…

// Create an instance of the RBM API helper
RbmApiHelper rbmApiHelper = new RbmApiHelper(credentialsFileLocation,
                                             projectId);

rbmApiHelper.SendTextMessage(
    "Hello, world!",
    "+12223334444",
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

기본 메시지 콘텐츠 - SMS 전환

이동통신사는 SMS 메시지를 비즈니스용 RCS로 전환할 수 있도록 결제 모델을 도입했습니다. 최대 160자의 UTF-8 문자를 포함하는 비즈니스용 RCS 메시지를 기본 메시지라고 합니다.

기본 메시지를 전송하는 요청을 구성할 때 문자는 1바이트(UTF-8)로 계산됩니다. 그림 이모티콘 또는 멀티바이트 문자 집합과 같은 특수문자가 포함된 메시지를 보내는 경우 각 문자는 2~4개 이상의 UTF-8 문자로 계산됩니다.

상자에 텍스트를 입력하여 길이를 확인하세요.

RCS 클라이언트는 링크 미리보기를 구현할 수 있습니다. 텍스트 전용 비즈니스용 RCS 메시지에 openGraph 태그가 있는 웹사이트의 URL이 포함된 경우 클라이언트는 미리보기(이미지, 제목 등)를 생성하여 더 풍부한 환경을 제공할 수 있습니다. 예를 들어 URL 미리보기가 포함된 기본 메시지를 참고하세요.

RCS 클라이언트에서 사용자가 링크 미리보기를 사용 중지할 수 있습니다.

사용자 인증을 위한 일회용 비밀번호

비즈니스용 RCS를 사용하여 SMS Retriever API를 통해 자동 사용자 인증을 위한 일회성 비밀번호(OTP)를 전송할 수 있습니다. 비즈니스용 RCS를 통해 도착하는 OTP를 읽는 전용 API는 없습니다.

Android에서 작동하는 방식

SMS Retriever API에 등록된 Android 앱의 경우 API는 올바른 형식의 비즈니스용 RCS 메시지를 수신 대기합니다. 이 메시지에는 OTP와 앱을 식별하는 고유한 해시가 모두 포함되어야 합니다.

올바른 형식의 비즈니스용 RCS 메시지가 수신되면 SMS Retriever API는 SMS OTP와 마찬가지로 이를 처리합니다. 해시가 앱과 일치하면 OTP가 추출되어 자동 사용자 인증을 위해 앱으로 전달됩니다.

  • 사용자 인증을 위한 비즈니스용 RCS 문자 메시지 샘플: Your code is <OTP><app hash>.
  • 예: Your code is 123456 M8tue43FGT.

SMS Retriever 및 관련 API에 관한 자세한 내용은 SMS Retriever 문서를 참고하세요. SMS Retriever API에 등록된 앱의 자동 사용자 인증에 관한 자세한 내용은 이 흐름도를 참고하세요.

iOS에서 작동하는 방식

iOS의 경우 시스템의 기본 제공 OTP 처리 기능이 SMS OTP와 마찬가지로 자동 완성을 위해 비즈니스용 RCS OTP를 자동으로 감지하고 제안합니다. iOS 앱이 OTP를 읽는 데 특정 API 통합이 필요하지 않습니다.

미디어 및 PDF 파일

이미지, 동영상, 오디오 또는 PDF 파일이 포함된 메시지를 보낼 때 에이전트는 콘텐츠에 공개적으로 액세스할 수 있는 URL을 제공하거나 파일을 직접 업로드해야 합니다.

전송할 수 있는 파일의 최대 크기는 100MiB이며, 단일 메시지 내의 모든 미디어 및 PDF 첨부파일의 총 크기는 100MiB를 초과할 수 없습니다.

미디어 압축 및 트랜스코딩

비즈니스용 RCS 플랫폼은 미디어 파일(예: 이미지 및 동영상)을 전송하기 전에 자동으로 트랜스코딩하고 압축하여 다양한 네트워크와 기기에서 빠르게 로드되고 원활하게 작동하도록 합니다.

압축은 엄격한 파일 크기 제한이 아닌 입력 미디어의 품질을 기반으로 합니다. 즉, 파일 크기가 최대 한도인 100MiB보다 훨씬 작더라도 압축될 수 있습니다. 트랜스코딩 표준은 지속적으로 변경되므로 트랜스코딩이 우회되는 시점을 결정하는 고정된 파일 크기 제한은 없습니다. 다양한 미디어 형식, 크기, 압축률을 실험하여 페이로드에 최적의 균형을 찾습니다.

썸네일 사양

미디어 파일의 경우 사용자가 클릭하기 전에 콘텐츠를 미리 볼 수 있는 썸네일 이미지를 지정할 수도 있습니다. 오디오 파일의 경우 기본 오디오 위젯이 자리표시자로 사용됩니다.

  • 썸네일의 최대 파일 크기는 100kB입니다. 최적의 사용자 환경을 위해 50kB 이하로 설정하는 것이 좋습니다.
  • 썸네일의 가로세로 비율은 원본 파일의 비율과 일치해야 합니다.

캐싱 및 URL 관리

비즈니스용 RCS 플랫폼은 파일을 60일 동안 캐시하며 API는 에이전트가 사용자에게 보내는 메시지에 포함할 수 있는 파일 ID를 반환합니다. 60일이 지나면 RCS for Business가 캐시에서 파일을 삭제합니다.

URL로 파일을 지정할 때는 contentMessage.forceRefresh를 false로 설정하는 것이 좋습니다. contentMessage.forceRefresh를 true로 설정하면 URL 콘텐츠가 캐시된 경우에도 비즈니스용 RCS가 지정된 URL에서 새 콘텐츠를 가져오도록 강제하므로 사용자의 메시지 전송 시간이 늘어납니다.

파일 URL 예시

다음 코드는 이미지를 전송합니다. 형식 및 값 옵션은 AgentContentMessage를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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");
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

또는 files.create를 사용하여 메시지로 전송하기 전에 미디어를 업로드할 수 있습니다.

파일 업로드 예시

다음 코드는 동영상 파일과 썸네일 파일을 업로드한 후 두 파일을 메시지로 전송합니다. 형식 및 값 옵션은 files.create 및 AgentContentMessage을 참고하세요.

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 JSON


curl -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 JSON


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": {
    "uploadedRbmFile": {
      "fileName": "SERVER-SPECIFIED_VIDEO_FILE_NAME",
      "thumbnailName": "SERVER-SPECIFIED_THUMBNAIL_FILE_NAME"
    }
  }
}'

지원되는 미디어 유형

비즈니스용 RCS는 다음 미디어 유형을 지원합니다. 썸네일의 경우 image/jpeg, image/jpg, image/gif, image/png만 지원됩니다.

미디어 유형 문서 유형 확장 프로그램 리치 카드와 호환됨
application/ogg OGG 오디오 .ogx 아니요
application/pdf PDF .pdf 예(인도의 Google 메시지에만 해당)
audio/aac AAC 오디오 .aac 아니요
audio/mp3 MP3 오디오 .mp3 아니요
audio/mpeg MPEG 오디오 .mpeg 아니요
audio/mpg MPG 오디오 .mp3 아니요
audio/mp4 MP4 오디오 .mp4 아니요
audio/mp4-latm MP4-latm 오디오 .mp4 아니요
audio/3gpp 3GPP 오디오 .3gp 아니요
image/jpeg JPEG .jpeg, .jpg 예
image/gif GIF .gif 예
image/png PNG .png 예
video/h263 H263 동영상 .h263 예
video/m4v M4V 동영상 .m4v 예
video/mp4 MP4 동영상 .mp4 예
video/mpeg4 MPEG-4 동영상 .mp4, .m4p 예
video/mpeg MPEG 동영상 .mpeg 예
video/webm WEBM 동영상 .webm 예

추천

에이전트는 추천 쿼리 칩 목록 또는 리치 카드로 추천(추천 답장 및 추천 작업)을 전송합니다.

추천 답장

추천 답장은 에이전트가 반응하는 방법을 알고 있는 응답을 제공하여 사용자가 대화를 진행하도록 안내합니다.

사용자가 추천 답장을 탭하면 에이전트는 답장의 텍스트와 포스트백 데이터가 포함된 이벤트를 수신합니다. 페이로드는 최대 2,048자(영문 기준)입니다.

예

다음 코드는 추천 답장 2개가 포함된 텍스트를 전송합니다. 형식 및 값 옵션은 SuggestedReply를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

권장 작업

추천 작업은 기기의 기본 제공 기능을 활용하여 대화를 통해 사용자를 안내합니다. 에이전트는 사용자에게 전화 걸기, 지도에서 위치 열기, 위치 공유, URL 열기, 캘린더 일정 만들기를 제안할 수 있습니다.

각 추천 작업에 대해 대체 URL(최대 2, 048자(영문 기준))을 선택적으로 제공할 수 있습니다. 사용자의 기기에서 추천 작업을 지원하지 않는 경우 이 URL은 새 브라우저 창에서 열립니다.

사용자가 추천 작업을 탭하면 에이전트는 작업의 포스트백 데이터가 포함된 이벤트를 수신합니다.

형식 및 값 옵션은 SuggestedAction를 참고하세요.

추천 표시

추천을 표시하는 방법에는 두 가지가 있습니다.

  • Persistent: 메시지 풍선 내에 표시되며 대화 내내 고정된 상태로 유지되는 추천 작업 또는 답장입니다.
  • 일시적: 메시지 풍선 외부에 표시되고 대화가 계속되면 사라지는 추천입니다.

지원되는 메시지 형식

  • 영구 추천: 독립형 문자 메시지 및 리치 카드와 함께 작동합니다.
  • 임시 추천: 독립형 문자 메시지, 미디어 메시지, 리치 카드와 함께 작동합니다.

추천 결합

동일한 메시지 또는 리치 카드에서 영구 추천과 임시 추천을 혼합할 수 있습니다.

  • 문자 메시지: 추천은 기본적으로 일시적입니다. 버블 내에 유지하려면 영구적으로 구성해야 합니다.
  • 리치 카드: 기본적으로 최대 4개의 영구 추천을 지원합니다. 그런 다음 카드 아래에 일시적인 추천을 '칩 목록'으로 추가할 수 있습니다.

추천 한도

단일 문자 메시지는 총 최대 11개의 추천을 지원합니다. 포함하는 모든 영구 제안은 이 총 한도에 포함됩니다. 예를 들어 영구 추천을 4개 포함하는 경우 임시 추천을 최대 7개까지 추가할 수 있습니다.

추천 유형 한도 표시되는 위치
영구 최대 4 메시지 대화창 내부
임시 사용 최대 11 도움말 풍선 외부(칩)

글자 수 제한

각 추천은 최대 25자(영문 기준)입니다.

추천 작업의 URL 투명성

사용자 신뢰를 구축하기 위해 기본 URL은 'URL 열기' 추천 작업의 추천 버튼 내에 두 번째 텍스트 줄로 표시됩니다. 이 일관된 동작은 독립형 문자 메시지, 리치 카드, 캐러셀에 적용됩니다.

영구 제안을 지원하는 클라이언트

  • 지원됨: Google 메시지(버전 20260225.00 이상)
  • 지원되지 않음: 20260225.00 이전 버전의 Google 메시지, iOS, 삼성 메시지

시스템 알림의 추천

사용자가 메시지를 받으면 Google 메시지는 사용 가능한 첫 번째 추천을 Android 시스템 알림에 직접 표시합니다. 사용자는 이 추천을 탭하여 앱을 열지 않고도 답장을 보내거나 작업을 트리거할 수 있습니다.

메시지를 설계할 때 다음 동작에 유의하세요.

  • 순서가 중요함: 알림당 하나의 추천만 표시됩니다. 참여도를 극대화하려면 우선순위가 가장 높은 추천 답장 또는 작업을 추천 목록의 맨 처음에 배치하세요.
  • 제외된 작업: 위치 공유 작업은 시스템 알림에 표시되지 않습니다. 사용자가 대화를 열어 위치를 공유해야 합니다.

번호 입력

다이얼 작업은 사용자가 에이전트가 지정한 전화번호로 전화를 걸도록 안내합니다. 전화번호에는 숫자(0-9), 더하기 기호(+), 별표(*), 숫자 기호(#)만 포함할 수 있습니다. E.164 국가 코드 포함 형식(예: +14155555555)이 지원되지만 필수는 아닙니다. 즉, +14155555555 및 1011은 모두 유효한 항목입니다.

예

다음 코드는 다이얼 작업을 전송합니다. 형식 및 값 옵션은 DialAction를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

위치 보기

위치 보기 작업은 사용자의 기본 지도 앱에 위치를 표시합니다. 위도와 경도로 위치를 지정하거나 사용자의 현재 위치를 기반으로 하는 쿼리로 위치를 지정할 수 있습니다. 지도 앱에 표시되는 핀에 커스텀 라벨을 설정할 수도 있습니다.

예

다음 코드는 위치 보기 작업을 전송합니다. 형식 및 값 옵션은 ViewLocationAction를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

위치 공유

위치 공유 작업을 통해 사용자는 에이전트와 위치를 공유할 수 있습니다. 사용자는 지도 앱에서 현재 위치 또는 직접 선택한 위치를 공유할 수 있습니다.

예

다음 코드는 위치 공유 작업을 전송합니다. 형식 및 값 옵션은 ShareLocationAction를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

URL 열기

URL 열기 작업을 사용하면 에이전트가 지정한 웹페이지로 사용자를 안내할 수 있습니다. 기본적으로 웹페이지는 사용자의 브라우저에서 열립니다. 웹페이지를 웹뷰에서 열도록 설정할 수도 있습니다. 자세한 내용은 WebView로 URL 열기를 참조하세요.

Google 메시지에서만 사용 가능

기본 URL 표시: A2P 메시지의 투명성을 개선하기 위해 Google 메시지는 'URL 열기' 추천 작업 내에 기본 URL 주소를 표시합니다. 이 변경사항은 표준 리치 카드 및 리치 카드 캐러셀의 추천 작업에 영향을 미칩니다.

'웹사이트 보기' 추천과 그 아래에 URL이 표시된 리치 카드
표시되는 기본 URL

웹 링크의 앱 아이콘 표시: 사용자가 웹페이지에 기본 앱을 구성한 경우 브라우저나 웹뷰 대신 해당 앱이 열리고 추천 버튼에 앱 아이콘이 표시됩니다. 앱 아이콘이 Google 메시지에 표시되려면 전체 직접 URL을 제공해야 합니다. 단축 URL을 사용하면 기본 URL 열기 아이콘이 대신 표시됩니다.

추천 버튼의 앱 아이콘
추천 버튼의 앱 아이콘
예

다음 코드는 URL 열기 작업을 전송합니다. 형식 및 값 옵션은 OpenUrlAction를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

WebView로 URL 열기

WebView로 URL 열기 작업은 기본 브라우저의 렌더링 엔진을 사용하여 메시지 앱 내에서 지정된 웹페이지를 로드합니다. 이렇게 하면 사용자가 비즈니스용 RCS 대화를 종료하지 않고도 웹페이지와 상호작용할 수 있습니다. 사용자의 기기가 WebView를 지원하지 않으면 웹페이지가 사용자의 브라우저에서 열립니다. WebView를 사용 설정하려면 OpenURLApplication를 참고하세요.

WebView에는 세 가지 표시 모드가 있습니다. 형식 및 값 옵션은 WebviewViewMode를 참조하세요.

  • 전체: 웹페이지가 전체 화면을 차지합니다.
  • 절반: 웹페이지가 화면의 절반을 차지합니다.
  • 높음: 웹페이지가 화면의 3/4을 차지합니다.
예

다음 코드는 WebView로 URL 열기 작업을 전송합니다. 형식 및 값 옵션은 OpenURLAction를 참조하세요.

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"
         }
       }
     }
   ]
 }
}'

자바

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;
    }

캘린더 일정 만들기

캘린더 일정 만들기 작업은 사용자의 캘린더 앱을 열고 지정된 정보로 새 일정을 만들기 시작합니다.

캘린더 일정 제목은 필수 항목입니다. 최대 100자(영문 기준)까지 입력할 수 있습니다. 캘린더 일정 설명은 선택사항이며 최대 500자(영문 기준)입니다.

예

다음 코드는 캘린더 일정 만들기 작업을 전송합니다. 형식 및 값 옵션은 CreateCalendarEventAction를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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
);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

추천 쿼리 칩 목록

에이전트는 사용자의 후속 작업을 안내하는 메시지와 함께 추천 쿼리 칩 목록을 전송합니다. 칩 목록은 연결된 메시지가 대화 하단에 있는 경우에만 표시됩니다. 대화의 후속 메시지(사용자 또는 에이전트)는 칩 목록을 덮어씁니다.

목록의 칩은 추천 답장 및 추천 작업입니다.

칩 목록에는 최대 11개의 추천 쿼리 칩이 포함되며 각 칩 라벨은 최대 25자(영문 기준)까지 포함할 수 있습니다.

형식 및 값 옵션은 AgentContentMessage를 참고하세요.

리치 카드

리치 카드는 미디어, 텍스트, 대화형 추천을 단일 메시지로 결합합니다. 관련 정보(예: 이미지, 이름, 가격이 포함된 제품)를 표시하고 '세부정보 보기' 추천과 같은 명확한 다음 단계로 사용자를 안내하는 데 적합합니다.

리치 카드에는 다음이 포함될 수 있습니다.

이러한 각 필드는 선택사항이지만 필드 1~3 중 하나 이상이 리치 카드에 포함되어야 합니다.

여러 카드를 가로로 스크롤되는 캐러셀로 함께 전송할 수 있습니다.

리치 카드의 총 페이로드는 250KB입니다.

전체 기술 세부정보는 리치 카드 문서를 참고하세요.

카드 높이

리치 카드는 콘텐츠에 맞게 세로로 확장됩니다. 최소 높이는 112DP이고 최대 높이는 344DP입니다. 카드 콘텐츠가 카드의 최소 높이를 채울 만큼 크지 않으면 카드가 확장되고 추가 높이를 공백으로 채웁니다.

리치 카드의 미디어는 다음 세 가지 높이 중 하나에 맞아야 합니다.

  • 소형: 112DP
  • 중형: 168DP
  • 대형: 264dp

선택한 높이를 기준으로 미디어가 카드 내 크기에 맞지 않으면 미디어를 확대/축소하고 잘라 미디어 미리보기를 선택합니다.

예

다음 코드는 이미지와 추천 답장이 포함된 리치 카드를 전송합니다. 형식 및 값 옵션은 RichCard를 참고하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
}
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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");
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

리치 카드 캐러셀

캐러셀은 여러 리치 카드를 함께 연결하여 사용자가 항목을 비교하고 각 항목에 개별적으로 반응할 수 있도록 합니다.

캐러셀에는 최소 2개, 최대 10개의 리치 카드가 포함될 수 있습니다. 캐러셀 내의 리치 카드는 리치 카드 문서에 설명된 대로 콘텐츠 및 높이에 관한 일반적인 리치 카드 요구사항을 준수해야 합니다. 캐러셀 레이아웃 및 사양에 관한 자세한 내용은 캐러셀 문서를 참고하세요.

예

다음 코드는 리치 카드 캐러셀을 전송합니다. 형식 및 값 옵션은 RichCard를 참조하세요.

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);
});
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

자바

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();
        }
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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')
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.

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);
이 코드는 RBM 샘플 에이전트에서 발췌한 것입니다.