npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nstudio/nativescript-freshchat

v1.0.0-beta.0

Published

Freshchat SDK for NativeScript

Downloads

2

Readme

@nstudio/nativescript-freshchat

npm install @nstudio/nativescript-freshchat

Reference

ios SDK: https://support.freshchat.com/en/support/solutions/articles/50000000048-freshchat-ios-sdk-integration-steps android sdk: https://support.freshchat.com/en/support/solutions/articles/50000000207-freshchat-android-sdk-integration-steps

Usage

The first step is to call the init method, I would recommend calling it as early as possible in your app life cycle.

import { FreshChatSDK } from '@nstudio/nativescript-freshchat';
let appID = 'YOURAPPID';
let appKey = 'YOURAPPKEY';
let domain = 'YOURDOMAIN.com'
FreshChatSDK.init(appID, appKey, domain);

Then, you can interact with the Freshchat sdk with the following methods:

setUser

You can get basic user information at any point to give you more context on the user when your support agents are messaging back and forth with them.

let user = FreshChatSDK.setUser({
  firstName: 'Dave',
  lastName: 'Coffin',
  email: '[email protected]',
  phoneCountryCode: '1',
  phoneNumber: '2075762034'
})
if (user) alert('Freshchat user set!')

setUserProperties

You can capture and send additional metadata about the user and the events in the app, all of which also becomes a way to segment your users to later push messages to them.

let setProps = FreshChatSDK.setUserProperties({
  old: true,
  isCool: false
})
if (setProps) alert('set user properties!')

trackEvent

Tracking user events will give you more insight and context about the user(s) in your application. Events like user actions and failure/error cases can be tracked using this API. Tracked events are listed under Events Timeline on the agent side.

FreshChatSDK.trackEvent('tookPicture', {
  time: new Date(),
  foo: 'bar'
})

resetUser

Reset user data at logout or when deemed appropriate based on user action in the app by invoking the resetUser API. Optionally accepts a completion callback.

FreshChatSDK.resetUser(() => {
  console.log('user reset!');
})

showConversations

This method will bring up the user's conversations. You can optionally pass an array of topics. Different sets of Topics can be displayed to different types of users or on different screens by using tags to filter Topics.

let tags;
tags = ['foo', 'bar'];
FreshChatSDK.showConversations(tags);

identifyUser

Use this method to both set an external ID and restore a user's conversations using a restore ID previously retrieved. First, you must set a user's external ID (the unique ID on your system).

let identified = FreshChatSDK.identifyUser('1234', null)

The identifyUser method accepts an external ID and a restore ID. The first time you call it, you won't have a restore ID, but identifying a user with an external ID and null as restore ID will generate a restore ID for the user. You can get this restore ID by using...

getRestoreID

This will return a user's restore ID.

let restoreID = FreshChatSDK.getRestoreID();
this.myService.saveUserRestoreID(restoreID).then(profit); // save the ID in your database or backend system.

Save this ID in your system, then when that user changes devices or platforms (visits your app on the web for example), you can restore the user's conversations by calling identifyUser again with the restore ID.

this.myService.getUserRestoreIDFromMyCoolBackend('1234').subscribe(restoreID => {
  FreshChatSDK.identifyUser('1234', restoreID);
})

sendMessage

The app can send a message on behalf of the user using the sendMessage: API. It will silently send a message and not launch the Freshchat SDK UI. This API can be helpful in setting more context for customers before starting a conversation. Optionally pass a single tag.

let msg = 'How do I win at chess?';
FreshChatSDK.sendMessage(msg, 'foo')
this.showConversations();

Note: If there are no matching Topics, the message will be sent to the default Topic. If there are multiple matching Topics, the message will be sent to the oldest Topic.

getUnreadCount

If you want to indicate to the users that they have unread messages in their inbox, you can retrieve the unread count to display. The method returns an int indicating the number of unread messages for the user.

FreshChatSDK.getUnreadCount((count) => {
  alert('Count is ' + count);
})

showFAQs

To bring up the Freshchat 's FAQ overlay at any point, use showFAQs() API.

FreshChatSDK.showFAQs({
  showContactUsOnAppBar: true,
  showFaqCategoriesAsGrid: true,
  filterByTags: {
    tags: ['foo', 'bar'],
    title: 'My_Tags',
    type: 'ARTICLE'
  }
});

This method accepts a config object with the following definition:

export interface FreshchatFAQOptions {
  showFaqCategoriesAsGrid?: boolean // Show FAQ in grid formal, false to list view
  showContactUsOnFaqScreens?: boolean // Show chat option from FAQ section
  showContactUsOnFaqNotHelpful?: boolean // Show contact us in article detail when user select Not Helpful
  showContactUsOnAppBar?: boolean // Show chat option over navigation bar in FAQ category view or article list view
  filterByTags?: {
    tags: Array<any>
    title: string
    type: 'ARTICLE'|'CATEGORY'
  }
  filterContactUsByTags?: {
    tags: Array<any>
    title: string
  }
}

License

Apache License Version 2.0