Online Message Forwarding API
# Online Message Forwarding API
# Online Message Forwarding
For this function, the message format is Json . The real-time message push configuration will take effect at 00:00 am the next day. For data of the same type in the same company, 20 pieces of data are cached and packaged for one-time sending; in case of less than 20 pieces, data are packaged and sent once per second.
Real-time message push requires customer to provide a data receiving API, such as https:// xxxxxxxx.xxxxxx.com/sobot/message. All types of data use the same URL.
The message forwarding API can be encrypted before passing. You can contact your customer manager to enable the setting. After enabling, you can add three parameters in the header upon message forwarding: timestamp (server time), random code, and sign (MD5 encryption, 32-bit lowercase). After getting the parameters, customer will decode and compare them to correctly receive the data; in case of error, an error code will be returned.
Parameters in header:
Param | Type | Required | Description |
---|---|---|---|
X-Log-TimeStamp | String | Timestamp (server time: ms) | |
X-Log-RandomCode | String | Random code | |
X-Log-Sign | String | sign signature, concatenate the strings of companyId, timestamp (server time), random code, appKey (key used to configure message forwarding) in sequence, and use the MD5 digest algorithm (32-bit lowercase) to get the value |
Request example:
curl https:// xxxxxxx.xxxxxx.com/sobot/message
-X POST
-H 'X-Log-TimeStamp: 1609224926723 '
-H 'X-Log-RandomCode: 635 '
-H 'X-Log-Sign: 9ba80f40bc5e6fd404648ea15aa4f7fa '
2
3
4
5
# ● Online Chat Message
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
cid | String | Yes | Chat ID |
source | String | Yes | User sources:0 PC,1 WeChat,2 SDK,3 Weibo,4 Mobile site,6 call center,7 ticket center,8 customer center,9 WeCom,10 WeChat mini program,12 baidu,13 toutiao,14 360,15 Alibaba Huichuan,16 Sogou,17 WeChat customer service,20 Guangdian Tong,21 Zhihu,22 facebook,23 whatsApp,24 instagram,25 line,26 discord,33 telegram |
start_time | String | Yes | Start time, unixtime ms, e.g.: "1539153409792" |
end_time | String | Yes | End time, unixtime ms, e.g.: "1539153409792" |
first_response_time | String | Yes | 1st Response Time, unixtime ms, e.g.: "1539153409792" |
transfer_tohuman_time | String | Yes | Bot-agent transfer time, unixtime ms, e.g.: "1539153409792" |
conversation_duration | String | Yes | Chat duration, ms |
staff_emails | String | Yes | Last reception agent email |
staff_name | String | Yes | Last reception agent name |
consult_robot_msg_count | String | Yes | Bot Inquiry Messages |
robot_reply_msg_count | String | Yes | Bot Replies |
consult_staff_msg_count | String | Yes | Agent Inquiry Messages |
staff_reply_msg_count | String | Yes | Agent Replies |
transfer_human_succ_flag | String | Yes | Whether trans-to-agent succeeded, 1-YES; 0-NO |
queue_time | String | Yes | Queue duration, ms |
session_queue_state | String | Yes | Queue status, 1: Queue not connected, 2: Queuing, 3: Queue leaving |
ip | String | Yes | Visit IP, format: " 255.255.255.255 " |
area | String | Yes | Region |
os | String | Yes | Terminal, 1: Windows XP; 2: Windows 7; 3: Windows 8; 4: Windows Vista; 5: Other Windows version; 6: Linux; 7: macOS; 8: Android; 9: iOS; 11: Windows 2000; 12: Windows 10; Other: Other |
visitorid | String | Yes | User ID |
partnerid | String | Yes | Partner user ID |
lastgroupid | String | Yes | Last reception agent group ID |
lastgroup_name | String | Yes | Last reception agent group name |
offline_type | String | Yes | Chat end method: 1: Agent offline, 2: Customer removed by agent, 3: Customer blacklisted by agent, 4: Customer chat timeout, 5: Customer closed chat page, 6: Customer opened a new page |
human_valid_flag | String | Yes | Whether it's a valid agent chat, 1: YES, 0: NO |
human_invalid_flag | String | Yes | Whether it's an invalid agent chat, 1: YES, 0: NO |
human_invalid_recep_flag | String | Yes | Whether it's an invalid agent reception, 1: YES, 0: NO |
human_valid_recep_flag | String | Yes | Whether it's a valid agent reception, 1: YES, 0: NO |
human_recep_flag | String | Yes | Whether it's an agent reception, 1: YES, 0: NO |
robot_invalid_flag | String | Yes | Whether it's an invalid bot chat, 1: YES, 0: NO |
robot_valid_flag | String | Yes | Whether it's a valid bot chat, 1: YES, 0: NO |
province_name | String | Yes | Province name |
city_name | String | Yes | City name |
access_human_time | String | Yes | Agent access time |
robotid | String | No | Bot ID |
robot_alias | String | No | Bot alias, the bot docking param, prior to robotid . Currently it only supports APP channel |
robot_name | String | No | Bot nickname |
staffids | String | No | All reception agent IDs, separated by ","; |
invite_evaluation_flags | String | No | Whether agent has invited for evaluation, corresponding to the sequence of reception agent IDs, 1: Invited, 0: Not invited |
response_duration | Long | Yes | Total response duration: ms |
response_count | Int | Yes | Total no. of response |
response_avg | String | Yes | Avg. response time = total response duration / total no. of response |
session_human_duration | String | Yes | Agent Reception Time |
asHuman_interactive_count | String | Yes | Agent interactive chats |
channel_flag | String | Yes | Sub-channel ID |
channel_name | String | Yes | Sub-channel name |
search_engine | String | No | Search source: 1: Baidu natural search, 2: Baidu paid search, 3: 360 search, 4: sougou, 5: Shenma, 6: Bing, 7: Google, 8: other search engines, 9: direct access, 10: external links, 11: Baidu unknown access |
land_page_url | String | No | Landing page URL |
land_page_title | String | No | Landing page title |
conversation_page_url | String | No | Chat initiation page URL |
conversation_page_title | String | No | Chat initiation page title |
search_word | String | No | Search term |
lastrobotid | String | No | Final Receptionist Robot ID |
lastrobot_name | String | No | Final Receptionist Robot Name |
Note: The unique primary key is cid . All tables are associated via cid, indicating a same chat
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, conversation |
content | List | Yes | Message Content |
Sample request message:
{
"sys_code":"21",
"type":"conversation",
"content":[
{
"companyid":" 5cc2c708202d4defaf72d4bcac362a55 ",
"cid":" 86937e82ae244ad59aeefe41af731079 ",
"source":"2",
"start_time":" 1468826506677 ",
"partnerid":" 1907281202433341 ",
"end_time":" 1468827002400 ",
"first_response_time":"1468827002400",
"transfer_tohuman_time":"1468826506677",
"conversation_duration":"495723",
"staff_emails":"11122221@foxmail.com",
"staff_name":"admin01",
"consult_robot_msg_count":"3",
"robot_reply_msg_count":"20",
"consult_staff_msg_count":"0",
"staff_reply_msg_count":"0",
"transfer_human_succ_flag":"1",
"queue_time":"0",
"session_queue_state":"2",
"ip":" 138 ",
"area":"Liaoning",
"os":"8",
"visitorid":" 837213545777846 ",
"lastgroupid":" 35980200f279438b952f8dc3d5731f85 ",
"lastgroup_name":"Customer service group",
"human_valid_flag":"1",
"human_invalid_flag":"0",
"human_invalid_recep_flag":"0",
"human_valid_recep_flag":"0",
"human_recep_flag":"1",
"robot_invalid_flag":"0",
"robot_valid_flag":"1",
"offline_type":"1",
"access_human_time":"1584806400000",
"robotid": "1234",
"robot_alias": "test_alias",
"robot_name": "Robot Xiaoming",
"staffids":" 3695089d031c409380073081aaa73c7d,733e9edabb5c4158b095198aec58a890,3ff11cb243b540f78f8274f84b289920 ",
"invite_evaluation_flags":"0,1,1",
"channel_flag": " d720fe0e97ac427183c65b59f82c061f ",
"channel_name": "Android - official",
"response_duration": "0",
"response_count": "0",
"response_avg": "0",
"session_human_duration": "0",
"asHuman_interactive_count": "0",
"search_engine": "1",
"land_page_url": "http:// sg.sobot.io",
"land_page_title": "[official website] sobot - | sobot customer service online customer service system of science and technology Cloud call center Intelligent service robot Smart to call",
"conversation_page_url": "http:// sg.sobot.io",
"conversation_page_title": "[official website] sobot - | sobot customer service online customer service system of science and technology Cloud call center Intelligent service robot Smart to call",
"search_word": "service",
"lastrobotid": "1",
"lastrobot_name":"Anda"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ● Online Evaluation Message
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
staffid | String | Yes | Agent ID |
source | String | Yes | User sources:0 PC,1 WeChat,2 SDK,3 Weibo,4 Mobile site,6 call center,7 ticket center,8 customer center,9 WeCom,10 WeChat mini program,12 baidu,13 toutiao,14 360,15 Alibaba Huichuan,16 Sogou,17 WeChat customer service,20 Guangdian Tong,21 Zhihu,22 facebook,23 whatsApp,24 instagram,25 line,26 discord,33 telegram |
admin_name | String | Yes | Evaluation object, agent or bot |
is_robot | String | Yes | Whether it's a bot, 1: Bot, 0: Agent |
remark | String | Yes | Note information |
tag | String | No | Evaluation Tag |
score | String | Yes | 5-star score, 5 stars max, positive integer |
nps_score | String | Yes | 10-point score, 10 points max, integer |
visitorid | String | No | Visitor ID |
date_time | String | Yes | Time, unixtime ms, e.g.: 1539153409792 |
cid | String | Yes | Chat ID, the unique identifier of chat |
comment_type | String | Yes | Evaluation type: 0: Invited evaluation, 1: Proactive evaluation |
solved | String | Yes | Tag whether it's resolved, 1: Resolved, 0: Unresolved, -1: Not enabled |
Note: The unique primary key (cid+is_robot)
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, evaluation |
content | List | Yes | Message Content |
Sample request message:
{
"sys_code":"21",
"type":"evaluation",
"content":[
{
"companyid":" 5cc2c708202d4defaf72d4bcac362a55 ",
"staffid":"9517",
"source":"10",
"admin_name":"",
"is_robot":"1",
"remark":"Intended users can follow",
"tag":"If you don't answer the question, the question cannot be answered",
"score":"2",
"visitorid":" 97b31cba87e04dcdafe0ebb60248ecf4 ",
"date_time":" 1468340203266 ",
"cid":" 9ae05bc279544b68895cd86b12e418e0 ",
"comment_type":"1",
"solved":"1"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# ● Online Visitor Information
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
userid | String | Yes | Visitor ID |
img | String | No | Visitor avatar |
nick | String | Yes | Visitor nickname |
source | String | Yes | User sources:0 PC,1 WeChat,2 SDK,3 Weibo,4 Mobile site,6 call center,7 ticket center,8 customer center,9 WeCom,10 WeChat mini program,12 baidu,13 toutiao,14 360,15 Alibaba Huichuan,16 Sogou,17 WeChat customer service,20 Guangdian Tong,21 Zhihu,22 facebook,23 whatsApp,24 instagram,25 line,26 discord,33 telegram |
enterprise_name | String | No | Company name. The default value is null string |
user_tels | String | No | Phone no. Two or more phone nos shall be separated by comma "," |
user_emails | String | No | Email. Two or more email addresses shall be separated by comma "," |
String | No | QQ account | |
partnerid | String | No | Partner user ID |
user_name | String | No | Visitor name |
province_name | String | No | Province |
city_name | String | No | City name. The default value is null string |
area_name | String | No | County/district name. The default value is null string |
remark | String | No | Note information |
serviceid | String | Yes | Agent ID. Last reception agent |
cid | String | Yes | Chat ID |
params | String | No | Dynamic param, jsonString: passed by customer upon docking |
summary_params | String | No | Service summary related param, jsonString: passed by customer upon docking |
Note: The unique primary key (userid)
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, user |
content | List | Yes | Message Content |
Sample request message:
{
"type":"user",
"sys_code":"21",
"content":[
{
"companyid":" 5cc2c708202d4defaf72d4bcac362a55 ",
"userid":" 837213545777846 ",
"img":"https:// img.sobot.io/console/common/face/user.png",
"nick":"Merchant king",
"source":"10",
"enterprise_name":"",
"user_tels":" 13545777846 ",
"user_emails":"506003007@qq.com",
"qq":" 784383358 ",
"partnerid":" 13545777846 ",
"user_name":"admin01",
"province_name":"Shandong",
"city_name":"",
"area_name":"",
"remark":"",
"params":{
"KUID":" MTU2NjY0MzE1NTAwMDA3MTAz ",
"cookie":" 88a484e052f1455a8706213cd41c4c94 "
},
"serviceid":" ea6f8d1a5e8846fd8dfce4ab7057c45c ",
"cid":" 86937e82ae244ad59aeefe41af731079 "
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# ● Online Customer Information
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
userid | String | Yes | User ID |
img | String | Yes | User avatar |
nick | String | No | User's nickname |
source | String | Yes | User sources:0 PC,1 WeChat,2 SDK,3 Weibo,4 Mobile site,6 call center,7 ticket center,8 customer center,9 WeCom,10 WeChat mini program,12 baidu,13 toutiao,14 360,15 Alibaba Huichuan,16 Sogou,17 WeChat customer service,20 Guangdian Tong,21 Zhihu,22 facebook,23 whatsApp,24 instagram,25 line,26 discord,33 telegram |
enterprise_name | String | Yes | Company name. The default value is null string |
user_tels | String | No | User phone no. The default value is null string |
user_emails | String | No | User email. The default value is null string. This param may be separated by comma "," |
user_name | String | No | User real name. The default value is null string |
String | No | User QQ account. The default value is null string | |
country_name | String | No | country |
province_name | String | Yes | Province |
city_name | String | No | City name. The default value is null string |
area_name | String | No | County/district name. The default value is null string |
remark | String | No | Note. The default value is null string |
visitorids | String | No | Visitor ID. The default value is null string |
service_no | String | No | Agent work no. The default value is null string |
serviceid | String | Yes | Agent ID |
cid | String | Yes | Chat ID |
result_list | List | No | Custom Field |
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, userinfo |
content | List | Yes | Message Content |
Sample request message:
{
"sys_code":"21",
"type":"userinfo",
"content":[
{
"companyid":" 5cc2c708202d4defaf72d4bcac362a55 ",
"userid":" 837213545777846 ",
"img":"https:// img.sobot.io/console/common/face/user.png",
"nick":"Merchant king",
"source":"10",
"enterprise_name":"",
"user_tels":" 13545777846 ",
"user_emails":"506003007@qq.com",
"qq":" 784383358 ",
"partnerid":" 13545777846 ",
"user_name":"admin01",
"country_name": "China",
"province_name":"Shandong",
"city_name":"",
"area_name":"",
"remark":"",
"visitorids":"",
"service_no":"1011",
"serviceid":" ea6f8d1a5e8846fd8dfce4ab7057c45c ",
"cid":" bcfb6853edc446c0a4305692b9daf6c8 ",
"result_list":[
]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ● Live Chat Message
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
cid | String | Yes | Chat ID |
format_time | String | No | Time, format: yyyy-MM-dd HH:mm:ss |
timems | String | Yes | Timestamp, unixtime ms, e.g.: 1539153409792 |
senderid | String | Yes | Sender ID, the visitor ID or agent ID or bot ID |
sender_name | String | No | Sender |
receiverid | String | No | Receiver ID, the visitor ID or agent ID or bot ID |
receiver_name | String | No | Receiver |
msg | String | No | Chat content |
docid | string | No | Question ID. Only sender_type=1 messages have knowledge base question ID |
doc_name | string | No | Entry name. Only sender_type=1 messages have knowledge base question entry name |
sender_type | String | No | Sender type: 0: visitor, 1: bot, 2: agent |
receiver_type | String | No | Receiver type: 0: visitor, 1: bot, 2: agent, 3: no receiver (indicating that the message is offline message transferred from submission) |
msg_offline | String | Yes | Whether it's an offline message, 1: YES, 0: NO |
msgid | String | No | Unique key |
revoke_flag | String | No | Non-chat content data, withdrawn message: 1. This field is mutually exclusive with sender_type and receiver_type |
Note: The unique primary key is msgid.
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, msg |
content | List | Yes | Message Content |
Sample request message:
chat content:
{
"sys_code":"21",
"type":"msg",
"content":[
{
"companyid":" 5cc2c708202sasad2f72d4bcac362a55 ",
"cid":" 44c603626e2e4c82a5a49619a8aaa397 ",
"format_time":" 2017-11-01 12 :24: 04 ",
"timems":" 1509510244000 ",
"senderid":" 33c603626e434c82a5a49619aadde451 ",
"sender_name":"admin01",
"receiverid":" 25e603626e434c82a5a49619aaqw345 ",
"receiver_name":"admin01",
"msg":"What about a 3-day extension to the repayment date",
"docid":" 88c5342f51134db58ea59f430ad16939 ",
"doc_name":"Take a picture",
"sender_type":"0",
"receiver_type":"2",
"msg_offline":"0",
"msgid":"25e603626e434c82a5a49619aaqw345"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
withdraw a message:
{
"sys_code": "21",
"type": "msg",
"content": [
{
"companyid": "96804ad241f648079606cad5d28ca67b",
"senderid": "cd29b1a1751a495a824befcbf38ae909",
"revoke_flag": "1",
"msg_offline": "0",
"cid": "e874dee1eecd43b0bd545161508ecec9",
"timems": "1709537028479"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
# ● Online Service Summary
content object:
Param | Type | Required | Description |
---|---|---|---|
companyid | String | Yes | Company ID, applicable to separate statistics on a company with multiple super admin accounts or multiple branches |
cid | String | Yes | Chat ID |
visitorid | String | Yes | Visitor ID |
operationid | String | Yes | Business unit ID |
operation_name | String | Yes | Business Unit Name |
req_type | String | Yes | Business type ID list, separated by "-" |
req_type_name | String | Yes | Business type name list, separated by "-" |
summary_status | String | Yes | Resolution status: 1: Resolved, 0: Unresolved, -1: Unchecked |
summary_description | String | Yes | Note |
update_time | String | Yes | Update time, e.g.: "1577785628084" |
update_staffId | String | Yes | Operator ID |
invalid_flag | String | Yes | Service summary status: 1: Invalid chat, 0: Valid chat |
update_staff_name | String | Yes | Edit agent name in service summary content |
groupid | String | Yes | Skill group ID |
group_name | String | Yes | Skill Group Name |
fieldid | List<String> | No | Custom field ID list |
field_name | List<String> | No | Custom field name |
field_value | List<String> | No | Custom field value |
start_time | String | No | Chat establishment time |
summary_classify_names | String | No | classification of service |
summary_classify_paths | String | No | service classification path |
summary_classify_codes | String | No | service classification coding |
summary_template_name | String | No | service template |
summary_handle_progress | String | No | Processing progress value |
summary_handle_progress_name | String | No | Processing progress name |
summary_remark | String | No | remark |
customer_fields | List<Object> | No | Custom field |
Request param:
Param | Type | Required | Description |
---|---|---|---|
sys_code | String | Yes | Product code, 21 |
type | String | Yes | Message type, summary |
content | List | Yes | Message Content |
Sample request message:
{
"sys_code":"21",
"type":"summary",
"content":[
{
"chat_start_time":"1577779079941",
"group_name":"test",
"groupid":" ab900e0cea3f4247981631a7bdb0c694 ",
"summary_status":"1",
"field_name":[
" Field 1",
" Field 2"
],
"operation_name":"",
"update_staff_name":"admin03",
"companyid":" 7f72b9c5dee8425fba152a216e528cd4 ",
"update_time":" 1577779099437 ",
"invalid_flag":"0",
"operationid":" 1577330071201 ",
"field_value":[
"qweqeqw",
"eqweqwe"
],
"req_type_name":"mobile-computer",
"req_type":" 1577330173970-1577330182339 ",
"update_staffId":" 132dd5ef52b44dc3931f181980c61276 ",
"cid":" dfdc8f4dfaab44bbb463a5f8960a4cc7 ",
"visitorid":" d7a05991e58c35f1dede477a04205f92 ",
"summary_description":"qeqe",
"fieldid":[
" 3fc247578a294a3297a7418d521974fd ",
" 39303cc831c641ad93a5f0757cce69d7 "
],
"summary_classify_names": "test_class_name",
"summary_classify_paths": "test_class_paths",
"summary_classify_codes": "test_class_codes",
"summary_template_name": "testclasstemplate",
"summary_handle_progress": "1",
"summary_handle_progress_name": "testprogressname",
"summary_remark": "test_sumary_remark",
"customer_fields": [{
"field_name": "archer",
"field_value": "archer_custom_value",
"fieldid": "1733dc105d9c4862b51793fb2f90e76d"
}]
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# ● Message Forwarding Encryption
Based on the online message and online call message, Sobot provides encryption function.
Encryption condition:
It is necessary to contact the corresponding Sobot support personnel to enable the encryption setting item (provide the message receiving URL first) in the Sobot unified business support management system, and obtain the key provided by Sobot for decryption operation. After the setting item is enabled, the message will be actively pushed after 12:00 that night
Encryption method:
AES / CBC / ZeroPadding encryption
Encryption range:
After the encryption setting item is enabled, the current encryption range is:
type: user、userinfo、msg、evaluation、summary、conversation; the encrypted content is the content field.
type: ticket;the encrypted content is the content field.
type: calllog; the encrypted is the content for each piece of data in the Content array.
Encryption example:
user
{
"type":"user",
"sys_code":"21",
"content": " 0PKeYX9heDTiqE8Bi+sFBO9Id1OUvJCw9Okk0j9D/qhKvUyH2wbb61ggyCpO4czYzFvi0S0rrGuMTyYzr5mfwdcnq3nbG8QaZSzHDa3KbFcfF4QGPKU8NU5BvIv6EyU3Ul6KeZ3+ITG6jCD8MxqGE/WcIF1+t213iS1kEyz32TCLXsrrVpFRwz5oMRosaqjuLaofXCKSVSJbo3+/a+I7RQXDM+BYaLAyKn6dyYMTfbEnLCQCx+unkr2KPy2bnr03vGLdYPvNjusXuqitJb1YgToSqw/BfMOtwEjSrjlImtIGpnDtk7yrqxdbf4vF8Q5pPCuMJ65o8z6lwmceznXi/ZHpmDOc4LhSxNF5w5yUlCyjAGFgqe9VzpjsBjHhbNIAKZlMXMI6c5Z3S4p0nDKLfBXZum3PK7A1miyFpqlGbO6MURpU2HF8G3ZJL2woDaWbSrmFMNxjLH8h8KOZTOcYgr9/ptbeHjrA3bIsVDRa8hQ="
}
2
3
4
5
calllog
{
"type":"calllog",
"content": [
"0PKeYX9heDTiqE8Bi+sFBO9Id1OUvJCw9Okk0j9DITG6jCD8MxqGEBvIv6EyU3Ul6KeZ3",
"qhKvUyH2wbb61ggyCpO4czYzFvi0S0rrGuMTyYzr5mfwdcnq3nbG8QaZSzHDa3KbFcfFT"
]
}
2
3
4
5
6
7
Decrypt code instance
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
2
3
4
5
java code
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
public class AESEncrypt {
/**
* DES decode method
*
* @param data encrypt msg
* @param key The key used for encryption
* @return
*/
public static String desEncrypt(String data, String key) {
int subLength = 16 - key.length();
if (subLength >= 0) {
key = StringUtils.join(key, StringUtils.substring(key, 0, subLength));
}
String ivString = key;
byte[] iv = ivString.getBytes();
try {
byte[] encryp = Base64.getDecoder().decode(data);
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
IvParameterSpec ivSpec = new IvParameterSpec(iv);
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
byte[] original = cipher.doFinal(encryp);
return new String(original);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- content the encrypted is the content for each piece of data in the Content array (Java):
```java
/**
* DES decode method
* @param content encrypt msg
* @param key The key used for encryption
* @return String decode msg
*/
public static String dcodes(String content, String key) {
if (content == null || content.length() < 1) {
return null;
}
if (content.trim().length() < 19) {
return content;
}
byte[] byteRresult = new byte[content.length() / 2];
for (int i = 0; i < content.length() / 2; i++) {
int high = Integer.parseInt(content.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(content.substring(i * 2 + 1, i * 2 + 2), 16);
byteRresult[i] = (byte) (high * 16 + low);
}
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES");
SecureRandom random=SecureRandom.getInstance("SHA1PRNG");
random.setSeed(key.getBytes());
kgen.init(128, random);
SecretKey secretKey = kgen.generateKey();
byte[] enCodeFormat = secretKey.getEncoded();
SecretKeySpec secretKeySpec = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
byte[] result = cipher.doFinal(byteRresult);
return new String(result);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (NoSuchPaddingException e) {
e.printStackTrace();
} catch (InvalidKeyException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (BadPaddingException e) {
e.printStackTrace();
}
return null;
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47