Message Card Configuration
# Message Card Configuration
——Learn about the message card configuration product we provide for you through this article.
# The Function of Message Cards
We hope that before you learn about the task workflow function, you can understand its scenarios and uses:
● Usage scenario: When a user asks the agent about products or logistics information, the agent can reply clearly by sending a message card.
● Purpose: In the task workflow, you can use the interface node to query all orders or logistics information under the user's name. The orders and logistics information will be sent to the customer in the form of a message card list. The customer can select the correct order or logistics card, or click on the card to jump to a specific website.
# Feature Highlights
Simple configuration: No need to modify the interface according to the Sobot developer documentation. Enterprises can fill in the JSONPath expression through backend configuration, and Sobot can extract parameter values based on JSONPath and fill them into specific slots on the card. Card slots support custom enabling or disabling, and buttons such as "Send Card" or "Jump to Link" can be added on the card.
Interactive Intelligence: Users can select cards not only by clicking the "Send Card" button, but also by replying with Arabic numerals 1, 2, 3 or entering simple descriptions like "the first one" or "the second one".
Card messages are supported on Android SDK for Android 4.2 (API 17) and above, and on iOS 10 and above (HarmonyOS is not supported currently); they are also supported on WhatsApp, Instagram, Facebook, and WeChat channels.
# How to Use Message Cards
The following will introduce you to the function and effect of each feature:
# ● How to Use Message Cards
- Create the interface for the AI Agent to call in the [API Call - Select API- Create]. The [Output Parameters] will serve as the data source for the content in the card fields.
- Fill in the JSONpath expression for the return parameters of the interface.
JSONPath Basic Syntax:
A. Basic Selector
Expression | Function | Example JSONPath | Match Results |
---|---|---|---|
$ | Root node | $ | The entire JSON document |
. Or [] | Child Node (Attribute Access) | $.key or $['key'] | Get the value of the key |
* | Wildcard (matches all elements or attributes) | $.* | All attribute values of the first level |
.. | Recursive descent (search all levels) | $..key | All levels of key values |
B. Array index
Expression | Function | Example JSONPath | Matching results |
---|---|---|---|
[n] | Select the n-th element of the array (starting from 0) | $.array[1] | The second element of the array |
[start:end] | Slicing (Python style, inclusive of the start and exclusive of the end) | $.array[0:2] | The 1st and 2nd elements of the array |
[?(expr)] | Filter expression (similar to SQL WHERE) | $[?(@.price > 10)] | All objects where price > 10 |
C. Example
Assume there is a JSON data:
{
"store": {
"book": [
{ "title": "Book1", "price": 10 },
{ "title": "Book2", "price": 20 },
{ "title": "Book3", "price": 30 }
],
"location": "Beijing"}
}
2
3
4
5
6
7
8
9
Example query:
Requirement | JSONPath Expression | Result |
---|---|---|
Get all book titles | $.store.book[*].title | ["Book1", "Book2", "Book3"] |
Get the price of the first book | $.store.book[0].price | 10 |
Find books with prices greater than 10. | $.store.book[?(@.price > 10)] | [{"title": "Book2", "price": 20}, ...] |
Recursively search for all price fields | $..price | [10, 20, 30] |
- Set up the robot action to perform the following steps:
a. Variable assignment: Assign the parameter values returned by the interface to the robot variables, for use in subsequent conversations and branch judgments.
b. Set the guiding words. The final guiding words will be polished by the large model before being sent out.
c. Configure the message card fields. You can bind the interface output parameters to the card fields, so that different fields on the card display different data. Meanwhile, it supports adding custom fields.
d. Set card actions. Support two custom actions: sending cards and jumping to external links.
- Request Timeout: Set the timeout duration for API requests and actions to take after a timeout.
# ● Message Card Effect
- The effect of the robot's actions after setting the interface output parameters in [Knowledge Center - Workflow Management - Main Workflow - API Call - Bot Actions].
a. Send Card Action Effect: Send card style in own channels, and send plain text module cards in third-party channels.
b. Message card jump link effect: After the card is configured with a send button, the customer can click "Send Card". The robot will recognize the card information and assign variables (for example, if the customer wants to check logistics, the robot finds three orders. The customer selects one order and clicks send. The robot will collect the order ID from the card sent by the user and use this order ID as input to query the order's logistics, then return the logistics information). For this send card action, in addition to clicking, C-end users can also say "the first", "the second", or reply with numbers "1", "2", "3" to achieve the same result.
c. Click "View Details" to see the detailed information of the product.