Registers a new Chatwee user. This method returns the ID of a newly created user. The returned value needs to be stored somewhere (for instance, in your database) if you want to perform any actions related to this user in the future.
<?php
require_once(dirname( __FILE__ ) . "/ChatweeV2_SDK/Chatwee.php");
ChatweeV2_Configuration::setApiUrl(YOUR_API_URL);
ChatweeV2_Configuration::setChatId(YOUR_PERSONAL_CHAT_ID);
ChatweeV2_Configuration::setClientKey(YOUR_PERSONAL_CLIENT_KEY);
try {
$userId = ChatweeV2_SsoManager::registerUser(Array(
"login" => "Test user",
"isAdmin" => false,
"avatar" => "http://mypage.com/avatar.png"
));
echo "A new user has been registered with the following user ID: " . $userId;
} catch(Exception $exception) {
echo "An error occured: " . $exception->getMessage();
}
?>
Name | Description | Type | Mandatory | Remarks |
---|---|---|---|---|
login | user login | string | yes | - |
isAdmin | if user has admin role | boolean | no | - |
avatar | user avatar | string | no | an absolute URL of the user's avatar image |