ballerinax/vonage.sms Ballerina library

1.5.2

Overview

The Vonage SMS API v1.0.10 connector(https://nexmo-api-specification.herokuapp.com/sms) OpenAPI specification. With the SMS API you can send SMS from your account and lookup messages both messages that you've sent as well as messages sent to your virtual numbers. Numbers are specified in E.164 format. More SMS API documentation is at https://developer.nexmo.com/messaging/sms/overview.

Key Features

  • Programmatic access to create and manage resources via REST API
  • Send and publish data through the API
  • Access analytics, reports, and performance metrics
  • Manage user accounts and profiles

Prerequisites

Before using this connector in your Ballerina application, complete the following:

Quickstart

To use the Vonage SMS connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

First, import the ballerinax/vonage.sms module into the Ballerina project.

Copy
import ballerinax/vonage.sms as vs;

Step 2: Create a new connector instance

Initialize the connector.

Copy
vs:Client baseClient = check new Client();

Step 3: Invoke connector operation

  1. 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. You can now provide the API key and API secret obtained from the Vonage API Dashboard in the 'NewMessage' record with other message details.

    Send an SMS

    Copy
    public function main() {
        NewMessage message = {
            api_key: "7b....4",
            api_secret: "Gd......4",
            'from: "Vonage APIs",
            to: "947....7",
            text: "Hello"
        };
        InlineResponse200|error response = baseClient->sendAnSms(message);
        if (response is InlineResponse200) {
            log:printInfo(response.toString());
        } else {
            log:printError(response.toString());
        }
    }
  2. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/vonage.sms;Copy

Other versions

See more...

Metadata

Released date: 3 days ago

Version: 1.5.2

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 233

Current verison: 0


Weekly downloads


Source repository


Keywords

Type/Connector

Vendor/Vonage

Area/Communication

Communication/Call & SMS

Cost/Paid


Contributors