Skip to main content

create_message

Function create_message 

Source
pub fn create_message(data: &str, metadata: &str) -> Result<String, String>
Expand description

Create a message JSON string from data and metadata.

§Arguments

  • data - JSON string containing the message data (goes to context.data)
  • metadata - JSON string containing the message metadata (goes to context.metadata)

§Returns

JSON string representing the complete message, or an error message

§Example

const message = create_message('{"name": "John"}', '{"type": "user"}');
const result = await engine.process(message);