Alphanumeric Sender

| cURL | Python | PHP | Node | Java | .NET | Ruby |


cURL

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

Use the send message endpoint

Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messaging_profile_id parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
curl -X POST \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{
    "from": "Telnyx",
    "to": "+13115552367",
    "text": "Hello, world!",
    "messaging_profile_id": "YOUR_MESSAGING_PROFILE_ID"
  }' \
  https://api.telnyx.com/v2/messages

Note: After pasting the above content, Kindly check and remove any new line added

Python

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

When sending messages, use the send message endpoint. Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messaging_profile_id parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
import telnyx

telnyx.api_key = "YOUR_API_KEY"

destination_number = "+13115552367"

telnyx.Message.create(
    from_="Telnyx",
    to=destination_number,
    text="Hello, world!",
    messaging_profile_id="YOUR_MESSAGING_PROFILE_ID",
)

Note: After pasting the above content, Kindly check and remove any new line added

PHP

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

When sending messages, use the send message endpoint. Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messaging_profile_id parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
\Telnyx\Telnyx::setApiKey('YOUR_API_KEY');

\Telnyx\Message::Create([
  "from" => "Telnyx",
  "to" => "+18445552367",
  "text" => "Hello, World!",
  "messaging_profile_id" => "YOUR_MESSAGING_PROFILE_ID"
]);

Note: After pasting the above content, Kindly check and remove any new line added

Node

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

When sending messages, use the send message endpoint. Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messaging_profile_id parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
var telnyx = require('telnyx')(YOUR_API_KEY);

telnyx.messages.create(
 {
    'from': 'Telnyx',
    'to': '+18445552367',
    'text': 'Hello, World!',
    'messaging_profile_id': 'YOUR_MESSAGING_PROFILE_ID'
  },
  function(err, response) {
    // asynchronously called
    console.log(response);
  }
);

Note: After pasting the above content, Kindly check and remove any new line added

Java

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

Use the send message endpoint Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messagingprofileid parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
import java.util.Arrays;
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 {
    //Alpha sender ID
    private static final String YOUR_ALPHA_SENDER_ID = "Telnyx";
    private static final String YOUR_MOBILE_NUMBER = "+19198675309";
    private static final String YOUR_TELNYX_API_KEY = "YOUR_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_ALPHA_SENDER_ID)
                .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();
        }
    }
}

Note: After pasting the above content, Kindly check and remove any new line added

.NET

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

Use the send message endpoint Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messagingprofileid parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
using System;
using Telnyx;
using System.Threading.Tasks;

namespace send_alpha_numeric_sms
{
  class Program
  {
    private static string TELNYX_API_KEY = System.Environment.GetEnvironmentVariable("TELNYX_API_KEY");
    private static string alphaSenderID = "Telnyx"; //Alphanumeric Sedner ID input
    private static string destinationNumber = "+19198675309";

    static async Task Main(string[] args)
    {
      Console.WriteLine("Hello World!");
      TelnyxConfiguration.SetApiKey(TELNYX_API_KEY);
      MessagingSenderIdService service = new MessagingSenderIdService();
      NewMessagingSenderId options = new NewMessagingSenderId
      {
        From = alphaSenderID,
        To = destinationNumber,
        Text = "Hello, World!"
      };
      try
      {
        MessagingSenderId messageResponse = await service.CreateAsync(options);
        Console.WriteLine(messageResponse.Id);

      }
      catch (Exception e)
      {
        Console.WriteLine(e.Message);
      }
    }
  }
}

Note: After pasting the above content, Kindly check and remove any new line added

Ruby

An Alphanumeric Sender ID lets you send messages using a custom ID constructed from a combination of alpha (a-z, A-Z) and numeric (0-9) characters as well as spaces. This makes the sender identifiable to the receiver, as companies can set their brand name as the ID (e.g., TELNYX). It's commonly used for sending one-way text messages, as the person receiving the message will be unable to reply with an Alphanumeric Sender ID.

Note: Each country regulates alphanumeric sender ID differently. Ensure that you're complying with the local regulations.

When sending messages, use the send message endpoint. Instead of specifying a phone number as the “From” field, provide the Alphanumeric Sender ID. You will also need to specify the Messaging Profile (via the messaging_profile_id parameter) that will be used to send the message.

Note: Telnyx attempts to deliver your message whenever possible. If you use a sending number that is unable to deliver the message, Telnyx will failover to using an generic alphanumeric sender ID to terminate the message.

Copy
Copied
require "telnyx"

Telnyx.api_key = "YOUR_API_KEY"

to_number = "DESTINATION_NUMBER"

response = Telnyx::Message.create(
    from: "Telnyx",
    to: to_number,
    text: "Hello, world!",
    messaging_profile_id: "YOUR_MESSAGING_PROFILE_ID"
)

Note: After pasting the above content, Kindly check and remove any new line added