New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-dfcx

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dfcx

A react native implementation for Dialogflow CX

latest
npmnpm
Version
0.1.17
Version published
Maintainers
1
Created
Source

React Native DFCX Component

A customizable React Native chat interface for Dialogflow CX agents

This React Native component provides a chat interface that communicates securely with a Dialogflow CX agent via a Google Cloud Function middleware proxy. It supports a wide range of Dialogflow Messenger response types and is designed to drop easily into any mobile app using React Native.

🔧 Note: You must deploy the required Cloud Function Middleware in your Google Cloud project before using this component.


Supported Dialogflow Response Types

The component supports the following standard Dialogflow response types in your conversation flows, as detailed in Google’s documentation: Dialogflow Messenger Fulfillment:

  • Text: Simple text responses

  • Description: Multi-line text with a header and body

  • Info: Image with a title, body text, and optional URL

  • Image: Direct image display

  • Video: Embedded video via URL

  • Button: Interactive buttons

    • Each button can include a label (text) and an optional URL.
    • Icons are not supported at this time — only plain text labels are shown.
    • If a URL is provided, tapping the button will open the URL in a browser.
    • If no URL is provided, tapping the button will send the button’s label as a new user message to the Dialogflow agent.
  • List: Scrollable lists of items with titles, subtitles, and images

  • Files: Downloadable file attachments with name and preview

  • Chips: Quick reply suggestions

    • Each chip can include a label (text) and an optional URL.
    • If a URL is provided, tapping the chip will open the URL in a browser.
    • If no URL is provided, tapping the chip will send the chip label as a new user message to the Dialogflow agent.
  • Accordion: Expandable content blocks

NOTE This component requires the chat Cloud Function to be deployed in the same Google Cloud project as your Dialogflow CX agent.

Installation

npm install react-native-dfcx

Basic Usage

import { ChatDialog } from 'react-native-dfcx';

<ChatDialog
  chatURL="https://europe-west1-dotstorming.cloudfunctions.net/cx-chat"
  apiKey="cb2be986-6b84-4ab1-8eeb-b2fc40402077"
  agentPath="https://dialogflow.cloud.google.com/cx/projects/dotstorming/locations/global/agents/4459aa96-eebe-4419-8d28-77207f442165"
  sessionTimeout={30}
  mainColor="#ff0000"
  mainTextColor="#FFFFFF"
  sessionVariables={{
    userId: '12345',
    userName: 'John Doe',
  }}
/>;

Props

NameTypeRequiredDefaultDescription
chatURLstringThe URL of your deployed Dialogflow CX chat function.
apiKeystringOptional API key required to call the chat function.
agentPathstringThe full Dialogflow Agent path URL.
languageCodestring'en'Language code of the Dialogflow CX agent.
sessionTimeoutnumber30Time in minutes before session resets and new session ID is generated.
placeholderstring'Message...'Input placeholder text.
startMessagestringHidden message sent to Dialogflow when session starts.
welcomeMessagestringMessage shown to user at session start (not sent to Dialogflow).
mainColorstringBackground color for user messages.
mainTextColorstringColor for user input text.
sessionVariablesobject{}Parameters sent with each user input.

Methods

NameDescription
restartRestarts the chat session with a new session ID.

Retrieving your Agent Path

To find your agent path:

  • Go to the Dialogflow CX Console.
  • Open your project and view the list of agents.
  • Click the clipboard icon next to your agent to copy its path.



The copied URL can be pasted directly into the agentPath prop.

Need Help?

For help or customizations, reach out to gareth@dotstorming.com.

Keywords

react-native

FAQs

Package last updated on 04 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts