Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var messageText = 'Тут текст сообщения',
- http = new XMLHttpRequest(),
- url = 'https://api.carrotquest.io/v1/users/' + carrotquest.data.user.id + '/startconversation',
- params = 'auth_token=' + carrotquest.data.auth_token + '&id_as_string=true&body='+messageText;
- http.open('POST', url, true);
- http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
- http.send(params);
- http.onreadystatechange = function() {
- if (http.readyState != 4) return;
- if (http.status == 200) {
- var json = JSON.parse(http.responseText);
- carrotquest.messenger.toStateNo();
- carrotquest.messenger.toStateOpened({id: json.data.id});
- };
- };
Add Comment
Please, Sign In to add comment