API
Integrations
Conversational Plugins
5min
a plugin enables the connection of a digital human to an external api or service for instance, a plugin can facilitate integration with a conversational ai solution, utilize a specific llm, access knowledge bases, or conduct internet searches a plugin communicates with the unith digital humans backend system to provide responses to user messages plugin webhook unith plugins communicate with the backend following a webhook communication pattern the plugin should implement a specific post endpoint /conversation/{userid}/message the unith backend will send events to this endpoint for each user message the body of the post request follows this format { \[ { "type" "text", "payload" { "type" "text", "message" "hello world!" } } ] } the plugin should respond to the post request with an equivalent json format { \[ { "type" "text", "payload" { "type" "text", "message" "this is the response from plugin" } } ] } note that the post body and the response are formatted as a list the aim of this list is to support several parts for each message, potentially of different type, like "images" or other types of data or metadata at the moment the api only supports text options the plugin events can include optional parameters in the payload these parameters can be used to provide extra metadata needed for the plugin the options is a json object that is added to the payload { \[ { "type" "text", "payload" { "type" "text", "message" "hello world!" "options" { "example param" "foo" } } } ] } how to register a plugin with a digital human a plugin can be registered with a digital human using the operationmode="plugin" through the api in the digital human creation process, use the following parameters in the post /head/create endpoint { "operationmode" "plugin", "pluginoperationalmodeconfig" { "name" "\<plugin name>", "url" "\<plugin url>", "options" { "\<optional param>" "option value" } } } the parameter pluginoperationalmodeconfig url should be the full base path of the url preceding /conversation/{userid}/message for instance, if the the plugin endpoint path is https //myservice example com/api/conversation/{userid}/message you have to set the url field as "pluginoperationalmodeconfig" { "name" "example", "url" "https //myservice example com/api/" } please see create a custom plugin docid\ cpb5mdzf8tnjkwyh4geyt , where we provide a step by step tutorial that explains how to create a custom plugin using python