@prass/botpress-native
Version:
A simple and powerful SDK for integrating Botpress Chat API with React Native,
17 lines (16 loc) • 1.03 kB
TypeScript
import { Botpress } from "../Botpress";
import { GetOrCreateConversationParams } from "../../types/botpress";
import { CreateConversationResponse } from "../../types/botpress.response";
/**
* Handles the API request to retrieve an existing conversation or create a new one.
*
* This function sends a POST request to the Botpress API to get or create a conversation.
*
* @param this - The `Botpress` class instance, providing access to class properties like `ChatApiBaseUrl` and `userKey`.
* @param {GetOrCreateConversationParams} params - Parameters for retrieving or creating a conversation.
* @param {string} params.id - The unique identifier for the conversation.
*
* @returns {Promise<CreateConversationResponse>} The retrieved or newly created conversation data.
* @throws {Exception} If the request fails, throws a custom exception with relevant error details.
*/
export declare function handleGetOrCreateConversation(this: Botpress, { id }: GetOrCreateConversationParams): Promise<CreateConversationResponse>;