SDKs overview

MessageBird (Bird) offers a suite of Software Development Kits (SDKs) designed to facilitate integration with its communication APIs. These SDKs are available for several popular programming languages, abstracting the complexities of direct HTTP requests, authentication, and error handling. The primary goal of these SDKs is to enable developers to programmatically manage communication channels such as SMS, voice calls, WhatsApp messages, and email within their applications. By using an SDK, developers can interact with Bird's platform using native language constructs and objects, which can simplify development cycles compared to manual API calls Bird developer documentation.

The SDKs typically handle:

  • Authentication: Managing API keys or access tokens securely.
  • Request Formatting: Constructing API requests with appropriate headers and body payloads.
  • Response Parsing: Interpreting API responses, including success and error states.
  • Object Mapping: Converting API data into language-specific objects.

While the official SDKs cover a range of core functionalities, developers also have the option to interact directly with the Bird HTTP API v2 using any HTTP client library if their preferred language is not officially supported or if custom integration logic is required. SDKs are generally recommended for standard use cases due to their convenience and maintenance by Bird.

Official SDKs by language

MessageBird (Bird) provides official SDKs for several programming languages, each maintained to support the latest API versions and features. These SDKs are distributed through standard package managers specific to each language ecosystem, ensuring ease of installation and dependency management.

Language Package Manager / Name Installation Command Example Maturity / Status
C# NuGet: MessageBird Install-Package MessageBird Stable, Actively Maintained
Go go get github.com/messagebird/go-rest-api/v2 go get github.com/messagebird/go-rest-api/v2 Stable, Actively Maintained
Java Maven: com.messagebird:java-rest-api <dependency><groupId>com.messagebird</groupId><artifactId>java-rest-api</artifactId><version>X.Y.Z</version></dependency> Stable, Actively Maintained
Node.js npm: messagebird npm install messagebird Stable, Actively Maintained
PHP Composer: messagebird/php-rest-api composer require messagebird/php-rest-api Stable, Actively Maintained
Python pip: python-messagebird pip install python-messagebird Stable, Actively Maintained
Ruby Bundler / RubyGems: messagebird-rest gem install messagebird-rest Stable, Actively Maintained

Installation

Installing Bird's SDKs typically involves using the standard package manager for your chosen programming language. This section provides specific installation instructions for each supported language.

C# (.NET)

For C# projects, the MessageBird SDK is distributed via NuGet. You can install it using the NuGet Package Manager Console or the .NET CLI.

# Using NuGet Package Manager Console
Install-Package MessageBird

# Using .NET CLI
dotnet add package MessageBird

Go

The Go SDK can be installed using the go get command.

go get github.com/messagebird/go-rest-api/v2

Java

For Java projects, the SDK is available through Maven Central. Add the following dependency to your pom.xml file (replace X.Y.Z with the latest version):

<dependency>
    <groupId>com.messagebird</groupId>
    <artifactId>java-rest-api</artifactId>
    <version>X.Y.Z</version>
</dependency>

If you are using Gradle, add this to your build.gradle file:

implementation 'com.messagebird:java-rest-api:X.Y.Z'

Node.js

The Node.js SDK is published on npm. Install it using npm or yarn:

# Using npm
npm install messagebird

# Using yarn
yarn add messagebird

PHP

The PHP SDK is available via Composer. Add it to your project using the following command:

composer require messagebird/php-rest-api

Python

For Python, the SDK is distributed through pip. Install it with:

pip install python-messagebird

Ruby

The Ruby SDK is available as a gem. Install it using Bundler or RubyGems:

# Using Bundler (add to Gemfile then bundle install)
gem 'messagebird-rest'

# Or directly via RubyGems
gem install messagebird-rest

Quickstart example

This quickstart demonstrates how to send an SMS message using the Python SDK. This example assumes you have already installed the python-messagebird package and have your API key ready. For a more comprehensive overview of API keys and authentication, consult the Bird authentication guide.

import messagebird

# Replace with your actual MessageBird API Key
# It's recommended to use environment variables for sensitive data.
API_KEY = "YOUR_MESSAGEBIRD_API_KEY"

# Initialize the MessageBird client
client = messagebird.Client(API_KEY)

try:
    # Send an SMS message
    # 'originator' can be a phone number or an alphanumeric sender ID
    # 'recipients' should be a list of phone numbers in E.164 format
    message = client.message_create(
        originator='MessageBird',
        recipients=['+1234567890'], # Replace with a valid recipient number
        body='Hello from MessageBird Python SDK!'
    )

    print(f"Message sent successfully! ID: {message.id}")
    print(f"Status: {message.status}")

except messagebird.client.ErrorException as e:
    print("An error occurred while sending the message:")
    for error in e.errors:
        print(f"Code: {error.code}, Description: {error.description}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

This snippet initializes the MessageBird client with an API key, then uses the message_create method to send an SMS. The originator field specifies the sender, recipients is a list of destination phone numbers, and body contains the message content. Error handling is included to catch potential issues during the API call, such as invalid API keys or malformed requests. For additional examples across different languages and API functionalities, refer to the Bird SMS quickstart guides.

Community libraries

While MessageBird (Bird) provides official SDKs for major programming languages, the broader developer community may also contribute unofficial libraries or wrappers. These community-driven projects can offer support for additional languages, frameworks, or specific use cases not covered by the official SDKs. However, it is important to note that community libraries are not officially supported or maintained by Bird, and their stability, security, and adherence to the latest API specifications may vary.

When considering a community-contributed library, developers are advised to evaluate its:

  • Maintenance Status: Check the project's activity, recent commits, and issue resolution frequency.
  • Documentation: Assess the clarity and completeness of the library's documentation.
  • Community Support: Look for an active community or contributors who can provide assistance.
  • Security Practices: Review the code for any potential security vulnerabilities, especially when handling sensitive API keys or customer data. Developers should always adhere to best practices for securing API keys, such as using environment variables or dedicated secret management services, as recommended by security organizations like the OAuth 2.0 Security Best Current Practice guidelines.
  • API Compatibility: Verify that the library is compatible with the version of the Bird API you intend to use Bird API v2 reference.

Developers seeking alternatives or support for niche requirements beyond the scope of official SDKs might find community libraries beneficial, but should exercise due diligence in their selection and implementation. The official Bird developer documentation remains the primary authoritative source for API specifications and recommended integration patterns.