Google Business Messages API

🚧

API Endpoint and Authentication

  • Your API endpoint varies based on where your imiconnect account is hosted. Visit Know Your API Endpoint section to know more.

  • You can use either Service Key or JSON Web Tokens (JWT) for authentication. If you use both JWT authentication and Service Key in an API request, JWT authentication takes priority, and the Service Key is ignored.

❗️

API Access

This API is only available on an on-request basis. Please reach out to your support contact for enabling Google Business Messages APIs.

Google Business Messages - Samples

{
2    "callbackUrl": "https://requestinspector.com/inspect/01gp31z8derrbjs22qxby9kxzr",
3    "callbackData": "customerID123|1234|new_sale",
4    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
5    "from": "a_167344112755437860",
6    "to": "66d8a4d2-8fc7-4447-8bd1-b1874d0db18b",
7    "representative": {
8        "avatarImage": "https://developers.google.com/identity/images/g-logo.png",
9        "displayName": "Chatbot",
10        "representativeType": "BOT"
11    },
12    "suggestions": [
13        {
14            "reply": {
15                "text": "Flowtrigger",
16                "postbackData": "Flow GBM executed"
17            }
18        },
19        {
20            "action": {
21                "text": "Open URL",
22                "postbackData": "Url Opened",
23                "openUrlAction": {
24                    "url": "https://www.google.com"
25                }
26            }
27        },
28        {
29            "action": {
30                "text": "Call support",
31                "postbackData": "call-support",
32                "dialAction": {
33                    "phoneNumber": "+919787877769"
34                }
35            }
36        },
37        {
38            "liveAgentRequest": {}
39        }
40    ],
41    "fallback": "fallback text",
42    "containsRichText": true,
43    "text": "Text with BOT as representative"
44}
{
2    "callbackUrl": "https://requestinspector.com/inspect/01gp31z8derrbjs22qxby9kxzr",
3    "callbackData": "customerID123|1234|new_sale",
4    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
5    "from": "a_167344112755437860",
6    "to": "66d8a4d2-8fc7-4447-8bd1-b1874d0db18b",
7    "representative": {
8        "avatarImage": "https://developers.google.com/identity/images/g-logo.png",
9        "displayName": "Human",
10        "representativeType": "HUMAN"
11    },
12    "suggestions": [
13        {
14            "reply": {
15                "text": "Reply",
16                "postbackData": "Replied back to connect"
17            }
18        },
19        {
20            "action": {
21                "text": "Open URL",
22                "postbackData": "Url Opened",
23                "openUrlAction": {
24                    "url": "https://www.google.com"
25                }
26            }
27        },
28        {
29            "action": {
30                "text": "Call support",
31                "postbackData": "call-support",
32                "dialAction": {
33                    "phoneNumber": "+919787877769"
34                }
35            }
36        },
37        {
38            "liveAgentRequest": {}
39        }
40    ],
41    "fallback": "fallback text",
42    "containsRichText": true,
43    "text": "Text with human as representative"
44}
45
{
2    "callbackUrl": "https://requestinspector.com/inspect/01gp31z8derrbjs22qxby9kxzr",
3    "callbackData": "customerID123|1234|new_sale",
4    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
5    "from": "a_167344112755437860",
6    "to": "66d8a4d2-8fc7-4447-8bd1-b1874d0db18b",
7    "representative": {
8        "avatarImage": "https://developers.google.com/identity/images/g-logo.png",
9        "displayName": "Chat Bot",
10        "representativeType": "BOT"
11    },
12    "suggestions": [
13        {
14            "reply": {
15                "text": "Flowtrigger",
16                "postbackData": "Flow GBM executed"
17            }
18        },
19        {
20            "action": {
21                "text": "Open URL",
22                "postbackData": "Url Opened",
23                "openUrlAction": {
24                    "url": "https://www.google.com"
25                }
26            }
27        },
28        {
29            "action": {
30                "text": "Call support",
31                "postbackData": "call-support",
32                "dialAction": {
33                    "phoneNumber": "+919787877769"
34                }
35            }
36        },
37        {
38            "liveAgentRequest": {}
39        }
40    ],
41    "fallback": "Image sending",
42    "containsRichText": true,
43    "image": {
44        "contentInfo": {
45            "fileUrl": "https://storage.googleapis.com/kitchen-sink-sample-images/cute-dog.jpg",
46            "thumbnailUrl": "https://developers.google.com/identity/images/g-logo.png",
47            "forceRefresh": true,
48            "altText": "Sending Images with suggesstion"
49        }
50    }
51}
{
2    "callbackUrl": "https://requestinspector.com/inspect/01gp31z8derrbjs22qxby9kxzr",
3    "callbackData": "customerID123|1234|new_sale",
4    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
5    "from": "a_167344112755437860",
6    "to": "66d8a4d2-8fc7-4447-8bd1-b1874d0db18b",
7    "representative": {
8        "avatarImage": "https://developers.google.com/identity/images/g-logo.png",
9        "displayName": "Chatbot",
10        "representativeType": "BOT"
11    },
12    "suggestions": [
13        {
14            "action": {
15                "text": "Call support",
16                "postbackData": "call-support",
17                "dialAction": {
18                    "phoneNumber": "+919787877769"
19                }
20            }
21        },
22        {
23            "liveAgentRequest": {}
24        }
25    ],
26    "fallback": "string",
27    "containsRichText": true,
28    "richCard": {
29        "standaloneCard": {
30            "cardContent": {
31                "title": "GBM",
32                "description": "desc",
33                "media": {
34                    "height": "SHORT",
35                    "contentInfo": {
36                        "fileUrl": "https://developers.google.com/identity/images/g-logo.png",
37                        "thumbnailUrl": "https://developers.google.com/identity/images/g-logo.png",
38                        "forceRefresh": true,
39                        "altText": "string"
40                    }
41                },
42                "suggestions": [
43                    {
44                        "reply": {
45                            "text": "reply",
46                            "postbackData": "Replied"
47                        }
48                    },
49                    {
50                        "action": {
51                            "text": "Open URL FB",
52                            "postbackData": "Url Opened",
53                            "openUrlAction": {
54                                "url": "https://www.facebook.com"
55                            }
56                        }
57                    }
58                ]
59            }
60        }
61    }
62}
{
2    "callbackUrl": "https://requestinspector.com/inspect/01gp31z8derrbjs22qxby9kxzr",
3    "callbackData": "customerID123|1234|new_sale",
4    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
5    "from": "a_167344112755437860",
6    "to": "66d8a4d2-8fc7-4447-8bd1-b1874d0db18b",
7    "representative": {
8        "avatarImage": "https://developers.google.com/identity/images/g-logo.png",
9        "displayName": "Human",
10        "representativeType": "HUMAN"
11    },
12    "fallback": "string",
13    "containsRichText": true,
14    "richCard": {
15        "carouselCard": {
16            "cardWidth": "MEDIUM",
17            "cardContents": [
18                {
19                    "title": "Carousel 1",
20                    "description": "This carousel 1 description",
21                    "media": {
22                        "height": "MEDIUM",
23                        "contentInfo": {
24                            "fileUrl": "https://developers.google.com/identity/images/g-logo.png",
25                            "thumbnailUrl": "https://developers.google.com/identity/images/g-logo.png",
26                            "forceRefresh": true,
27                            "altText": "string"
28                        }
29                    },
30                    "suggestions": [
31                        {
32                            "reply": {
33                                "text": "Need help reply",
34                                "postbackData": "Welcome, to connect QA, How may help you?"
35                            }
36                        },
37                        {
38                            "action": {
39                                "text": "Open FB Url",
40                                "postbackData": "Successfully, Opened URL",
41                                "openUrlAction": {
42                                    "url": "http://www.facebook.com"
43                                }
44                            }
45                        }
46                    ]
47                },
48                {
49                    "title": "Carousel 2",
50                    "description": "This is carousel 2 description",
51                    "media": {
52                        "height": "MEDIUM",
53                        "contentInfo": {
54                            "fileUrl": "https://developers.google.com/identity/images/g-logo.png",
55                            "thumbnailUrl": "https://developers.google.com/identity/images/g-logo.png",
56                            "forceRefresh": true,
57                            "altText": "string"
58                        }
59                    },
60                    "suggestions": [
61                        {
62                            "reply": {
63                                "text": "Send reply message",
64                                "postbackData": "how may help you?"
65                            }
66                        }
67                    ]
68                },
69                {
70                    "title": "Carousel 3",
71                    "description": "This is carousel 3 description",
72                    "media": {
73                        "height": "MEDIUM",
74                        "contentInfo": {
75                            "fileUrl": "https://developers.google.com/identity/images/g-logo.png",
76                            "thumbnailUrl": "https://developers.google.com/identity/images/g-logo.png",
77                            "forceRefresh": true,
78                            "altText": "string"
79                        }
80                    },
81                    "suggestions": [
82                        {
83                            "reply": {
84                                "text": "reply carousel 3",
85                                "postbackData": "Need more help?"
86                            }
87                        }
88                    ]
89                }
90            ]
91        }
92    }
93}

