我正在尝试使用他们在Linux上的php的webhook进程向RingCentral Glip发送数据。
我实际做的是处理收到的邮件消息,并将它们重新格式化为Glip消息格式,然后通过Glip webhook提交它们。
但我遇到了一个似乎是字符集兼容性问题。
我不完全确定Glip支持什么字符集,但我尝试过用UTF-8格式化它,当我提交它时,消息永远不会发布。
如果我只使用普通的ASCII字符,消息发布时没有任何问题。
有人知道Glip需要什么格式吗?
有没有什么现成的代码库可以让人们用PHP把文本转换成这种格式?
发布于 2018-01-29 17:30:51
在我的案例中,答案是我不知道GLIP需要什么字符格式,但我现在知道这不是导致我的问题的原因。事实证明,我有两个bug,导致我的消息正文被擦除,如果您发送一条消息到glip,并且正文是空的,它会提交一个空消息,而不是只显示设置的活动和标题信息(如果正文是空的,您会认为它是空的),它只是将其视为完全空白。
发布于 2018-01-29 04:01:15
UTF-8对我来说没有任何特殊的转换,如下所示。有没有可能电子邮件到UTF-8的转换没有像预期的那样工作?你能发布一个UTF-8不适合你的例子,以及你所期望的吗?
下面的演示消息很适合我提供的JSON和屏幕截图。我已经将♠♥♣♦添加到每个文本字段中以进行验证。
https://www.fileformat.info/info/unicode/char/2660
你可以在这里找到示例Go代码:
代码:github.com/grokify/go-glip/...
{
"icon": "https://i.imgur.com/9yILi61.png",
"title": "**Title of the post ♠♥♣♦**",
"body": "Body of the post ♠♥♣♦",
"attachments": [
{
"color": "#00ff2a",
"pretext": "Attachment pretext appears before the attachment block ♠♥♣♦",
"author_name": "Author Name ♠♥♣♦",
"author_link": "https://example.com/author_link",
"author_icon": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/000080_Navy_Blue_Square.svg/1200px-000080_Navy_Blue_Square.svg.png",
"title": "Attachment Title ♠♥♣♦",
"title_link": "https://example.com/title_link",
"fields": [
{
"title": "Field 1 ♠♥♣♦",
"value": "A short field ♠♥♣♦",
"short": true
},
{
"title": "Field 2",
"value": "This is [a linked short field](https://example.com)",
"short": true
},
{
"title": "Field 3 ♠♥♣♦",
"value": "A long, full-width field with *formatting* and [a link](https://example.com) \n\n ♠♥♣♦"
}
],
"text": "Attachment text ♠♥♣♦",
"image_url": "https://media3.giphy.com/media/l4FssTixISsPStXRC/giphy.gif",
"thumbnail_url": "https://funkybuddhabrewery.com/sites/default/files/WorldBeerCupGold.png",
"footer": "Attachment footer and timestamp ♠♥♣♦",
"footer_icon": "http://www.iconsdb.com/icons/preview/red/square-ios-app-xxl.png",
"ts": 1517169226
}
]
}

有关邮件格式的更多信息,请单击此处:
http://ringcentral-api-docs.readthedocs.io/en/latest/glip_message_attachments/
https://stackoverflow.com/questions/48487471
复制相似问题