1

I am following tutorial on here: https://docs.pusher.com/chatkit/quick_start/javascript

There is an example how to create user:

const chatkit = new Chatkit.default({
  instanceLocator: "YOUR INSTANCE LOCATOR",
  key: "YOUR SECRET KEY"
})

chatkit.createUser({
  id: "bookercodes",
  name: "Alex Booker"
})

However, when I am trying to run this code with my instanceLocator and key it gives me an error in the console:

SCRIPT445: Object doesn't support this action

Nore that I everything else Chatkit related works fine. I am just not able to create the new user.

Irmantas Želionis
  • 2,194
  • 3
  • 17
  • 30
  • As it says in the [section you copied from](https://pusher.com/docs/chatkit/quick_start/javascript#create-a-user), you should not copy paste this code. You must at least replace values of `instanceLocator` and `key`. – ArneHugo Jul 28 '19 at 11:43

2 Answers2

1

Setting instanceLocator and key

You must replace the values of instanceLocator and key passed to

new Chatkit.default({
    instanceLocator: "?",
    key: "?"
})

To find the correct values, go to https://dash.pusher.com/chatkit and select the chatkit app you want to use.

On the next page, click the Credentisals tab as shown below:

Credentials tab in chatkit dashboard

Where you see <instanceLocator> in the screenshot you will find the string to use for instanceLocator, and where you see <key> you will find the string to use for key.

Creating user

If you want to create the user { id: "bookercodes", name: "Alex Booker" } as soon as you start the server, just to test that it works, then your code should work after you do as described above.

ArneHugo
  • 6,051
  • 1
  • 26
  • 47
0

That's an IE11 error. Which browser are you using? Try Chrome.

jsdeveloper
  • 3,945
  • 1
  • 15
  • 14