Like I said above, the solution has been implemented on Mattermost 4.1(which is supposed to come out August 16th) if you can compile and use the master github version of it, you will have access to the new endpoints that circumvent the issue you are having with gitlab, otherwise you will need to extract the information as we discussed above, until you can upgrade to 4.1
EDIT:
More specifically this is what you need to automate the process https://github.com/mattermost/mattermost-api-reference/pull/275 you can follow that if you prefer.