Utilities
While integrating SDKs, the initial step involves defining the account and user details.
Use the below functions to invoke the respective details.
Account details
- You can obtain the account ID using
User details
- You can access the authenticated user details using Name, Email, _id will return current user’s name, email and user id.
Role details
- Retrieve assigned App roles This property lists all of the roles assigned to the current user in an app.
Syntax
Example
returns
This property returns an array of roles assigned to the current user. Each role will have an ID and a name.
Example
Note
Use this property to return the first role in the list of roles assigned to a user console.log(kf.user.AppRoles[0])
Example
APIs in SDK
In Kissflow SDKs, you can initiate both internal and external API calls.
For internal APIs, refer to the Kissflow API documentation.
- You can use the
kf.api
method to fetch internal APIs. kf.api
is equipped with default header tokens, ensuring secure and authenticated API calls.
Parameters
url (String)
Resoure URL for the REST API call to be fetched,
config (Object)
An object containing any custom settings you want to apply to the request. The possible options
-
1. method
The request method, e.g., “GET”, “POST”, “DELETE”, etc., with the default being “GET”
-
2. body
Payload to be sent to an api as object.
Note: A request using the GET method cannot have a body.
Syntax
Example
Consider a process form submission api.
Client methods
Show Toast
Displays the configured toast message to the clients.
Show confirm
Displays the confirmation dialog to the client and returns the client’s response as an output.
Example
To configure a confirmation dialog for every form submission
Redirect to URL
Redirects the client to a specific URL in the Kissflow application or to an external url.
Example
To redirect a client to a feedback form post submitting their data, you can add the redirection URL to the above syntax.