# Chat message error

**URL:** <https://community.hubspot.com/t/chat-message-error/11717>\
**Category:** APIs & Integrations\
**Created:** [October 6, 2018, 5:47pm UTC](https://community.hubspot.com/t/chat-message-error/11717 "2018-10-06T17:47:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 6, 2018, 5:47pm UTC](https://community.hubspot.com/t/chat-message-error/11717/1 "2018-10-06T17:47:19Z")

</div>

Hello  
I will integrate the code of sending messages on my site and I have error file: [//js.hs-scripts.com/4984323.js](https://js.hs-scripts.com/4984323.js) net :: ERR\_FILE\_NOT\_FOUND after I took the code I modify them by creating a new file js and now I have this message in my console v2.js:12 Couldn’t find target container #hbspt-form-1538847199826-342745802 for HubSpot Form b393b2de-0679-4bd6-b2af-5649e8145462. Not rendering form onto the page  
it is the code in my new file js

(function (id, src) {  
if (document.getElementById(id)) { return; }  
var js = document.createElement(‘script’);  
js.src = src;  
js.type = ‘text/javascript’;  
js.id = id;  
var e = document.getElementsByTagName(‘script’)[0];  
e.parentNode.insertBefore(js, e);  
})(‘hs-analytics’, ‘[https://js.hs-analytics.net/analytics/1538847000000/4984323.js](https://js.hs-analytics.net/analytics/1538847000000/4984323.js)’);

(function (id, src, attrs) {  
if (document.getElementById(id)) {  
return;  
}  
var js = document.createElement(‘script’);  
js.src = src;  
js.type = ‘text/javascript’;  
js.id = id;  
for (var name in attrs) { if(attrs.hasOwnProperty(name)) { js.setAttribute(name, attrs[name]); } }  
var e = document.getElementsByTagName(‘script’)[0];  
e.parentNode.insertBefore(js, e);  
})(‘hubspot-messages-loader’, ‘[https://js.usemessages.com/conversations-embed.js](https://js.usemessages.com/conversations-embed.js)’, {“data-loader”:“hs-scriptloader”,“data-hsjs-portal”:4984323,“data-hsjs-env”:“prod”});

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [October 8, 2018, 3:35pm UTC](https://community.hubspot.com/t/chat-message-error/11717/2 "2018-10-08T15:35:21Z")

</div>

Hi [@maven](https://community.hubspot.com/u/maven),

Could you clarify your goal? Are you looking to [install HubSpot live chat](https://knowledge.hubspot.com/articles/kcs_article/conversations/how-to-use-conversations) on your site or add custom functionality?

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [October 9, 2018, 4:40pm UTC](https://community.hubspot.com/t/chat-message-error/11717/3 "2018-10-09T16:40:58Z")

</div>

hi [@Isaac\_Takushi](https://community.hubspot.com/u/isaac_takushi) In reality I am in a project and the goal is to be able to recover a contact who are in the hubspot crm by his mail and add it to my base to give. I code with [asp.net](http://asp.net) and to communicate with the hubspot lapi I use this javascript code may I still have this message No ‘Access-Control-Allow-Origin’  
var data = null;

```auto
 var xhr = new XMLHttpRequest();
 xhr.withCredentials = true;

 xhr.addEventListener("readystatechange", function () {
 if (this.readyState === 4) {
 console.log(this.responseText);
 }
 });

 xhr.open("GET", "https://api.hubapi.com/contacts/v1/contact/email/xx@xx.com/profile?hapikey=xxxxxxxx");
 xhr.setRequestHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Authorization");
 xhr.setRequestHeader("Access-Control-Allow-Origin","*");
 xhr.setRequestHeader("cache-control", "no-cache");
 xhr.setRequestHeader("postman-token", "dd9e49c7-9b9f-ca5a-0307-fadf13e91341");

 xhr.send(data);

```

---

<div class="post-metadata">

**Author:** ![IsaacTakushi](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/isaactakushi/32/70387_2.png) [@IsaacTakushi](https://community.hubspot.com/u/IsaacTakushi)\
**Post date:** [October 10, 2018, 2:57pm UTC](https://community.hubspot.com/t/chat-message-error/11717/4 "2018-10-10T14:57:01Z")

</div>

Hi [@maven](https://community.hubspot.com/u/maven),

The [Contacts API](https://developers.hubspot.com/docs/methods/contacts/get_contact_by_email) does not support CORS/AJAX requests. Per [this article](https://developers.hubspot.com/docs/faq/do-hubspot-apis-support-ajax-request), only the v3 Forms API and HubDB APIs support this.

To `GET` a contact’s email, you’ll need to ping your server first, which can then add authentication and make the request to `https://api.hubapi.com/contacts/v1/contact/email`.
