How to get User property values in Freshchat by using Smartplug?

Hi Team!

I’m trying to use Smartplug in my app development. I am able to get basic details about the user. But I can’t get user properties values.

Reference Image:

This is the code that I have used in my smart plug.
var rawBody = '{"user" : "{{user["properties"]}}","email":"{{user.email}}","phone":"{{user.phone}}"}';

And I got this result,
{"user" : "{{user["properties"]}}","email":"saravanakumar.r@spritle.com","phone":"9855462654"}

Is this product’s default behavior or any other way to get it. Please advise me on how to sort out this.

1 Like

Hi @Saravanakumar_Raju

For custom properties, you can try using the below standard.

If they key for the custom property is Plan Name, then the placeholder value will be {{user.tag.plan_name}} in lowercases.

The standard is that you use user.tag, and replace blank spaces with underscore(_) so for your requirement the placeholders will be {{user.tag.first_name}} and {{user.tag.last_name}}

4 Likes

Hi @Arjun_Paliath!

Great! :+1:
It works for me.

Thanks a lot :handshake:

Hi @Arjun_Paliath!

I have one more question here :raising_hand_man:

I am unable to get all those properties values by using a single placeholder.
For example, If I use this {{user.tag}}, then it will give both first_name and last_name.
I tried this, but unable to get the expected result :worried:

Is there any way to get all those property values by using a single placeholder :thinking:?

If this is possible, then it will be great :nerd_face:

Hey @Saravanakumar_Raju

Are you looking for a placeholder to get the user’s full name? If that is the case, then unfortunately we do not have a placeholder for that. Typically we just use the first name and last name placeholders together. For instance :

var full_name = “{{user.first_name}} {{user.last_name}}”;

And I am also curious as to what you are trying to do with Smartplugs? There are a few limitations with them, and moreover we have integrated with Freshworks Marketplace Ecosystem so you can make use of it to build marketplace apps with much better capabilities.

Do give that a try :slight_smile:

1 Like

Hi @Arjun_Paliath!

Thanks for the clarification :handshake:

I am trying to get all those user property values and post them to third party API. For each conversation, user properties may vary. This is the reason that I need a placeholder that gives all the user properties.

Anyway, I go ahead with the SDK app.

Thanks again :slightly_smiling_face:

Aah I got it @Saravanakumar_Raju.

I believe you are looking for a similar api in the link here with smartplugs?

We do not have one, unfortunately. So kindly use the SDK to create a custom marketplace app and let me know in case you run in to any trouble.

Will be happy to help yout :slight_smile:

1 Like