简体   繁体   English

Glip chat API是否支持图像(照片)附件?

[英]Does the Glip chat API support image (photo) attachments?

I'm using the Glip API to post messages. 我正在使用Glip API发布消息。 I can post images from the Glip UI but I don't see an option to post images. 我可以从Glip UI发布图像,但是看不到发布图像的选项。 Does anyone know how to do this? 有谁知道如何做到这一点?

Glip recently launched the file upload API which can be used to attach images. Glip最近启动了文件上传API ,可用于附加图像。 You could also try it out using our API Explorer . 您也可以使用我们的API Explorer尝试一下。

In case someone comes across this looking for a working example, here's what I did (using Node and the RingCentral SDK): 如果有人遇到这个问题寻找工作示例,这就是我所做的(使用Node和RingCentral SDK):

var RC = require('ringcentral');
var fs = require('fs');
var FormData = require('form-data');

// {login to Glip and generate the platform object (https://github.com/ringcentral/ringcentral-js)}

var formData = new FormData();
formData.append('attachment', fs.createReadStream('image.png'));

platform
   .send({
       method: 'POST',
       url: '/glip/files',
       body: formData,
       query: {
          groupId: '1234', // whatever group you want to post to
       }
    })
    .then(function(){
       console.log('file uploaded');
    })
    .catch(function(e){
       console.log(e.message);
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM