1

I'm trying to send data to RingCentral Glip using their webhook process from php on Linux.

What I'm actually doing is processing incoming mail messages and reformatting them into a Glip message format and then submitting them via the Glip webhook.
But I've run into what appears to be a character set compatibility problem.

I'm not entirely sure of what character set Glip supports, but I've tried formatting it in UTF-8 and when I submit it the message never gets posted.

If I just use plain ASCII characters the message posts without any problem.

Does anyone know what format Glip requires?
Is there any existing code libraries that people would use with PHP to transform text into that format?

Grokify
  • 15,092
  • 6
  • 60
  • 81

2 Answers2

1

The answer in my case was that I don't know what character format is required by GLIP but I do know now that it wasn't causing my problem. It turns out that I had two bugs that resulted in my message body being erased and if you send a message to glip with an empty body it submits an empty message rather than just showing the activity and title information that is set (as you would expect if the body was blank) it just treats it as entirely blank.

0

UTF-8 works for me without any special conversion as shown below. Is it possible that the email conversion to UTF-8 isn't working as expected? Can you post an example of the UTF-8 that isn't working for you, along with what you are expecting?

The following demo message works fine for me with JSON and screenshot provided. I've added ♠♥♣♦ to every text field for verification.

You can find the example Go code here:

Code: 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
    }
  ]
}

Glip Webhook Example

More information is available on the message formatting here:

http://ringcentral-api-docs.readthedocs.io/en/latest/glip_message_attachments/

Grokify
  • 15,092
  • 6
  • 60
  • 81
  • 1
    Thanks for the testing. I see you are using Go, I'm using PHP. That said, your post was extremely helpful to me as I realised it should work. Experimenting showed that there were two bugs in my code that nullified message contents. It seems that if the message contents are blank, glip actually doesn't show any of the other information you supply it, and instead just posts a completely blank post. So my problem wasn't the encoding of the characters after all, but that my code was blanking the message and glip takes a blank message and blanks EVERYTHING. thanks for your help! – Stephen Wilkey Jan 29 '18 at 09:35
  • The JSON body was more important than the actual code here just to show UTF-8 works. Glad you figured it out and thanks for reporting your findings! – Grokify Jan 29 '18 at 14:06