Google Business Messages는 2024년 7월 31일에 지원 중단됩니다.
자세히 알아보기
Hello, World
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
메시지와 이벤트를 주고받는 것은 커뮤니케이션의 핵심 요소입니다.
연결 고리를 만듭니다 에이전트가 사용자에게 메시지, 이벤트, 요청 전송
Business Messages API를 통해 액세스 가능하지만 사용자가 만든 메시지와 이벤트를 수신합니다.
JSON 형식으로 생성됩니다
다음은 샘플 데이터를 사용하여 대화를 시작하는 방법을 설명하는 대화 흐름의 예입니다.
메시지를, 이벤트 및 요청을 통해 유용하고 의미 있는 상호작용을 만들 수 있습니다.
이 예에서 사용자는 대화를 시작하고 'Hello,
I'm World!'라는 메시지가 표시되면 에이전트는 'Hello, World'로 응답합니다.

- 사용자가 상담사와 대화를 시작합니다.
사용자가 응답을 입력하기 시작하면 입력 이벤트를
있습니다.
{
"agent": "brands/1111/agents/2222",
"conversationId": "3333",
"customAgentId": "hello-world-bot",
"requestId": "1234567890",
"userStatus": {
"isTyping": "true",
"createTime": "2020-10-02T15:01:23.045123456Z",
},
"sendTime": "2020-10-02T15:01:24.045123456Z",
}
사용자가 메시지를 보냅니다.
{
"agent": "brands/1111/agents/2222",
"conversationId": "3333",
"customAgentId": "hello-world-bot",
"requestId": "123123123",
"message": {
"messageId": "4444",
"name": "conversations/12345/messages/67890",
"text": "Hello! I'm World!",
"createTime": "2020-10-02T15:05:23.045123456Z",
},
"context": {
"entryPoint": "PLACESHEET",
"userInfo": {
"displayName": "Michael",
"userDeviceLocale": "en",
},
"resolvedLocale": "en",
}
"sendTime": "2020-10-02T15:05:24.045123456Z",
}
에이전트가 'Hello, World'를 보냅니다. 메시지를 보냅니다.
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': 'Hello, World',
'representative': {
'avatarImage': 'https://hello.world/avatar.jpg',
'displayName': 'Hello World Agent',
'representativeType': 'BOT'
}
}"
메시지가 전송되면 사용자의 기기에서 전송 확인을 반환합니다.
{
"agent": "brands/1111/agents/2222",
"conversationId": "3333",
"customAgentId": "hello-world-bot",
"receipts" : {
"receipts": [
{
"message": "conversations/3333/messages/5555",
"receiptType": "DELIVERED",
}
],
"createTime": "2020-10-02T16:01:23.045123456Z",
},
"sendTime": "2020-10-02T16:01:24.045123456Z",
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-09-12(UTC)
[null,null,["최종 업데이트: 2024-09-12(UTC)"],[[["\u003cp\u003eAgents and users communicate by sending and receiving messages and events through the Business Messages API and webhooks.\u003c/p\u003e\n"],["\u003cp\u003eUser interactions, such as typing and sending messages, are sent to the agent as JSON payloads containing relevant information like user details and message content.\u003c/p\u003e\n"],["\u003cp\u003eAgents can respond to users with messages containing text and optional representative details like display name and avatar.\u003c/p\u003e\n"],["\u003cp\u003eThe platform provides delivery receipts to the agent, confirming the delivery status of messages sent to the user.\u003c/p\u003e\n"]]],[],null,["# Hello, World\n\nSending and receiving messages and events are the core aspects of communication\nbetween an agent and a user. Agents send messages, events, and requests to users\nthrough the Business Messages API but receive user-created messages and events\nat their webhooks as JSON.\n\nBelow is an example conversation flow that uses sample data to illustrate how\nmessages, events, and requests can create useful and meaningful interactions.\n\nIn this example, the user starts a conversation and sends the message \"Hello,\nI'm World!\", then the agent responds with \"Hello, World\".\n\n1. The user begins the conversation with the agent.\n2. Once the user begins typing a response, they send a typing event to the\n agent.\n\n {\n \"agent\": \"brands/1111/agents/2222\",\n \"conversationId\": \"3333\",\n \"customAgentId\": \"hello-world-bot\",\n \"requestId\": \"1234567890\",\n \"userStatus\": {\n \"isTyping\": \"true\",\n \"createTime\": \"2020-10-02T15:01:23.045123456Z\",\n },\n \"sendTime\": \"2020-10-02T15:01:24.045123456Z\",\n }\n\n3. The user sends \"Hello, I'm World!\" as a message.\n\n {\n \"agent\": \"brands/1111/agents/2222\",\n \"conversationId\": \"3333\",\n \"customAgentId\": \"hello-world-bot\",\n \"requestId\": \"123123123\",\n \"message\": {\n \"messageId\": \"4444\",\n \"name\": \"conversations/12345/messages/67890\",\n \"text\": \"Hello! I'm World!\",\n \"createTime\": \"2020-10-02T15:05:23.045123456Z\",\n },\n \"context\": {\n \"entryPoint\": \"PLACESHEET\",\n \"userInfo\": {\n \"displayName\": \"Michael\",\n \"userDeviceLocale\": \"en\",\n },\n \"resolvedLocale\": \"en\",\n }\n \"sendTime\": \"2020-10-02T15:05:24.045123456Z\",\n }\n\n4. The agent sends \"Hello, World\" as a message.\n\n curl -X POST \"https://businessmessages.googleapis.com/v1/conversations/3333/messages\" \\\n -H \"Content-Type: application/json\" \\\n -H \"`oauth2l header --json path/to/service/account/key.json businessmessages`\" \\\n -d \"{\n 'messageId': '5555',\n 'text': 'Hello, World',\n 'representative': {\n 'avatarImage': 'https://hello.world/avatar.jpg',\n 'displayName': 'Hello World Agent',\n 'representativeType': 'BOT'\n }\n }\"\n\n5. Upon message delivery, the user's device returns a delivery receipt.\n\n {\n \"agent\": \"brands/1111/agents/2222\",\n \"conversationId\": \"3333\",\n \"customAgentId\": \"hello-world-bot\",\n \"receipts\" : {\n \"receipts\": [\n {\n \"message\": \"conversations/3333/messages/5555\",\n \"receiptType\": \"DELIVERED\",\n }\n ],\n \"createTime\": \"2020-10-02T16:01:23.045123456Z\",\n },\n \"sendTime\": \"2020-10-02T16:01:24.045123456Z\",\n }"]]