Send a message using an alphanumeric sender ID
Send an SMS message using an alphanumeric sender ID. This is SMS only.
POST
/
messages
/
alphanumeric
/
sender
/
id
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.messages.sendWithAlphanumericSender({
from: 'MyCompany',
messaging_profile_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
text: 'text',
to: '+E.164',
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.messages.send_with_alphanumeric_sender(
from_="MyCompany",
messaging_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
text="text",
to="+E.164",
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Messages.SendWithAlphanumericSender(context.TODO(), telnyx.MessageSendWithAlphanumericSenderParams{
From: "MyCompany",
MessagingProfileID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
Text: "text",
To: "+E.164",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messages.MessageSendWithAlphanumericSenderParams;
import com.telnyx.sdk.models.messages.MessageSendWithAlphanumericSenderResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessageSendWithAlphanumericSenderParams params = MessageSendWithAlphanumericSenderParams.builder()
.from("MyCompany")
.messagingProfileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.text("text")
.to("+E.164")
.build();
MessageSendWithAlphanumericSenderResponse response = client.messages().sendWithAlphanumericSender(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.messages.send_with_alphanumeric_sender(
from: "MyCompany",
messaging_profile_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
text: "text",
to: "+E.164"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->messages->sendWithAlphanumericSender(
from: 'MyCompany',
messagingProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
text: 'text',
to: '+E.164',
useProfileWebhooks: true,
webhookFailoverURL: 'webhook_failover_url',
webhookURL: 'webhook_url',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messages send-with-alphanumeric-sender \
--api-key 'My API Key' \
--from MyCompany \
--messaging-profile-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--text text \
--to +E.164curl --request POST \
--url https://api.telnyx.com/v2/messages/alphanumeric/sender/id \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "MyCompany",
"to": "+E.164",
"text": "<string>",
"messaging_profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"webhook_url": "<string>",
"webhook_failover_url": "<string>",
"use_profile_webhooks": true
}
'{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"num_chars": 13,
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": [
"Greetings"
],
"cost": {
"amount": "0.0051",
"currency": "USD"
},
"cost_breakdown": {
"carrier_fee": {
"amount": "0.00305",
"currency": "USD"
},
"rate": {
"amount": "0.00205",
"currency": "USD"
}
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": [],
"wait_seconds": 0.5
}
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
A valid alphanumeric sender ID on the user's account.
Example:
"MyCompany"
Receiving address (+E.164 formatted phone number).
Example:
"+E.164"
The message body.
The messaging profile ID to use.
Callback URL for delivery status updates.
Failover callback URL for delivery status updates.
If true, use the messaging profile's webhook settings.
Response
Successful response with the sent message.
Show child attributes
Show child attributes
Example:
{
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"num_chars": 13,
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": ["Greetings"],
"cost": { "amount": "0.0051", "currency": "USD" },
"cost_breakdown": {
"carrier_fee": { "amount": "0.00305", "currency": "USD" },
"rate": { "amount": "0.00205", "currency": "USD" }
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": [],
"wait_seconds": 0.5
}
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.messages.sendWithAlphanumericSender({
from: 'MyCompany',
messaging_profile_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
text: 'text',
to: '+E.164',
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.messages.send_with_alphanumeric_sender(
from_="MyCompany",
messaging_profile_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
text="text",
to="+E.164",
)
print(response.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Messages.SendWithAlphanumericSender(context.TODO(), telnyx.MessageSendWithAlphanumericSenderParams{
From: "MyCompany",
MessagingProfileID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
Text: "text",
To: "+E.164",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.messages.MessageSendWithAlphanumericSenderParams;
import com.telnyx.sdk.models.messages.MessageSendWithAlphanumericSenderResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
MessageSendWithAlphanumericSenderParams params = MessageSendWithAlphanumericSenderParams.builder()
.from("MyCompany")
.messagingProfileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.text("text")
.to("+E.164")
.build();
MessageSendWithAlphanumericSenderResponse response = client.messages().sendWithAlphanumericSender(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.messages.send_with_alphanumeric_sender(
from: "MyCompany",
messaging_profile_id: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
text: "text",
to: "+E.164"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->messages->sendWithAlphanumericSender(
from: 'MyCompany',
messagingProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
text: 'text',
to: '+E.164',
useProfileWebhooks: true,
webhookFailoverURL: 'webhook_failover_url',
webhookURL: 'webhook_url',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx messages send-with-alphanumeric-sender \
--api-key 'My API Key' \
--from MyCompany \
--messaging-profile-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--text text \
--to +E.164curl --request POST \
--url https://api.telnyx.com/v2/messages/alphanumeric/sender/id \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "MyCompany",
"to": "+E.164",
"text": "<string>",
"messaging_profile_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"webhook_url": "<string>",
"webhook_failover_url": "<string>",
"use_profile_webhooks": true
}
'{
"data": {
"record_type": "message",
"direction": "outbound",
"id": "40385f64-5717-4562-b3fc-2c963f66afa6",
"type": "MMS",
"messaging_profile_id": "4000eba1-a0c0-4563-9925-b25e842a7cb6",
"organization_id": "b448f9cc-a842-4784-98e9-03c1a5872950",
"from": {
"phone_number": "+18445550001",
"carrier": "TELNYX LLC",
"line_type": "VoIP"
},
"to": [
{
"phone_number": "+18665550001",
"status": "queued",
"carrier": "T-MOBILE USA, INC.",
"line_type": "Wireless"
}
],
"cc": [],
"text": "Hello, World!",
"num_chars": 13,
"subject": "From Telnyx!",
"media": [
{
"url": "https://pbs.twimg.com/profile_images/1142168442042118144/AW3F4fFD_400x400.png",
"content_type": null,
"sha256": null,
"size": null
}
],
"webhook_url": "https://www.example.com/hooks",
"webhook_failover_url": "https://backup.example.com/hooks",
"encoding": "GSM-7",
"parts": 1,
"tags": [
"Greetings"
],
"cost": {
"amount": "0.0051",
"currency": "USD"
},
"cost_breakdown": {
"carrier_fee": {
"amount": "0.00305",
"currency": "USD"
},
"rate": {
"amount": "0.00205",
"currency": "USD"
}
},
"tcr_campaign_id": "TCPA3X7",
"tcr_campaign_billable": true,
"tcr_campaign_registered": "REGISTERED",
"received_at": "2019-01-23T18:10:02.574Z",
"sent_at": null,
"completed_at": null,
"valid_until": null,
"errors": [],
"wait_seconds": 0.5
}
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}