8x8

The 8x8demo Developer Hub

Welcome to the 8x8demo developer hub. You'll find comprehensive guides and documentation to help you start working with 8x8demo as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Getting Started with 8x8 Chat (beta)

This page will help you get started with our Chat API: Chapi. You'll be up and running in a jiffy!

Chapi is what we call our Chat API. It allows you to send and fetch messages from a Virtual Office chat .

Getting Prepared for Beta Access

🚧

Get your API Key (beta) — Skip this if you've already got one!

There's one prerequisite before you're able to use these APIs, and that's getting your API Key. You can generate your API key in the Admin Console. Here's how

1. Get Messages from a Room

First up, let's get the messages for a If we're using a test_key we'll default our room to the room named CHAPI sandbox

curl --request GET \
  --url 'https://api.8x8.com/chat/api/chat/v1/messages?pageSize=10' \
  --header 'content-type: application/json' \
  --header 'x-api-key: test_key_kjdfidj238jf9123df221'

📘

Did you get an error?

If you see {"fault":{"faultstring":"Invalid access token","detail":{"errorcode":"oauth.v2.InvalidAccessToken"}}} You'll want to make sure you replace the api key (test_key_kjdfidj238jf9123df221) with your own.

Awesome! You should have received a JSON payload with something like the following:

[
    {
        "authorUser": {
            "avatarUrl": "https://s.gravatar.com/avatar/c0fc68541276afaf1ecf7e7f761f518e?s=80",
            "email": "[email protected]",
            "id": "007",
            "name": "Matt Gardner"
        },
        "parsed": "Hello World!",
        "id": "uv4y2dmXRy_v868BZQJadWAPWv7Am-oRO1p86k00dZY",
        "timestamp": 1594169304503487
    },
    {
        "authorUser": {
            "avatarUrl": "https://s.gravatar.com/avatar/c0fc68541276afaf1ecf7e7f761f518e?s=80",
            "email": "[email protected]",
            "id": "007",
            "name": "Matt Gardner"
        },
        "parsed": "i r developer!",
        "id": "AFsG2zb5ckapn-RJalcNWHxZGy70IDhv6dzbkvA5t2g",
        "timestamp": 1594169027435340
    }
]

Two messages already exist in this room — you may not have any. That's ok, let's send a message!

2. Sending a Message to a Room

Let's send a to a room. Copy/paste the below into your terminal

curl -H "Accept: application/json" \
  -H 'content-type: application/json' \
  -H "x-api-key: test_key_kjdfidj238jf9123df221" \
  --request POST \
  --data '{"messageRaw":"Hello from Terminal!"}' \
  https://api.8x8.com/chat/api/chat/v1/messages

P.S. Want to see this message come through in realtime? Log into Virtual Office and find the room called CHAPI Sandbox.** If it doesn't exist, it will once you've successfully sent your first message!

Now that we've sent a message, you should also see it when logged into Virtual Office. Plus, if we re-run the first snippet, we'll see that our message was added to the array it returns, like so:

[
    {
        "authorUser": {
            "avatarUrl": "https://s.gravatar.com/avatar/c0fc68541276afaf1ecf7e7f761f518e?s=80",
            "email": "[email protected]",
            "id": "007",
            "name": "Matt Gardner"
        },
        "parsed": "Hello World!",
        "id": "uv4y2dmXRy_v868BZQJadWAPWv7Am-oRO1p86k00dZY",
        "timestamp": 1594169304503487
    },
    {
        "authorUser": {
            "avatarUrl": "https://s.gravatar.com/avatar/c0fc68541276afaf1ecf7e7f761f518e?s=80",
            "email": "[email protected]",
            "id": "007",
            "name": "Matt Gardner"
        },
        "parsed": "i r developer!",
        "id": "AFsG2zb5ckapn-RJalcNWHxZGy70IDhv6dzbkvA5t2g",
        "timestamp": 1594169027435340
    },
    {
        "authorUser": {
            "avatarUrl": "https://s.gravatar.com/avatar/c0fc68541276afaf1ecf7e7f761f518e?s=80",
            "email": "[email protected]",
            "id": "007",
            "name": "Matt Gardner"
        },
        "parsed": "Hello from Terminal!",
        "id": "AFsG2zb5ckapn-RJalcNWHxZGy70IDhv6dzbkvA5t24",
        "timestamp": 1594169027435321
    }
]

Note: your API key is limited to 5 requests/s.

Updated 4 months ago


Getting Started with 8x8 Chat (beta)


This page will help you get started with our Chat API: Chapi. You'll be up and running in a jiffy!

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.