Module mitto.sms

ballerinax/mitto.sms Ballerina library
Overview
This is a generated connector for Mitto SMS and Bulk SMS APIs v1 OpenAPI specification. Send individual SMS reliably and securely, or send them in bulk. You can choose from different servers to test with based on where you want to send a message to.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Mitto account
- Obtain tokens by following this guide
Quickstart
To use the Neutrino connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/mitto.sms
module into the Ballerina project.
import ballerinax/mitto.sms;
Step 2: Create a new connector instance
Create a sms:ApiKeysConfig
with the API key obtained, and initialize the connector with it.
sms:ApiKeysConfig config = { xMittoApiKey: "<API_KEY>" } sms:Client baseClient = check new Client(config);
Step 3: Invoke connector operation
-
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example on how to send an sms using the connector.
Send an sms
public function main() { sms:Body body = { 'from: "MITTO SMS", to: "15555552795", text: "Hello, World!", test: true }; sms:Sms response = check baseClient->sendSms(body); log:printInfo(response.toString()); }
-
Use
bal run
command to compile and run the Ballerina program.