zylvie
1
Looking into the Console, this URL is giving me a 400 Bad Request error:
https://va.tawk.to/v1/session/start
{"ok":false,"error":{"code":"MethodNotAllowedError","message":"GET is not allowed"}}
My website is https://zylvie.com.
I don’t have any domain, country, or platform restrictions enabled.
Can anyone help me out?
LEOHDZ
2
The widget is working for your site on my end
zylvie
3
Yes, it’s working for me when the user isn’t logged in.
But when the user is logged in, I prefill the Tawk.To widget with the name and email, like so:
<script>
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
{% if request.user.is_authenticated %}
Tawk_API.visitor = {
name : '{% if request.user.first_name %}{{ request.user.first_name }}{% else %}{{ request.user.email }}{% endif %}',
email : '{{ request.user.email }}',
};
{% endif %}
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/64ffcc0a0f2b18434fd7fac1/1ha3ja2bl';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();
<script>
And that seems to make it disappear.
I’m merely following the code here:
zylvie
4
Update:
I solved it by adding a hash to the Tawk_API.visitor variable.
PHP example:
<?php echo hash_hmac(“sha256″,”visitor@email.com”,”your-api-key”); ?>
1 Like
LEOHDZ
5
That’s great thanks for the info