Choose:
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
You'll need to ensure that you have Python installed on your computer. If Python isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:
python --version
You’ll need to have pip installed. If pip isn’t installed, follow the official pip installation instructions for your operating system to install it. You can check this by running:
pip --version
Install the Telnyx Python SDK by running the following:
pip install telnyx
Check out the Python API docs, or see the source on GitHub.
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
You'll need to ensure that you have Ruby installed on your computer. If Ruby isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:
ruby --version
You’ll need to have RubyGems installed. If RubyGems isn’t installed, follow the official RubyGems installation instructions for your operating system to install it. You can check this by running:
gem --version
Install the Telnyx Ruby Gem by running the following:
gem install telnyx
Check out the Ruby API docs, or see the source on GitHub.
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
You'll need to ensure that you have Node.js installed on your computer. If Node isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:
node --version
You’ll need to have npm installed (npm is installed with Node.js). You can check this by running:
npm --version
Install the Telnyx Node SDK by running the following:
npm install telnyx
Check out the Node API docs, or see the source on GitHub.
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
Make sure that you have at least PHP version 5.3 installed on your computer, as this is the minimum version of PHP that the SDK requires; we recommended you to always use the latest version of PHP. If PHP isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:
php --version
Your terminal should reply with something like this:
PHP 7.2.24-0ubuntu0.18.04.1 (cli) (built: Oct 28 2019 12:07:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
You’ll also need to have composer installed. Composer is PHP's package manager. While it's not a part of the PHP installation itself, it’s a de-facto standard that virtually every modern PHP library uses. If composer isn’t installed, follow the official composer installation instructions for your operating system to install it. You can check this by running:
composer --version
SDKs and other libraries are always installed for each project as a dependency and stored in a project-specific directory called vendor
that Composer manages.
There are two ways to add a package with Composer:
Using the Require Command
Create a new project directory or open an existing project directory in your terminal. Then, type the following command:
composer require telnyx/telnyx-php
This command installs the latest version of the SDK and automatically creates or updates the files composer.json
and composer.lock
.
Using composer.json
Create a new project directory or open an existing project directory. In this directory, create a file called composer.json
; if you already have this file, you can add the SDK to it; if you only have the SDK in it, the file should look like this:
{
"require": {
"telnyx/telnyx-php": "^0.0.1"
}
}
Keep in mind that you have to specify the version of the SDK in the file. You can see the available SDK versions on Packagist and learn more about different ways to specify versions, for example with ranges, in the Composer documentation.
After saving the file, open a terminal in the directory into which you've stored it and type this command:
composer install
Check out the PHP API docs, or see the source on GitHub.
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
You'll need to ensure that you have DotNet installed on your computer. If DotNet (core or framework) isn’t installed, follow the official installation instructions for your operating system to install it. You can check this by running the following:
Telnyx targets the .NET Standard 2.0. You should be running a supported verison of dotnet/Xamarin/Mono/Framework to leverage the SDK.
dotnet --version
Install the Telnyx.net SDK by running the following:
dotnet add package Telnyx.net
Check out the dotnet/C# API docs, see the source on GitHub, or see Package on NuGet
Send Message Async Example
The C# SDK supports Task based API calls.
By updating the Main method to support async calls, we can build a quick example.
Demo below instanciates the Telnyx client
using System;
using Telnyx;
using System.Threading.Tasks;
namespace demo_dotnet_telnyx
{
class Program
{
private static string TELNYX_API_KEY = System.Environment.GetEnvironmentVariable("TELNYX_API_KEY");
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
TelnyxConfiguration.SetApiKey(TELNYX_API_KEY);
MessagingSenderIdService service = new MessagingSenderIdService();
NewMessagingSenderId options = new NewMessagingSenderId
{
From = "+19198675309", // alphanumeric sender id
To = "+19198675310",
Text = "Hello, World!"
};
MessagingSenderId messageResponse = await service.CreateAsync(options);
Console.WriteLine(messageResponse.Id);
}
}
}
Set Up: Telnyx Development Environment
Get up and running with our Client libraries and start developing your Telnyx integration.
Integrating Telnyx into your app or website can begin as soon as you create a Telnyx account, requiring only two steps:
- Obtain your API key so Telnyx can authenticate your integration’s API requests
- Install a Client library so your integration can interact with the Telnyx API
Step 1: Obtain your API keys
Telnyx authenticates your API requests using your account’s API Key. If you do not include your key when making an API request, or use one that is incorrect or outdated, Telnyx returns an error.
Your API Keys are available in the "Auth" section of the Portal. Once you create an API Key you must save it for future use. You will only see your API Key once, on creation.
We include YOUR_API_KEY
in our code examples. Replace this text with your own API Key.
If you cannot see your API keys in the Portal, this means you do not have access to them. Only Telnyx account owners can access API Keys.
Step 2: Install a Client library
You'll need to ensure that you have at least Java JDK 1.8 installed on your computer. If Java isn’t installed, follow the installation instructions for your operating system. You can check this by running the following:
java -version
Check out the Java API docs, see the source on GitHub, or see Package on Maven Central
Install
Install the Telnyx SDK using Maven or Gradle.
The latest version can be found on our releases page.
Maven
Add the snip to your pom.xml file.
<dependency>
<groupId>com.telnyx.sdk</groupId>
<artifactId>telnyx</artifactId>
<version>{version}</version>
</dependency>
Gradle
Run the command
compile "com.telnyx.sdk:telnyx:{version}"
Send Message Example
Getting Started
- Sign up for a Telnyx Account
- Get your API Key
- Complete the messaging Learn and Build to:
- Get your first phone number
- Create your messaging profile
- Fill in the variables:
YOUR_TELNYX_NUMBER
,YOUR_TELNYX_API_KEY
,YOUR_MOBILE_NUMBER
in the code below
Demo below instanciates the Telnyx client
import com.telnyx.sdk.ApiClient;
import com.telnyx.sdk.ApiException;
import com.telnyx.sdk.Configuration;
import com.telnyx.sdk.auth.*;
import com.telnyx.sdk.model.*;
import com.telnyx.sdk.api.MessagesApi;
public class Example {
private static final String YOUR_TELNYX_NUMBER = "+19842550944";
private static final String YOUR_MOBILE_NUMBER = "+19198675309";
private static final String YOUR_TELNYX_API_KEY = "YOU_API_KEY";
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.telnyx.com/v2");
// Configure HTTP bearer authorization: bearerAuth
HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
bearerAuth.setBearerToken(YOUR_TELNYX_API_KEY);
MessagesApi apiInstance = new MessagesApi(defaultClient);
// CreateMessageRequest | Message payload
CreateMessageRequest createMessageRequest = new CreateMessageRequest()
.from(YOUR_TELNYX_NUMBER)
.to(YOUR_MOBILE_NUMBER)
.text("Hello From Telnyx");
try {
MessageResponse result = apiInstance.createMessage(createMessageRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessagesApi#createMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}