AnsweredAssumed Answered

Is it possible to configure CORS for my account?

Question asked by pubnubcraig on Apr 16, 2018
Latest reply on Aug 8, 2018 by ron.cavallo

I am attempting to implement some integration from a custom Freshdesk plugin app and I am getting the following error in my browser console:

Failed to load https://api.flowdock.com/flows/pubnub/CoE/messages: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://support.pubnub.com' is therefore not allowed access. The response had HTTP status code 400.

 

I assume that Flowdock is blocking the API call from support.pubnub.com which is strange because when I add a custom web hook to send message to my Flowdock inside of Freshdesk rules, it works. There is some difference about it being a Freshdesk plugin app that I am unaware of.

 

Is there some way for Flowdock (CA) or my Flowdock Admin to configure CORS to allow support.pubnub.com to invoke Flowdock API calls?

 

Here's a snippet of my code:

var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://api.flowdock.com/flows/mycompany/' + channel + '/messages', true);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.setRequestHeader('Authorization','Basic redacted-token');
xhr.onload = function () {
console.log("xhr onload");
console.log(this.responseText);
};

const msg = {
"event": "message",
"content": "@" + mention + ": **Message from agent {{ticket.agent.name}}**\n" +
"* **Ticket:** [{{ticket.id}}]({{ticket.url}})\n" +
"* **Subject:** {{ticket.subject}}\n" +
message
}

console.log("before xhr send");
xhr.send(msg);
console.log("after xhr send");

Outcomes