Microsoft teams incoming webhook CORS error

%3CLINGO-SUB%20id%3D%22lingo-sub-1581255%22%20slang%3D%22en-US%22%3EMicrosoft%20teams%20incoming%20webhook%20CORS%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1581255%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20trying%20to%20get%20my%20web%20app%20(javascript)%20to%20send%20a%20message%20to%20a%20microsoft%20teams%20channel.%20I%20went%20through%20the%20steps%20of%20the%20%22getting-started%22%20page%20and%20then%20referred%20to%20this%20tutorial%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fmedium.com%2F%40john_93626%2Fautomating-posts-to-microsoft-teams-using-javascript-2b5afeab1974%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fmedium.com%2F%40john_93626%2Fautomating-posts-to-microsoft-teams-using-javascript-2b5afeab1974%3C%2FA%3E%26nbsp%3B.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EProblem%20is%2C%20whenever%20i%20try%20to%20send%20a%20Post%20request%20to%20my%20url%20(using%20axios%20or%20XMLHttpRequest)%2C%20i%20got%20an%20error%20saying%3A%26nbsp%3B%3CEM%3EAccess%20to%20XMLHttpRequest%20at%20'%3CA%20href%3D%22https%3A%2F%2Foutlook.office.com%2Fwebhook%2F8857e17c-5ad9-4561-8970-180c05644bc4%400400011a-0b87-4500-ac8a-610ba1dfd12f%2FIncomingWebhook%2Fb4b6d53465994ee69efce77ac7a93bea%2Fb193af5d-b425-447e-a187-7ee36bb8ac66%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office.com%2Fwebhook%2F8857e17c-5ad9-4561-8970-180c05644bc4%400400011a-0b87-4500-ac8a-610ba1dfd12f%2FIncomingWebhook%2Fb4b6d53465994ee69efce77ac7a93bea%2Fb193af5d-b425-447e-a187-7ee36bb8ac66%3C%2FA%3E'%20from%20origin%20'http%3A%2F%2Flocalhost%3A3030'%20has%20been%20blocked%20by%20CORS%20policy%3A%20Response%20to%20preflight%20request%20doesn't%20pass%20access%20control%20check%3A%20No%20'Access-Control-Allow-Origin'%20header%20is%20present%20on%20the%20requested%20resource.%3C%2FEM%3E%3C%2FP%3E%3CP%3EAs%20you%20can%20see%20in%20my%20code%20below%2C%20i%20added%20the%20'Access-Control-Allow-Origin'%20header%20to%20my%20request%2C%20but%20I%20still%20get%20the%20same%20error.%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EDid%20this%20occur%20to%20anyone%20else%20as%20well%3F%20Or%20am%20I%20doing%20something%20wrong%3F%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EHelp%20would%20be%20much%20appreciated%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EBest%20regards%2C%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EJosch%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1581255%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1595278%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20teams%20incoming%20webhook%20CORS%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1595278%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F755923%22%20target%3D%22_blank%22%3E%40joschroth%3C%2FA%3E%26nbsp%3BCould%20you%20please%20follow%20the%20guide%20here%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fmicrosoftteams%2Fplatform%2Fwebhooks-and-connectors%2Fhow-to%2Fconnectors-using%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESend%20Messages%20to%20Connectors%20and%20Webhooks.%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAlso%20could%20you%20please%20confirm%20if%20you%20have%20added%20actions%20in%20the%20Connector%20registration%20portal%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1610103%22%20slang%3D%22en-US%22%3ERe%3A%20Microsoft%20teams%20incoming%20webhook%20CORS%20error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1610103%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F359599%22%20target%3D%22_blank%22%3E%40Gousia_Begum%3C%2FA%3E%26nbsp%3BHi!%20Yeah%20I've%20followed%20the%20steps%20of%20the%20guide%20closely%2C%20problem%20is%20they%20only%20send%20the%20JSON%20via%20Curl%20or%20Postman%2C%20not%20through%20an%20Http%20post%20request.%20Whats%20the%20connector%20registration%20portal%3F%20Did%20you%20mean%20the%20dialog%20inside%20of%20teams%20where%20you%20can%20manage%20your%20connectors%20etc.%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20regards%2C%3C%2FP%3E%3CP%3EJosch%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

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: https://medium.com/@john_93626/automating-posts-to-microsoft-teams-using-javascript-2b5afeab1974 .

 

Problem is, whenever i try to send a Post request to my url (using axios or XMLHttpRequest), i got an error saying: Access to XMLHttpRequest at 'https://outlook.office.com/webhook/8857e17c-5ad9-4561-8970-180c05644bc4@0400011a-0b87-4500-ac8a-610b...' from origin 'http://localhost:3030' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

As you can see in my code below, i added the 'Access-Control-Allow-Origin' header to my request, but I still get the same error. 

 
Did this occur to anyone else as well? Or am I doing something wrong?
 
Help would be much appreciated,
Best regards,
Josch
2 Replies
Highlighted

@joschroth Could you please follow the guide here to Send Messages to Connectors and Webhooks.

Also could you please confirm if you have added actions in the Connector registration portal?

Highlighted

@Gousia_Begum Hi! Yeah I've followed the steps of the guide closely, problem is they only send the JSON via Curl or Postman, not through an Http post request. Whats the connector registration portal? Did you mean the dialog inside of teams where you can manage your connectors etc.?

 

Best regards,

Josch