You would need to paste the code in the console of the character.ai page and use the function like this: createRoom('charid1', 'charid2');

const createRoom = async (...characters) => {
  const getLocal = (keyName) => {
    const itemStr = localStorage.getItem(keyName);
    if (!itemStr) {
      return null;
    }
    try {
      const item = JSON.parse(itemStr);
      return item.value;
    } catch (e) {
      return null;
    }
  };

  const cachedToken = getLocal('char_token');

  const response = await fetch("https://beta.character.ai/chat/room/create/", {
    "credentials": "include",
    "headers": {
      "Accept": "application/json",
      "Authorization": `Token ${cachedToken}`,
      "Content-Type": "application/json",
    },
    "referrer": "https://beta.character.ai/room/create?",
    "body": JSON.stringify({
      "characters": characters.map(id => ({
        "value": `${id}`,
        "label": "Name (@author)"
      })) ,
      "name": "Test",
      "topic": "",
      "visibility": "PRIVATE"
    }),
    "method": "POST",
    "mode": "cors"
  });
  const { room: { external_id } } = await response.json();
  location.href = `https://beta.character.ai/chat?hist=${external_id}`;
};
Edit
Pub: 25 Jan 2023 21:08 UTC
Edit: 26 Jan 2023 08:57 UTC
Views: 1863