Getting User's Name and E-mail variables for Widget

Answered

7 Comments

  • Official comment
    Nicole Saunders
    Zendesk Community Manager

    Hey Jeremy - 

    I've posted the solution Dwight shared with Eric below. This isn't my area of expertise, so let us know if that answers your question or if you need more info: 

     

    __

    Here's an article that walks through how to auto-populate that contact form: https://support.zendesk.com/hc/en-us/articles/204172316-Auto-fill-the-Web-Widget-Contact-Form

    The basic gist is that you can insert the following code immediately after the web-widget code within your header page:

    Within my own test account, it looks like this:
    ​​


    Please let me know if this helps with what you're trying to do!

  • Jonathan Pabon

    Hey Eric,

    The way you can get the current user attributes (for use in zE.identify) is by using the users./me.json endpoint. 

    More information on this can be found in this link:

    https://developer.zendesk.com/rest_api/docs/core/users#show-the-currently-authenticated-user

    Hope that helps!

    0
  • Eric Biddle

    Hello Jonathan,

    Thank you for the response, but are there better examples of actually utilizing something like this? 

    When actually editing the pages and trying to use this, I'm not sure how to actually use the get statement or tell the ze.Identify to pull the name and email from it. 

    Thank you again.

    0
  • Dwight Bussman
    Zendesk Customer Care

    Hi Eric,

    I'm going to reach out to you within a ticket so that we're not going back and forth within here. I'd be happy to add our eventual solution back to this page once we've worked something out.

    I'll see you on that channel shortly! Thanks.

    0
  • Jeremy Robinson

    Dwight/Eric, or anyone else who may look at this - 

    Any follow up on this from 3 years ago? Last comment was a solution coming back to this post, but no solution provided.

    I too am looking at how to populate the GET data for a user into a specific section of my code/scripts to gain usage data in our backend system. I can do some stuff with RegEx, but want to shy away from that as much as I can since it's not as reliable as a coded solution that pulls the correct data EVERY time a user is authenticated.

    I want to use this outside of the script.js file in our Copenhagen theme, and the values I am most interested in getting/populating are: UserID, Name, Email, Organization_ID

     

    Anyone else have thoughts on this too?

    0
  • Jeremy Robinson

    Thanks Nicole, this does help with what I am trying to do. I appreciate the quick turnaround and follow up even through I posted on a several-years old thread.

    0
  • Nicole Saunders
    Zendesk Community Manager

    Great! I'm so glad to hear that it's useful. You're quite welcome. :)

    0

Post is closed for comments.

Powered by Zendesk