This question already has an answer here:
How to put the variable "user" in this array. The way it is not it doesn't work sadly. The $user variable should be john.smith for example.
I have the following output:
curl --header "Authorization: Bearer XXXXXXXX" --request POST --data '["$firstname.lastname@example.org"]' "https://mattermost.test.com/api/v4/teams/$team/invite/email"