Common Parameters

ParameterTypeMandatoryDescription
callbackUrlstringNo
callbackDatastringNo
correlationIdStringNo
fromstringYes
tostringYes
representativeJSONObjectYes

Message Type - Text

ParameterTypeMandatoryDescription
avatarImageURLNo
displayNameStringNo
representativeTypeStringYes
fallbackStringNo
containsRichTextBooleanNo
textStringYes

Message Type - Image

ParameterTypeMandatoryDescription
avatarImageStringNo
displayNameStringNo
representativeTypeStringYes
fallbackStringNo
containsRichTextBooleanNo
imageJSONObjectYes
contentInfoJSONObjectYes
fileUrlURLYes
thumbnailUrlURLNo
forceRefreshBooleanNo
altTextStringYes

Message Type - RichCard - Standalone

ParameterTypeMandatoryDescription
avatarImageStringNo
displayNameStringNo
representativeTypeStringYes
fallbackStringNo
containsRichTextBooleanNo
richCardJSONObjectYes
standaloneCardJSONArrayYes
cardContentJSONArrayYes
titleStringNo
descriptionStringNo
mediaJSONArrayNo
height
contentInfoJSONArrayYes
fileUrlURLYes
thumbnailUrlURLNo
forceRefreshBooleanNo
altTextStringYes

Message Type - RichCard - Carousel

ParameterTypeMandatoryDescription
avatarImageStringNo
displayNameStringNo
representativeTypeStringYes
fallbackStringNo
containsRichTextBooleanNo
richCardJSONArrayYes
carouselCardJSOMArrayYes
cardWidthStringNo
cardContentsJSONArrayYes
titleStringNo
descriptionStringNo
mediaJSONArrayNo
height
contentInfoJSONArrayYes
fileUrlURLYes
thumbnailUrlURLNo
forceRefreshBooleanNo
altTextStringYes

Suggestion Types

They include REPLY and ACTION

ParameterTypeMandatoryDescription
suggestionsJSONArrayNo
replyJSONArrayNo
textStringYes
postbackDataStringYes
actionJSONArrayNo
openUrlActionJSONArrayYes
dialActionJSONArrayYes
liveAgentRequestJSONArrayNo
Language
Authentication
Query
Click Try It! to start a request and see the response here!