TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
MessageChatrobotAsyncRequest req = new MessageChatrobotAsyncRequest();
MessageChatrobotAsyncRequest.AuthParam obj1 = new MessageChatrobotAsyncRequest.AuthParam();
obj1.setRequestToken("xxxxxxxxxx");
req.setAuthParam(obj1);
List<MessageChatrobotAsyncRequest.ActionBody> list3 = new ArrayList<MessageChatrobotAsyncRequest.ActionBody>();
MessageChatrobotAsyncRequest.ActionBody obj4 = new MessageChatrobotAsyncRequest.ActionBody();
list3.add(obj4);
MessageChatrobotAsyncRequest.ChatMessage obj6 = new MessageChatrobotAsyncRequest.ChatMessage();
obj6.setExt("{}");
obj6.setTags("{}");
obj6.setOptions("{}");
MessageChatrobotAsyncRequest.User obj7 = new MessageChatrobotAsyncRequest.User();
obj7.setNick("ww店铺测试账号003:xx");
obj7.setUserDomain("cntaobao");
obj7.setOpenUid("asdasdasdas");
obj6.setSender(obj7);
obj6.setCreateTime(1581476539000L);
obj6.setChannelType("bc");
obj6.setContent("{\"templateId\":\"1500058606222280\",\"templateData\":{\"text\":\"hello world\"}}");
obj6.setContentType(1L);
List<MessageChatrobotAsyncRequest.User> list9 = new ArrayList<MessageChatrobotAsyncRequest.User>();
MessageChatrobotAsyncRequest.User obj10 = new MessageChatrobotAsyncRequest.User();
list9.add(obj10);
obj10.setUserDomain("账号域");
obj10.setNick("ww店铺测试账号003:xx");
obj10.setOpenUid("asdasdsadsa");
obj6.setReceivers(list9);
list5.setBody(obj6);
MessageChatrobotAsyncRequest.Header obj12 = new MessageChatrobotAsyncRequest.Header();
obj12.setSerializeType("Json");
obj12.setCtx("{\"a\":\"b\"}");
obj12.setActionMode(1L);
obj12.setCreateTime(1581476539000L);
obj12.setType(1L);
obj12.setRequestId("xxxxx");
obj12.setTenantId(123L);
list11.setHeader(obj12);
req.setActions(list3);
MessageChatrobotAsyncResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());
ITopClient client = new DefaultTopClient(url, appkey, secret);
MessageChatrobotAsyncRequest req = new MessageChatrobotAsyncRequest();
MessageChatrobotAsyncRequest.AuthParamDomain obj1 = new MessageChatrobotAsyncRequest.AuthParamDomain();
obj1.RequestToken = "xxxxxxxxxx";
req.AuthParam_ = obj1;
List<MessageChatrobotAsyncRequest.ActionBodyDomain> list3 = new List<MessageChatrobotAsyncRequest.ActionBodyDomain>();
MessageChatrobotAsyncRequest.ActionBodyDomain obj4 = new MessageChatrobotAsyncRequest.ActionBodyDomain();
list3.Add(obj4);
MessageChatrobotAsyncRequest.ChatMessageDomain obj5 = new MessageChatrobotAsyncRequest.ChatMessageDomain();
obj5.Ext = "{}";
obj5.Tags = "{}";
obj5.Options = "{}";
MessageChatrobotAsyncRequest.UserDomain obj6 = new MessageChatrobotAsyncRequest.UserDomain();
obj6.Nick = "ww店铺测试账号003:xx";
obj6.UserDomain = "cntaobao";
obj6.OpenUid = "asdasdasdas";
obj5.Sender= obj6;
obj5.CreateTime = 1581476539000L;
obj5.ChannelType = "bc";
obj5.Content = "{\"templateId\":\"1500058606222280\",\"templateData\":{\"text\":\"hello world\"}}";
obj5.ContentType = 1L;
List<MessageChatrobotAsyncRequest.UserDomain> list8 = new List<MessageChatrobotAsyncRequest.UserDomain>();
MessageChatrobotAsyncRequest.UserDomain obj9 = new MessageChatrobotAsyncRequest.UserDomain();
list8.Add(obj9);
obj9.UserDomain = "账号域";
obj9.Nick = "ww店铺测试账号003:xx";
obj9.OpenUid = "asdasdsadsa";
obj5.Receivers= list8;
obj4.Body= obj5;
MessageChatrobotAsyncRequest.HeaderDomain obj10 = new MessageChatrobotAsyncRequest.HeaderDomain();
obj10.SerializeType = "Json";
obj10.Ctx = "{\"a\":\"b\"}";
obj10.ActionMode = 1L;
obj10.CreateTime = 1581476539000L;
obj10.Type = 1L;
obj10.RequestId = "xxxxx";
obj10.TenantId = 123L;
obj4.Header= obj10;
req.Actions_ = list3;
MessageChatrobotAsyncResponse rsp = client.Execute(req, sessionKey);
Console.WriteLine(rsp.Body);
$c = new TopClient;
$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new MessageChatrobotAsyncRequest;
$auth_param = new AuthParam;
$auth_param->request_token="xxxxxxxxxx";
$req->setAuthParam(json_encode($auth_param));
$actions = new ActionBody;
$body = new ChatMessage;
$body->ext="{}";
$body->tags="{}";
$body->options="{}";
$sender = new User;
$sender->nick="ww店铺测试账号003:xx";
$sender->user_domain="cntaobao";
$sender->open_uid="asdasdasdas";
$body->sender = $sender;
$body->create_time="1581476539000";
$body->channel_type="bc";
$body->content="{\"templateId\":\"1500058606222280\",\"templateData\":{\"text\":\"hello world\"}}";
$body->content_type="1";
$receivers = new User;
$receivers->user_domain="账号域";
$receivers->nick="ww店铺测试账号003:xx";
$receivers->open_uid="asdasdsadsa";
$body->receivers = $receivers;
$actions->body = $body;
$header = new Header;
$header->serialize_type="Json";
$header->ctx="{\"a\":\"b\"}";
$header->action_mode="1";
$header->create_time="1581476539000";
$header->type="1";
$header->request_id="xxxxx";
$header->tenant_id="123";
$actions->header = $header;
$req->setActions(json_encode($actions));
$resp = $c->execute($req, $sessionKey);
curl -X POST 'http://gw.api.taobao.com/router/rest' \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'app_key=12129701' \
-d 'format=json' \
-d 'method=taobao.message.chatrobot.async' \
-d 'partner_id=apidoc' \
-d 'session=6af3e8b2-82ef-466b-bc5c-a2d696349eac' \
-d 'sign=87111DA4BAC4A676D06C963A364F6BEB' \
-d 'sign_method=hmac' \
-d 'timestamp=2025-04-26+13%3A14%3A23' \
-d 'v=2.0' \
-d 'actions=null' \
-d 'auth_param=null'
# -*- coding: utf-8 -*-
import top.api
req=top.api.MessageChatrobotAsyncRequest(url,port)
req.set_app_info(top.appinfo(appkey,secret))
req.auth_param=""
req.actions=""
try:
resp= req.getResponse(sessionkey)
print(resp)
except Exception,e:
print(e)
pTopRequest pRequest = alloc_top_request();
pTopResponse pResponse = NULL;
pTaobaoClient pClient = alloc_taobao_client(url, appkey, appsecret);
set_api_name(pRequest,"taobao.message.chatrobot.async");
add_param(pRequest,"auth_param","数据结构JSON示例");
add_param(pRequest,"actions","数据结构JSON示例");
pResponse = top_execute(pClient,pRequest,sessionKey);
printf("ret code:%d\n",pResponse->code);
if(pResponse->code == 0){
pTopResponseIterator ite = init_response_iterator(pResponse);
pResultItem pResultItem = alloc_result_item();
while(parseNext(ite, pResultItem) == 0){
printf("%s:%s\n",pResultItem->key,pResultItem->value);
}
destroy_response_iterator(ite);
destroy_result_item(pResultItem);
}
destroy_top_request(pRequest);
destroy_top_response(pResponse);
destroy_taobao_client(pClient);
TopClient = require('./topClient').TopClient;
var client = new TopClient({
'appkey': 'appkey',
'appsecret': 'secret',
'REST_URL': 'http://gw.api.taobao.com/router/rest'
});
client.execute('taobao.message.chatrobot.async', {
'auth_param':'数据结构JSON示例',
'actions':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})