# BOT_SETUP_SETBOT

Sets the working personal Bot.  
Other commands require this command to be invoked first.

```csharp
llMessageLinked(LINK_SET, BOT_SETUP_SETBOT, "My bot name", "ACCESS CODE");
```

## Variables

The following table shows input values (you send them with the API call) and returned output values.

| **Variable** | **Description** |
|----------|-------------|
| `str`    | Name of the Bot. |
| `id`     | [Access code or API token](https://www.mysmartbots.com/docs/Bot_access_code) |

## Result

One of the following events will be generated:

* [`BOT_SETUP_SUCCESS`](/doc/bot_setup_success-QLVy1LhVJN)
* [`BOT_SETUP_FAILED`](/doc/bot_setup_failed-yy58DIzSt3)

## Example

```csharp
integer BOT_SETUP_SETBOT = 280101;

string name = "SmartBots Resident";
string accesscode = "f7dheb7fba9"; //Access code or API token from https://www.mysmartbots.com/docs/Bot_access_code

default
{
	state_entry()
	{
		llMessageLinked(LINK_SET, BOT_SETUP_SETBOT, name, accesscode);
	}
	
	link_message(integer sender, integer cmd, string data, key idk)
	{
		string id = (string)idk;
		if(cmd == BOT_SETUP_SUCCESS) {
			llOwnerSay("Setup Success: data=" + data + "\nkey= " + id);
		}
		else if(cmd == BOT_SETUP_FAILED) {
			llOwnerSay("Setup Failed: data=" + data + "\nkey= " + id);
		}
	}
}
```