API: Creating a forum chat message

Team Ryver API, Integration

The good news on the Ryver APIs is that we built the product from the ground-up to be API-based. Our client is a single-page JavaScript application, so all server communication is through our APIs. Our Zapier app is also written using our Web Service APIs.

The bad news is that we are still a few weeks out from having built-in webhook support, along with OAuth and API Token authentication. We have put off setting up a developer site until we have those things.

If you are ok with using Basic Authentication while we finish up our OAuth and API Token support, here is an example of how you could create a chat message in a Forum:

EXAMPLE: Sending a Chat Message to a forum, with BitBucket as the “sender”

Authentication:
Currently, we only support Basic Auth. We will be adding API Token support. For doing your Basic Auth credentials, you could create a separate user that you just use for integrations, but you would need to add them to each Forum/Team you want to send a message to.

Note: Basic authorization takes “username:password”, but you need to convert it to Base64, which will look something like the example below.

Headers:

Content-Type: application/json
Accept: application/json
Authorization: Basic acVmZi1VwZXIlLg== (Just an example)

POST URL:

https://example.ryver.com/api/1/odata.svc/forums(1)/Chat.PostMessage()

or, to send a chat message to a team (we used to call teams workrooms):

https://example.ryver.com/api/1/odata.svc/workrooms(10)/Chat.PostMessage()

Notes: Replace example with your Ryver account name. You can see your forum ID in the browser URL when you select a forum in the Ryver browser client. That’s one of the nice things about our Zapier integrations…you’re able to just pick the forum/team by name.

JSON Payload:
{
"body":"**New BitBucket Commit**\n> **Comment:** This is my commit comment\n> [Link to commit](https://bitbucket.org/)",
  "extras": {
    "from": {
      "__descriptor":"BitBucket",
      "avatarUrl":"https://example/icon.png"
    } 
  }
}

Notes: The “extras.from” property is optional. All you need to include is the body. By default, we set the sender based on the authenticated user making the request. extras.from is just an alias override. You can also see in my example that I used markdown to format the chat message.

The result of the above POST would be this:

bitbucket example