Back to EIP

PatternMessage is a data record that the messaging system can transmit through a message channel.
How Ballerina helps

Ballerina is a data-oriented language. It has first-class support for data to be repressed as arrays, maps, records, and tuples. These values can be read and written to message channels.

MessageCommand MessageDocument MessageMessage Channel
Copy
import ballerina/http;

type SurveyUpdateRequest record {
    string title;
    string from_template_id;
    boolean footer;
    string folder_id;
    int theme_id;
};

final http:Client surveyMonkey = check new ("http://api.surveymonkey.com/v3/surveys");

public function main() returns error? {
    SurveyUpdateRequest message = {
        title: "Customer Satisfaction Survey 2023",
        from_template_id: "customer_satisfaction_template_7",
        footer: true,
        folder_id: "customer_satisfaction",
        theme_id: 789
    };
    _ = check surveyMonkey->/v3/surveys/["1267"].put(message, targetType = http:Response);
}