일반적으로 상담사는 따로 소통하는 사용자에 대한 정보가 거의 없습니다. 수집, 저장, 분석할 수 있습니다. 하지만 상담사는 OAuth로 사용자 인증 사용자 신원 확인, 대화 맞춤설정, 대신 조치 실행 사용자 수
이 대화 흐름에서 사용자는 계정에 크레딧을 추가하기로 선택합니다. 에이전트는 사용자에게 로그인하여 사용자의 ID를 검증하고, 크레딧을 주문할 수 있습니다.
- 사용자가 상담사와 대화를 시작합니다.
사용자가 응답을 입력하기 시작하면 입력 이벤트를 있습니다.
{ "agent": "brands/1111/agents/2222", "conversationId": "3333", "customAgentId": "oauth", "requestId": "1234567890", "userStatus": { "isTyping": "true", "createTime": "2020-10-02T15:01:23.045123456Z", }, "sendTime": "2020-10-02T15:01:24.045123456Z", }
사용자가 "안녕하세요, 내 계정에 크레딧 5개를 추가하고 싶습니다." 메시지를 보냅니다.
{ "agent": "brands/1111/agents/2222", "conversationId": "3333", "customAgentId": "oauth", "requestId": "123123123", "message": { "messageId": "4444", "name": "conversations/12345/messages/67890", "text": "Hi, I'd like to add 5 credits to my account", "createTime": "2020-10-02T15:05:23.045123456Z", }, "context": { "entryPoint": "PLACESHEET", "userInfo": { "displayName": "Michael", "userDeviceLocale": "en", }, "resolvedLocale": "en", } "sendTime": "2020-10-02T15:05:24.045123456Z", }
상담사가 "제가 도와드리겠습니다. 다음 작업을 하려면 계정에 로그인하세요. 계속 진행하세요." 인증 요청 제안과 함께 표시됩니다
clientId
및scopes
는 OAuth 제공업체가 정의합니다. 에이전트 OAuth 제공업체의 요청에 따라codeChallenge
값을 생성합니다. 요구사항을 충족해야 합니다curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \ -H "Content-Type: application/json" \ -H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \ -d "{ 'messageId': '5555', 'text': 'I can help you with that. Sign into your account to continue.', 'suggestions': [ { 'AuthenticationRequest': { 'clientId': 'oauth_client_id_1234567890', 'codeChallenge': 'code_challenge', 'scopes': [ 'account', 'billing', ], }, }, ], 'representative': { 'avatarImage': 'https://oauth.agent/bot-avatar.jpg', 'displayName': 'OAuth Agent', 'representativeType': 'BOT' } }"
사용자가 메시지를 수신하고 인증 요청 제안을 탭합니다. 계정에 로그인합니다.
에이전트가 OAuth 승인 코드가 포함된 메시지를
authenticationResponse.code
필드{ "agent": "brands/1111/agents/2222", "conversationId": "3333", "customAgentId": "oauth", "requestId": "1234567895", "authenticationResponse": { "code": "fkhoe541658sfk684d135j186mngkjdrt5425415a2s1dfa68s4edf", }, } "sendTime": "2020-10-02T15:01:24.045123456Z", }
에이전트가 OAuth 제공업체와 통신하여 승인을 교환합니다. 코드를 다운로드하고 사용자의 계정 정보를 가져오는 것입니다.
상담사가 '로그인해 주셔서 감사합니다. 현재 크레딧이 2개 있습니다. 받는사람 계정에 크레딧을 5개 추가하고 기본 결제 수단은 무엇인가요?" '예'라는 메시지가 포함된 메시지로 '아니요'를 선택합니다. 추천 답장으로 표시합니다.
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \ -H "Content-Type: application/json" \ -H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \ -d "{ 'messageId': '7777', 'text': 'Thanks for signing in. You currently have 2 credits. To confirm, you'd like to me to add 5 credits to your account and bill your default payment method?', 'suggestions': [ { 'reply': { 'text': 'Yes', 'postbackData': 'process-transaction', }, }, { 'reply': { 'text': 'No', 'postbackData': 'cancel-transaction', }, }, ], 'representative': { 'avatarImage': 'https://oauth.agent/bot-avatar.jpg', 'displayName': 'OAuth Agent', 'representativeType': 'BOT' } }"
사용자가 '예'를 탭합니다. 추천 답장
{ "agent": "brands/1111/agents/2222", "conversationId": "3333", "customAgentId": "oauth", "requestId": "1234567898", "suggestionResponse": { "message": "conversations/333/messages/8888", "postbackData": "process-transaction", "createTime": "2020-10-02T15:01:26.045123456Z", "text": "Yes", "suggestionType": "REPLY", } "sendTime": "2020-10-02T15:01:27.045123456Z", }
에이전트는 OAuth 액세스 토큰을 사용하여 거래를 처리한 후 '좋습니다. 계정에 크레딧을 5개 추가했습니다. 있음 도움이 더 필요한 사항은 없으신가요?"라고 묻습니다.
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \ -H "Content-Type: application/json" \ -H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \ -d "{ 'messageId': '9999', 'text': 'Great. I just added 5 credits to your account. Is there anything else I can help you with?', 'representative': { 'avatarImage': 'https://oauth.agent/bot-avatar.jpg', 'displayName': 'OAuth Agent', 'representativeType': 'BOT' } }"
사용자가 '아니요'라고 답장합니다.
{ "agent": "brands/1111/agents/2222", "conversationId": "3333", "customAgentId": "oauth", "requestId": "123123133", "message": { "messageId": "4444", "name": "conversations/12345/messages/101010", "text": "No, thanks", "createTime": "2020-10-02T15:05:23.045123456Z", }, "context": { "entryPoint": "PLACESHEET", "userInfo": { "displayName": "Michael", "userDeviceLocale": "en", }, "resolvedLocale": "en", } "sendTime": "2020-10-02T15:05:28.045123456Z", }
상담사가 '문의해 주셔서 감사합니다. 좋은 하루 보내세요."
curl -X POST "https://businessmessages.googleapis.com/v1/conversations/3333/messages" \ -H "Content-Type: application/json" \ -H "`oauth2l header --json path/to/service/account/key.json businessmessages`" \ -d "{ 'messageId': '11111111', 'text': 'Thanks for contacting us. Have a great day!', 'representative': { 'avatarImage': 'https://oauth.agent/bot-avatar.jpg', 'displayName': 'OAuth Agent', 'representativeType': 'BOT' } }"