Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
That's not ilegal, you can use API and check the requirements to have a third party app integrated with Teams, Please check article below
https://docs.microsoft.com/en-us/graph/api/over...
https://docs.microsoft.com/en-us/microsoftteams...
https://developer.microsoft.com/en-us/microsoft...
I also suggest you to post your concern to the development community since the users there wil have more expertise to assist: