How do I use the Watson Assistant API with React Native? - react-native

If I attempt to import and use code that invokes the Watson Assistant API for Node, I get a fatal error
The package at "node_modules/ibm-watson/lib/common.js" attempted to
import the Node standard library module "os". It failed because React
Native does not include the Node standard library.
I gather this means that it is not possible to use the Watson Node API with React Native.
What alternatives are available for using the Watson Assistant API with React Native? Should I just use fetch and follow the Watson Assistant cURL API, and if so, how do construct the arguments to fetch, specifically -u "apikey:{apikey}"?
There is partial example of how to do this with version 1 of the Assistant API, but that uses a different authentication method and is not applicable here.

Related

React Native & Cosmos DB - How to get them working together?

There seem to be no direct support for React Native through Cosmos DB SDK or npm packages. The JS package #azure/cosmos while works on React Native for the Web, but does not build for the native apps. It fails to build due to Cryto incompatibility.
While Resource Tokens can serve as a solution for authentication, but App still needs to interact with the DB resources using an API.
So, how to go around this? Is utilizing Azure Functions as a mid-tier the only workaround?
Thanks
If you need basic functionality like querying, creating new items etc, you can get the react-native-azure-cosmos package.
However the functionality is a very limited subset of the full JS SDK.
There is no official SDK for now to target react native applications.
You will need to use an API App or Function app to interact with CosmosDB and call the HTTP endpoints from your device.

Using stripe connect with react native

I'm currently looking to use the Stripe connect feature in my react native application and was wondering if there were any libraries I could use to use stripe connect. I've looked at react native stripe libraries like tipsi react native but it didn't seem like they support stripe connect. Is there a reference for api I could use to incorporate stripe connect in my application?
The best course of action when using Stripe in react native is to just use the native Stripe libraries.
This is due to the security vulnerabilities that exist when not using a Stripe approved library, and due to the lack of support for things like Stripe Connect and other services.
--UPDATE--
While I stand by the above for not using unapproved 3rd party libraries, I will say that Stripe does have an API that can also be used securely. In react native, that would be the way I would go about using stripe if I was not in need of the full Stripe libaries.

google assistant with react native

I developed one react native application. now I want to integrate Google Assistant in the app, I will provide one mic button, if the user click on it, the google assistant need to be enabled, and I need response from the google.
I am working in smart home project, I want to integrate google assistant api in React native app, I seen the library support only python. Please suggest me the best way I can embed google assistant in my app.
Have you looked at the dialogflow integration with react native? that could help you do what you want. If you are building a smart home integration I would assume you are already in dialogflow to some extent.
https://github.com/innFactory/react-native-dialogflow

Using watson developer cloud with react native

I'm trying to integrate my already created IBM Watson chatbot into my react native mobile application. Any time I import watson-developer-cloud I get an error saying that Node.js standard libraries such as stream are not compatible with Expo. I've seen other people using watson services to create speech to text apps. I don't understand how they are using the services without the watson-developer-cloud package. I've seen some community created packages such as react-native-watson that supposedly can make this happen, but I can't get any of it to work. Is there any way I can make this work or is it impossible? Any suggestions are welcome and appreciated.
Just to help you with some path, for sure you can use React Native to built the UI for your app. But also you need the back-end and communicate with Watson API. (If you want you can use just the fetch from react native, but I really recommend you don't do that if your app will grow with time.
I really recommend you take a look at Watson developer Cloud, and use the Assistant Simple to understand the backend with Node.js. Also try to check the Watson Assistant API documentation.
For summary, you'll create one server with Node.js and express, and create routers in your backend, with theses routes, you gonna use fetch from React native to send HTTP requests to your routes, your backend will call Watson Assistant API and answer. Your fetch will get this response and show that to the user in your U.
Obs.: You can use any language in the backend and Watson Developer Cloud has a lot of examples using Watson Assistant with Java, Python, etc.
See the Official Watson Assistant API documentation.
See the Official use of Fetch in React Native.

How to set a friendly name using native API IOS/Android in MFP server

As documented in the link: https://www.ibm.com/support/knowledgecenter/SSHS8R_7.1.0/com.ibm.worklight.apiref.doc/html/refjavascript-client/html/WL.Device.html , The WL.Device class in MFP JavaScript client API has methods setFriendlyName/getFriendlyName for setting/getting friendly name to/from MFP server.
However these to methods are not there in the MFP iOS/Android native API (i.e. class WLDevice in both platforms).
So, is there any way I can set friendly name using iOS/Android native API?
No, setting friendly name is only included in JavaScript. You could always make a portion of your app Web and set the friendly name there and run the rest of your app in Native.
If you want this to be a native API you may submit a feature request: https://www.ibm.com/developerworks/rfe/execute?use_case=submitRfe