[英]Google Appscript - Post info from a sheet to a Google Community?
Is there a way to write an appscript (inside the sheet) that posts info (in this case, statistics) to a Google Community?有没有办法编写将信息(在本例中为统计信息)发布到 Google 社区的应用脚本(在工作表内)? I have found an API script for something similar :
我找到了一个类似的 API 脚本:
function createPost() {
var userId = 'me';
var post = {
object: {
originalContent : 'Happy Monday! #caseofthemondays'
},
access: {
items: [{
type: 'domain'
}],
domainRestricted: true
}
};
post = PlusDomains.Activities.insert(post, userId);
Logger.log('Post created with URL: %s', post.url);
}
But how would I go about pointing that to a specific google community?但是我将如何将其指向特定的谷歌社区?
As mentioned at topmost of your given link , the Google+ Domains service allows you to use the Google+ Domains API in Apps Script.正如您在给定链接的最上面所提到的,Google+ Domains 服务允许您在 Apps Script 中使用Google+ Domains API 。
With the use of Google+ Domains API, you can set restrictions to your posts or give access control to one or more of the following audiences:通过使用 Google+ Domains API,您可以对您的帖子设置限制或对以下一个或多个受众群体进行访问控制:
When sharing an activity, a user can specify the desired audience such as an individual person or one of their circles.共享活动时,用户可以指定所需的受众,例如个人或其圈子之一。 When calling the Google+ Domains API, this audience is specified using the access property.
调用 Google+ Domains API 时,此受众是使用访问属性指定的。 For example, the following activity is being shared with a circle:
例如,正在与圈子分享以下活动:
{
/* ... */
"access": {
"items": [
{
"type": "circle", "id": "5678"
}
],
"domainRestricted": true
}
}
To successfully implement this, you should also add members of that particular circle by using Circles: addPeople .要成功实现这一点,您还应该使用Circles: addPeople添加该特定圈子的成员。 With proper authorization and scopes, you can send a request using the following sample format:
通过适当的授权和范围,您可以使用以下示例格式发送请求:
PUT https://www.googleapis.com/plusDomains/v1/circles/circleId/people
Please try going through the given documentations for more information and other options like sharing to multiple audiences.请尝试浏览给定的文档以获取更多信息和其他选项,例如与多个受众共享。
Hope that helps!希望有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.