Forum Discussion
joschroth
Aug 11, 2020Copper Contributor
Microsoft teams incoming webhook CORS error
Hi there, I've been trying to get my web app (javascript) to send a message to a microsoft teams channel. I went through the steps of the "getting-started" page and then referred to this tutorial...
farisdurrani425
Mar 24, 2023Copper Contributor
Make sure you're using a native server and not React for example. So, a call from a basic ExpressJS app works but not if initiated from within React. That solved the issue for me
tonanuvem
May 10, 2023Copper Contributor
Just had the same issue, and got it working by using: https://www.npmjs.com/package/teams-web-send
see the docs:
- Directly off the browser as a UMD
<script src="https://unpkg.com/teams-web-send@0.1.1/dist/tws.umd.production.min.js"></script> <script> (() => { const sendMessage = window.tws.bootstrap(); const message = `{"text": "Hello World"}`; sendMessage('http://your.msteams.webhook.url', message).then(() => { console.info('Message sent!') }); })(); </script>