|
Message
It is possible to send Messages. The recipients, title, and content can be specified.
jQuery.ajax, jQuery.post, jQuery.postData en, ja opensocial-0.8 is required for datatype="data" in jQuery.ajax <ModulePrefs title="opensocial-jquery"> <Require feature="opensocial-0.8" /> </ModulePrefs> Sending a MessagejQuery.ajax can be used to send a Message from the VIEWER $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: {
recipients: '@owner',
title: 'Say hello!',
body: 'You should be shining!'
},
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});This can also be done using jQuery.post $.post(
'/messages/@viewer/@outbox', {
recipients: '@owner',
title: 'Say hello!',
body: 'You should be shining!'
},
function() {},
'data'
});The same can be done using jQuery.postData $.postData (
'/messages/@viewer/@outbox', {
recipients: '@owner',
title: 'Say hello!',
body: 'You should be shining!'
},
function() {}
});Specify RecipientsThe recipients' parameter can be used to specify recipients. Specify one from @viewer, @owner, @viewer/@friends, @owner/@friends, or your User ID. $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: { recipients: '@viewer/@friends' },
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});Specify a TitleThe title parameter can be used to specify a title. $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: { title: 'Say hello!' },
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});Furthermore, titleId can be used to specify a template ID for a title $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: { titleId: 'TEMPLATE_ID' },
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});Specify Body TextThe body parameters can be used to specify the body text. $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: { body: 'Say hello!' },
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});Moreover, bodyId can be used to specify the template ID for the body text. $.ajax({
type: 'post',
url: '/messages/@viewer/@outbox',
data: { bodyId: 'TEMPLATE_ID' },
dataType: 'data',
success: function(data, status) {},
error: function(xhr, status, e) {
console.log('error', xhr, status, e);
}
});
|
► Sign in to add a comment
mixiアプリでもrequestSendMessageが使えるようになってみたいですね。
mixi Developer Center (ミクシィ デベロッパーセンター) » ユーザにメッセージを送信してみよう http://developer.mixi.co.jp/appli/pc/lets_enjoy_making_mixiapp/send_message
上記が活用できるか試してみようと思います。
同じく試してみました。結論からいうと、使えました。
mixi がメッセージ送信 API に対応したので試してみました http://groups.google.com/group/opensocial-jquery/browse_thread/thread/b3c736d5acfa80a6