DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/chat/send");
OapiChatSendRequest req = new OapiChatSendRequest();
req.setChatid("chatxxx");
ActionCard obj1 = new ActionCard();
obj1.setTitle("透出到会话列表和通知的文案");
obj1.setMarkdown("消息内容");
obj1.setSingleTitle("111");
obj1.setSingleUrl("url");
obj1.setBtnOrientation("1");
List<BtnJson> list3 = new ArrayList<BtnJson>();
BtnJson obj4 = new BtnJson();
list3.add(obj4);
obj4.setTitle("111");
obj4.setActionUrl("url");
obj1.setBtnJsonList(list3);
obj1.setAgentid("111");
obj1.setHideAvatar(true);
req.setActionCard(obj1);
Oa obj5 = new Oa();
obj5.setMessageUrl("消息链接");
obj5.setPcMessageUrl("pc端消息链接");
Head obj6 = new Head();
obj6.setText("消息头部标题");
obj6.setBgcolor("FFBBBBBB");
obj5.setHead(obj6);
Body obj7 = new Body();
obj7.setTitle("消息体的标题");
obj7.setContent("消息体的内容");
obj7.setImage("mediaId");
obj7.setFileCount("1");
obj7.setAuthor("自定义的作者名字");
Rich obj8 = new Rich();
obj8.setNum("1");
obj8.setUnit("1");
obj7.setRich(obj8);
List<Form> list10 = new ArrayList<Form>();
Form obj11 = new Form();
list10.add(obj11);
obj11.setKey("key");
obj11.setValue("value");
obj7.setForm(list10);
obj5.setBody(obj7);
req.setOa(obj5);
Voice obj12 = new Voice();
obj12.setMediaId("mediaId");
obj12.setDuration(100L);
req.setVoice(obj12);
File obj13 = new File();
obj13.setMediaId("mediaId");
req.setFile(obj13);
Image obj14 = new Image();
obj14.setMediaId("mediaId");
req.setImage(obj14);
Link obj15 = new Link();
obj15.setTitle("消息标题");
obj15.setText("消息文本");
obj15.setPicUrl("picUrl");
obj15.setMessageUrl("messageUrl");
req.setLink(obj15);
Text obj16 = new Text();
obj16.setContent("文本消息内容");
req.setText(obj16);
req.setMsgtype("text");
Markdown obj17 = new Markdown();
obj17.setTitle("首屏会话透出的展示内容");
obj17.setText("markdown格式的消息");
req.setMarkdown(obj17);
Msg obj18 = new Msg();
Text obj19 = new Text();
obj19.setContent("txt");
obj18.setText(obj19);
obj18.setMsgtype("text");
Link obj20 = new Link();
obj20.setMessageUrl("messageUrl");
obj20.setPicUrl("picUrl");
obj20.setText("消息文本");
obj20.setTitle("消息标题");
obj18.setLink(obj20);
Image obj21 = new Image();
obj21.setMediaId("@mediaId");
obj18.setImage(obj21);
File obj22 = new File();
obj22.setMediaId("@mediaId");
obj18.setFile(obj22);
Voice obj23 = new Voice();
obj23.setMediaId("@mediaId");
obj23.setDuration(100L);
obj18.setVoice(obj23);
Oa obj24 = new Oa();
Head obj25 = new Head();
obj25.setBgcolor("bgcolor");
obj25.setText("text");
obj24.setHead(obj25);
obj24.setMessageUrl("message_url");
obj24.setPcMessageUrl("pc_message_url");
Body obj26 = new Body();
List<Form> list28 = new ArrayList<Form>();
Form obj29 = new Form();
list28.add(obj29);
obj29.setValue("value");
obj29.setKey("key");
obj26.setForm(list28);
Rich obj30 = new Rich();
obj30.setUnit("unit");
obj30.setNum("num");
obj26.setRich(obj30);
obj26.setAuthor("author");
obj26.setFileCount("file_count");
obj26.setImage("image");
obj26.setContent("content");
obj26.setTitle("title");
obj24.setBody(obj26);
obj18.setOa(obj24);
ActionCard obj31 = new ActionCard();
obj31.setAgentid("agentid");
List<BtnJsonList> list33 = new ArrayList<BtnJsonList>();
BtnJsonList obj34 = new BtnJsonList();
list33.add(obj34);
obj34.setActionUrl("action_url");
obj34.setTitle("title");
obj31.setBtnJsonList(list33);
obj31.setBtnOrientation("0");
obj31.setSingleUrl("single_url");
obj31.setSingleTitle("single_title");
obj31.setMarkdown("markdown");
obj31.setTitle("title");
obj31.setHideAvatar(true);
obj18.setActionCard(obj31);
Markdown obj35 = new Markdown();
obj35.setText("text");
obj35.setTitle("title");
obj18.setMarkdown(obj35);
req.setMsg(obj18);
OapiChatSendResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/chat/send");
OapiChatSendRequest req = new OapiChatSendRequest();
req.Chatid = "chatxxx";
OapiChatSendRequest.ActionCardDomain obj1 = new OapiChatSendRequest.ActionCardDomain();
obj1.Title = "透出到会话列表和通知的文案";
obj1.Markdown = "消息内容";
obj1.SingleTitle = "111";
obj1.SingleUrl = "url";
obj1.BtnOrientation = "1";
List<OapiChatSendRequest.BtnJsonDomain> list3 = new List<OapiChatSendRequest.BtnJsonDomain>();
OapiChatSendRequest.BtnJsonDomain obj4 = new OapiChatSendRequest.BtnJsonDomain();
list3.Add(obj4);
obj4.Title = "111";
obj4.ActionUrl = "url";
obj1.BtnJsonList= list3;
obj1.Agentid = "111";
obj1.HideAvatar = true;
req.ActionCard_ = obj1;
OapiChatSendRequest.OaDomain obj5 = new OapiChatSendRequest.OaDomain();
obj5.MessageUrl = "消息链接";
obj5.PcMessageUrl = "pc端消息链接";
OapiChatSendRequest.HeadDomain obj6 = new OapiChatSendRequest.HeadDomain();
obj6.Text = "消息头部标题";
obj6.Bgcolor = "FFBBBBBB";
obj5.Head= obj6;
OapiChatSendRequest.BodyDomain obj7 = new OapiChatSendRequest.BodyDomain();
obj7.Title = "消息体的标题";
obj7.Content = "消息体的内容";
obj7.Image = "mediaId";
obj7.FileCount = "1";
obj7.Author = "自定义的作者名字";
OapiChatSendRequest.RichDomain obj8 = new OapiChatSendRequest.RichDomain();
obj8.Num = "1";
obj8.Unit = "1";
obj7.Rich= obj8;
List<OapiChatSendRequest.FormDomain> list10 = new List<OapiChatSendRequest.FormDomain>();
OapiChatSendRequest.FormDomain obj11 = new OapiChatSendRequest.FormDomain();
list10.Add(obj11);
obj11.Key = "key";
obj11.Value = "value";
obj7.Form= list10;
obj5.Body= obj7;
req.Oa_ = obj5;
OapiChatSendRequest.VoiceDomain obj12 = new OapiChatSendRequest.VoiceDomain();
obj12.MediaId = "mediaId";
obj12.Duration = 100L;
req.Voice_ = obj12;
OapiChatSendRequest.FileDomain obj13 = new OapiChatSendRequest.FileDomain();
obj13.MediaId = "mediaId";
req.File_ = obj13;
OapiChatSendRequest.ImageDomain obj14 = new OapiChatSendRequest.ImageDomain();
obj14.MediaId = "mediaId";
req.Image_ = obj14;
OapiChatSendRequest.LinkDomain obj15 = new OapiChatSendRequest.LinkDomain();
obj15.Title = "消息标题";
obj15.Text = "消息文本";
obj15.PicUrl = "picUrl";
obj15.MessageUrl = "messageUrl";
req.Link_ = obj15;
OapiChatSendRequest.TextDomain obj16 = new OapiChatSendRequest.TextDomain();
obj16.Content = "文本消息内容";
req.Text_ = obj16;
req.Msgtype = "text";
OapiChatSendRequest.MarkdownDomain obj17 = new OapiChatSendRequest.MarkdownDomain();
obj17.Title = "首屏会话透出的展示内容";
obj17.Text = "markdown格式的消息";
req.Markdown_ = obj17;
OapiChatSendRequest.MsgDomain obj18 = new OapiChatSendRequest.MsgDomain();
OapiChatSendRequest.TextDomain obj19 = new OapiChatSendRequest.TextDomain();
obj19.Content = "txt";
obj18.Text= obj19;
obj18.Msgtype = "text";
OapiChatSendRequest.LinkDomain obj20 = new OapiChatSendRequest.LinkDomain();
obj20.MessageUrl = "messageUrl";
obj20.PicUrl = "picUrl";
obj20.Text = "消息文本";
obj20.Title = "消息标题";
obj18.Link= obj20;
OapiChatSendRequest.ImageDomain obj21 = new OapiChatSendRequest.ImageDomain();
obj21.MediaId = "@mediaId";
obj18.Image= obj21;
OapiChatSendRequest.FileDomain obj22 = new OapiChatSendRequest.FileDomain();
obj22.MediaId = "@mediaId";
obj18.File= obj22;
OapiChatSendRequest.VoiceDomain obj23 = new OapiChatSendRequest.VoiceDomain();
obj23.MediaId = "@mediaId";
obj23.Duration = 100L;
obj18.Voice= obj23;
OapiChatSendRequest.OaDomain obj24 = new OapiChatSendRequest.OaDomain();
OapiChatSendRequest.HeadDomain obj25 = new OapiChatSendRequest.HeadDomain();
obj25.Bgcolor = "bgcolor";
obj25.Text = "text";
obj24.Head= obj25;
obj24.MessageUrl = "message_url";
obj24.PcMessageUrl = "pc_message_url";
OapiChatSendRequest.BodyDomain obj26 = new OapiChatSendRequest.BodyDomain();
List<OapiChatSendRequest.FormDomain> list28 = new List<OapiChatSendRequest.FormDomain>();
OapiChatSendRequest.FormDomain obj29 = new OapiChatSendRequest.FormDomain();
list28.Add(obj29);
obj29.Value = "value";
obj29.Key = "key";
obj26.Form= list28;
OapiChatSendRequest.RichDomain obj30 = new OapiChatSendRequest.RichDomain();
obj30.Unit = "unit";
obj30.Num = "num";
obj26.Rich= obj30;
obj26.Author = "author";
obj26.FileCount = "file_count";
obj26.Image = "image";
obj26.Content = "content";
obj26.Title = "title";
obj24.Body= obj26;
obj18.Oa= obj24;
OapiChatSendRequest.ActionCardDomain obj31 = new OapiChatSendRequest.ActionCardDomain();
obj31.Agentid = "agentid";
List<OapiChatSendRequest.BtnJsonListDomain> list33 = new List<OapiChatSendRequest.BtnJsonListDomain>();
OapiChatSendRequest.BtnJsonListDomain obj34 = new OapiChatSendRequest.BtnJsonListDomain();
list33.Add(obj34);
obj34.ActionUrl = "action_url";
obj34.Title = "title";
obj31.BtnJsonList= list33;
obj31.BtnOrientation = "0";
obj31.SingleUrl = "single_url";
obj31.SingleTitle = "single_title";
obj31.Markdown = "markdown";
obj31.Title = "title";
obj31.HideAvatar = true;
obj18.ActionCard= obj31;
OapiChatSendRequest.MarkdownDomain obj35 = new OapiChatSendRequest.MarkdownDomain();
obj35.Text = "text";
obj35.Title = "title";
obj18.Markdown= obj35;
req.Msg_ = obj18;
OapiChatSendResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiChatSendRequest;
$req->setChatid("chatxxx");
$action_card = new ActionCard;
$action_card->title="透出到会话列表和通知的文案";
$action_card->markdown="消息内容";
$action_card->single_title="111";
$action_card->single_url="url";
$action_card->btn_orientation="1";
$btn_json_list = new BtnJson;
$btn_json_list->title="111";
$btn_json_list->action_url="url";
$action_card->btn_json_list = array($btn_json_list);
$action_card->agentid="111";
$action_card->hide_avatar="true";
$req->setActionCard($action_card);
$oa = new Oa;
$oa->message_url="消息链接";
$oa->pc_message_url="pc端消息链接";
$head = new Head;
$head->text="消息头部标题";
$head->bgcolor="FFBBBBBB";
$oa->head = $head;
$body = new Body;
$body->title="消息体的标题";
$body->content="消息体的内容";
$body->image="mediaId";
$body->file_count="1";
$body->author="自定义的作者名字";
$rich = new Rich;
$rich->num="1";
$rich->unit="1";
$body->rich = $rich;
$form = new Form;
$form->key="key";
$form->value="value";
$body->form = array($form);
$oa->body = $body;
$req->setOa($oa);
$voice = new Voice;
$voice->media_id="mediaId";
$voice->duration="100";
$req->setVoice($voice);
$file = new File;
$file->media_id="mediaId";
$req->setFile($file);
$image = new Image;
$image->media_id="mediaId";
$req->setImage($image);
$link = new Link;
$link->title="消息标题";
$link->text="消息文本";
$link->picUrl="picUrl";
$link->messageUrl="messageUrl";
$req->setLink($link);
$text = new Text;
$text->content="文本消息内容";
$req->setText($text);
$req->setMsgtype("text");
$markdown = new Markdown;
$markdown->title="首屏会话透出的展示内容";
$markdown->text="markdown格式的消息";
$req->setMarkdown($markdown);
$msg = new Msg;
$text = new Text;
$text->content="txt";
$msg->text = $text;
$msg->msgtype="text";
$link = new Link;
$link->messageUrl="messageUrl";
$link->picUrl="picUrl";
$link->text="消息文本";
$link->title="消息标题";
$msg->link = $link;
$image = new Image;
$image->media_id="@mediaId";
$msg->image = $image;
$file = new File;
$file->media_id="@mediaId";
$msg->file = $file;
$voice = new Voice;
$voice->media_id="@mediaId";
$voice->duration="100";
$msg->voice = $voice;
$oa = new Oa;
$head = new Head;
$head->bgcolor="bgcolor";
$head->text="text";
$oa->head = $head;
$oa->message_url="message_url";
$oa->pc_message_url="pc_message_url";
$body = new Body;
$form = new Form;
$form->value="value";
$form->key="key";
$body->form = array($form);
$rich = new Rich;
$rich->unit="unit";
$rich->num="num";
$body->rich = $rich;
$body->author="author";
$body->file_count="file_count";
$body->image="image";
$body->content="content";
$body->title="title";
$oa->body = $body;
$msg->oa = $oa;
$action_card = new ActionCard;
$action_card->agentid="agentid";
$btn_json_list = new BtnJsonList;
$btn_json_list->action_url="action_url";
$btn_json_list->title="title";
$action_card->btn_json_list = array($btn_json_list);
$action_card->btn_orientation="0";
$action_card->single_url="single_url";
$action_card->single_title="single_title";
$action_card->markdown="markdown";
$action_card->title="title";
$action_card->hide_avatar="true";
$msg->action_card = $action_card;
$markdown = new Markdown;
$markdown->text="text";
$markdown->title="title";
$msg->markdown = $markdown;
$req->setMsg($msg);
$resp = $c->execute($req, $access_token, "https://oapi.dingtalk.com/chat/send");
curl -X POST "https://oapi.dingtalk.com/chat/send" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=d2d14fd5-1acb-4d23-97a0-2d851e754702' \
-d 'action_card=null' \
-d 'chatid=chatxxx' \
-d 'file=null' \
-d 'image=null' \
-d 'link=null' \
-d 'markdown=null' \
-d 'msg=null' \
-d 'msgtype=text' \
-d 'oa=null' \
-d 'text=null' \
-d 'voice=null'
# -*- coding: utf-8 -*-
import dingtalk.api
req=dingtalk.api.OapiChatSendRequest("https://oapi.dingtalk.com/chat/send")
req.chatid="chatxxx"
req.action_card=""
req.oa=""
req.voice=""
req.file=""
req.image=""
req.link=""
req.text=""
req.msgtype="text"
req.markdown=""
req.msg=""
try:
resp= req.getResponse(access_token)
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,"dingtalk.oapi.chat.send");
add_param(pRequest,"chatid","chatxxx");
add_param(pRequest,"action_card","数据结构JSON示例");
add_param(pRequest,"oa","数据结构JSON示例");
add_param(pRequest,"voice","数据结构JSON示例");
add_param(pRequest,"file","数据结构JSON示例");
add_param(pRequest,"image","数据结构JSON示例");
add_param(pRequest,"link","数据结构JSON示例");
add_param(pRequest,"text","数据结构JSON示例");
add_param(pRequest,"msgtype","text");
add_param(pRequest,"markdown","数据结构JSON示例");
add_param(pRequest,"msg","数据结构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('dingtalk.oapi.chat.send', {
'chatid':'chatxxx',
'action_card':'数据结构JSON示例',
'oa':'数据结构JSON示例',
'voice':'数据结构JSON示例',
'file':'数据结构JSON示例',
'image':'数据结构JSON示例',
'link':'数据结构JSON示例',
'text':'数据结构JSON示例',
'msgtype':'text',
'markdown':'数据结构JSON示例',
'msg':'数据结构JSON示例'
}, function(error, response) {
if (!error) console.log(response);
else console.log(error);
})