Mattermost, Inc.

[SOLVED] Trying to run sample bot (Go driver)

Hi, I’m trying to run the sample Go bot but I’m running into a issue with the client.GetTeamByName function:

func FindBotTeam() {
	if team, resp := client.GetTeamByName(params.Team, ""); resp.Error != nil {
		println("We failed to get the initial load")
		println("or we do not appear to be a member of the team '" + params.Team + "'")
		PrintError(resp.Error)
		os.Exit(1)
	} else {
		botTeam = team
	}
}

It gives me this error:

[vpb@miles mattermost-bot-autoadd]$ make run
go run   *.go
Pillar Bot
Server detected and is running version 4.1.0
We failed to get the initial load
or we do not appear to be a member of the team 'Test'
	Error Details:
		Invalid or missing team_name parameter in request URL
		api.context.invalid_url_param.app_error
		
exit status 1
make: *** [Makefile:15: run] Error 1

Looking at the output from my server, it outputs this:

[2017/08/17 11:30:59 -03] [DEBG] GET - /api/v4/teams/name/Test
[2017/08/17 11:30:59 -03] [EROR] /api/v4/teams/name/Test:Context code=400 rid=uoi3w3j75pr5mmc4dtpxg161ua uid=w6mbrii6fbyrfd53ce9bi5cwee ip=::1 Invalid or missing team_name parameter in request URL [details: ]

Team Test exists. Can someone provide some guidance? I’m new to this.

My source code is located at github.com/vitorpy/mattermost-bot-autoadd

Solved. Had the use lowercase, likely to match the URL for the team.

Thanks for posting back your solution @vitorpy :slight_smile: