# Telnyx

> Send and track messages and manage Telnyx messaging profiles.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/telnyx

## Actions

### Cancel scheduled message

Cancel scheduled message.

**Inputs**

- Message ID (`message_id`, text, required): The id of the message to cancel

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "cc": [],
    "completed_at": "example",
    "cost": {
      "amount": "example",
      "currency": "example"
    },
    "cost_breakdown": {
      "carrier_fee": {
        "amount": "example",
        "currency": "example"
      },
      "rate": {
        "amount": "example",
        "currency": "example"
      }
    },
    "direction": "outbound",
    "encoding": "example",
    "errors": [],
    "from": {
      "carrier": "example",
      "line_type": "Wireline",
      "phone_number": "example"
    },
    "id": "example",
    "media": [],
    "messaging_profile_id": "example",
    "num_chars": 1,
    "organization_id": "example",
    "parts": 1,
    "received_at": "example",
    "record_type": "message",
    "sent_at": "example",
    "smart_encoding_applied": false,
    "subject": "example",
    "tags": [],
    "tcr_campaign_billable": false,
    "tcr_campaign_id": "example",
    "tcr_campaign_registered": "example",
    "text": "example",
    "to": [],
    "type": "SMS",
    "valid_until": "example",
    "webhook_failover_url": "example",
    "webhook_url": "example"
  }
}
```

### Create messaging profile

Create messaging profile.

**Inputs**

- Name (`name`, text, required): A user friendly name for the messaging profile.
- Whitelisted destinations (`whitelisted_destinations`, list, required): Destinations to which the messaging profile is allowed to send. The elements in the list must be valid ISO 3166-1 alpha-2 country codes. If set to `["*"]` all destinations will be allowed.
- Enabled (`enabled`, true/false): Specifies whether the messaging profile is enabled or not. Default: `true`.
- Webhook URL (`webhook_url`, text): The URL where webhooks related to this messaging profile will be sent.
- Webhook failover URL (`webhook_failover_url`, text): The failover URL where webhooks related to this messaging profile will be sent if sending to the primary URL fails.
- Webhook API version (`webhook_api_version`, text): Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 2010-04-01 format. One of: `1`, `2`, `2010-04-01`. Default: `2`.
- Number pool settings (`number_pool_settings`, object): Number pool settings.
- Url shortener settings (`url_shortener_settings`, object): Url shortener settings.
- Mm7 metadata (`mm7_metadata`, object): MM7 settings for inbound messages
- Alpha sender (`alpha_sender`, text): The alphanumeric sender ID to use when sending to destinations that require an alphanumeric sender ID.
- Daily spend limit (`daily_spend_limit`, text): The maximum amount of money (in USD) that can be spent by this profile before midnight UTC.
- Daily spend limit enabled (`daily_spend_limit_enabled`, true/false): Whether to enforce the value configured by `daily_spend_limit`.
- Mms fall back to sms (`mms_fall_back_to_sms`, true/false): enables SMS fallback for MMS messages. Default: `false`.
- Mms transcoding (`mms_transcoding`, true/false): enables automated resizing of MMS media. Default: `false`.
- Mobile only (`mobile_only`, true/false): Send messages only to mobile phone numbers. Default: `false`.
- Smart encoding (`smart_encoding`, true/false): Enables automatic character encoding optimization for SMS messages. When enabled, the system automatically selects the most efficient encoding (GSM-7 or UCS-2) based on message content to maximize character limits and minimize costs. Default: `false`.
- Features (`features`, object): Telnyx product features the messaging customer can enable on the messaging profile. Keys map to individual feature flags; unknown keys are accepted and preserved for forward compatibility with rolling deployments.
- Resource group ID (`resource_group_id`, text): The resource group ID to associate with this messaging profile.
- Health webhook URL (`health_webhook_url`, text): A URL to receive health check webhooks for numbers in this profile.
- Ai assistant ID (`ai_assistant_id`, text): The AI assistant ID to associate with this messaging profile.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "ai_assistant_id": "example",
      "alpha_sender": "example",
      "created_at": "example",
      "daily_spend_limit": "example",
      "daily_spend_limit_enabled": false,
      "enabled": false,
      "features": {
        "ai_opt_out_detection_enabled": false,
        "auto_chunk_long_messages": false
      },
      "health_webhook_url": "example",
      "id": "example",
      "mm7_metadata": {
        "mm7_failover_webhook_url": "example",
        "mm7_webhook_url": "example"
      },
      "mms_fall_back_to_sms": false,
      "mms_transcoding": false,
      "mobile_only": false,
      "name": "example",
      "number_pool_settings": {
        "geomatch": false,
        "long_code_weight": 1.0,
        "skip_unhealthy": false,
        "sticky_sender": false,
        "toll_free_weight": 1.0
      },
      "organization_id": "example",
      "record_type": "messaging_profile",
      "redaction_enabled": false,
      "redaction_level": 1,
      "resource_group_id": "example",
      "smart_encoding": false,
      "updated_at": "example",
      "url_shortener_settings": {
        "domain": "example",
        "prefix": "example",
        "replace_blacklist_only": false,
        "send_webhooks": false
      },
      "v1_secret": "example",
      "webhook_api_version": "1",
      "webhook_failover_url": "example",
      "webhook_url": "example",
      "whitelisted_destinations": []
    }
  }
}
```

### Delete messaging profile

Deletes the specified messaging profile and returns the profile's final configuration.

**Inputs**

- Messaging profile ID (`messaging_profile_id`, text, required): The id of the messaging profile to retrieve

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "ai_assistant_id": "example",
      "alpha_sender": "example",
      "created_at": "example",
      "daily_spend_limit": "example",
      "daily_spend_limit_enabled": false,
      "enabled": false,
      "features": {
        "ai_opt_out_detection_enabled": false,
        "auto_chunk_long_messages": false
      },
      "health_webhook_url": "example",
      "id": "example",
      "mm7_metadata": {
        "mm7_failover_webhook_url": "example",
        "mm7_webhook_url": "example"
      },
      "mms_fall_back_to_sms": false,
      "mms_transcoding": false,
      "mobile_only": false,
      "name": "example",
      "number_pool_settings": {
        "geomatch": false,
        "long_code_weight": 1.0,
        "skip_unhealthy": false,
        "sticky_sender": false,
        "toll_free_weight": 1.0
      },
      "organization_id": "example",
      "record_type": "messaging_profile",
      "redaction_enabled": false,
      "redaction_level": 1,
      "resource_group_id": "example",
      "smart_encoding": false,
      "updated_at": "example",
      "url_shortener_settings": {
        "domain": "example",
        "prefix": "example",
        "replace_blacklist_only": false,
        "send_webhooks": false
      },
      "v1_secret": "example",
      "webhook_api_version": "1",
      "webhook_failover_url": "example",
      "webhook_url": "example",
      "whitelisted_destinations": []
    }
  }
}
```

### Get balance

Retrieve the current balance, available credit, and credit limit for your account.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "available_credit": "example",
      "balance": "example",
      "credit_limit": "example",
      "currency": "example",
      "pending": "example",
      "record_type": "balance"
    }
  }
}
```

### Get group MMS

Retrieve all messages in a group MMS conversation by the group message ID.

**Inputs**

- Message ID (`message_id`, text, required): The group message ID.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": []
  }
}
```

### Get message

Get message.

**Inputs**

- Message ID (`message_id`, text, required): The id of the message

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "body": {
        "text": "example"
      },
      "cc": [],
      "child_message_id": "example",
      "completed_at": "example",
      "cost": {
        "amount": "example",
        "currency": "example"
      },
      "cost_breakdown": {
        "carrier_fee": {
          "amount": "example",
          "currency": "example"
        },
        "rate": {
          "amount": "example",
          "currency": "example"
        }
      },
      "direction": "outbound",
      "encoding": "example",
      "errors": [],
      "from": {
        "agent_id": "example",
        "agent_name": "example",
        "carrier": "example",
        "line_type": "Wireline",
        "phone_number": "example"
      },
      "id": "example",
      "media": [],
      "messaging_profile_id": "example",
      "num_chars": 1,
      "organization_id": "example",
      "parent_message_id": "example",
      "parts": 1,
      "received_at": "example",
      "record_type": "message",
      "sent_at": "example",
      "smart_encoding_applied": false,
      "subject": "example",
      "tags": [],
      "tcr_campaign_billable": false,
      "tcr_campaign_id": "example",
      "tcr_campaign_registered": "example",
      "template_id": "example",
      "template_name": "example",
      "text": "example",
      "to": [],
      "type": "SMS",
      "valid_until": "example",
      "wait_seconds": 1.0,
      "webhook_failover_url": "example",
      "webhook_url": "example"
    }
  }
}
```

### Get messaging profile

Returns the complete configuration of the specified messaging profile, including webhook and sender-selection settings.

**Inputs**

- Messaging profile (`messaging_profile_id`, text, required): The id of the messaging profile to retrieve

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "ai_assistant_id": "example",
      "alpha_sender": "example",
      "created_at": "example",
      "daily_spend_limit": "example",
      "daily_spend_limit_enabled": false,
      "enabled": false,
      "features": {
        "ai_opt_out_detection_enabled": false,
        "auto_chunk_long_messages": false
      },
      "health_webhook_url": "example",
      "id": "example",
      "mm7_metadata": {
        "mm7_failover_webhook_url": "example",
        "mm7_webhook_url": "example"
      },
      "mms_fall_back_to_sms": false,
      "mms_transcoding": false,
      "mobile_only": false,
      "name": "example",
      "number_pool_settings": {
        "geomatch": false,
        "long_code_weight": 1.0,
        "skip_unhealthy": false,
        "sticky_sender": false,
        "toll_free_weight": 1.0
      },
      "organization_id": "example",
      "record_type": "messaging_profile",
      "redaction_enabled": false,
      "redaction_level": 1,
      "resource_group_id": "example",
      "smart_encoding": false,
      "updated_at": "example",
      "url_shortener_settings": {
        "domain": "example",
        "prefix": "example",
        "replace_blacklist_only": false,
        "send_webhooks": false
      },
      "v1_secret": "example",
      "webhook_api_version": "1",
      "webhook_failover_url": "example",
      "webhook_url": "example",
      "whitelisted_destinations": []
    }
  }
}
```

### Get phone number

Get phone number.

**Inputs**

- Phone number ID (`phone_number_id`, text, required): Identifies the resource.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "activated_at": "example",
      "billing_group_id": "example",
      "call_forwarding_enabled": false,
      "call_recording_enabled": false,
      "caller_id_name_enabled": false,
      "cnam_listing_enabled": false,
      "connection_id": "example",
      "connection_name": "example",
      "country_iso_alpha2": "example",
      "created_at": "example",
      "customer_reference": "example",
      "deletion_lock_enabled": false,
      "emergency_address_id": "example",
      "emergency_enabled": false,
      "emergency_status": "active",
      "external_pin": "example",
      "hd_voice_enabled": false,
      "id": "example",
      "inbound_call_screening": "disabled",
      "messaging_campaign_id": "example",
      "messaging_profile_id": "example",
      "messaging_profile_name": "example",
      "phone_number": "example",
      "phone_number_type": "local",
      "purchased_at": "example",
      "record_type": "example",
      "source_type": "number_order",
      "status": "purchase-pending",
      "t38_fax_gateway_enabled": false,
      "tags": [],
      "updated_at": "example"
    }
  }
}
```

### Get webhook delivery

Provides webhook_delivery debug data, such as timestamps, delivery status and attempts.

**Inputs**

- Webhook delivery ID (`webhook_delivery_id`, text, required): Uniquely identifies the webhook_delivery.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "attempts": [],
      "finished_at": "example",
      "id": "example",
      "record_type": "example",
      "started_at": "example",
      "status": "delivered",
      "user_id": "example",
      "webhook": {
        "event_type": "example",
        "id": "example",
        "occurred_at": "example",
        "payload": {},
        "record_type": "event"
      }
    }
  }
}
```

### List alphanumeric sender IDs

List all alphanumeric sender IDs associated with a specific messaging profile.

**Inputs**

- Messaging profile (`messaging_profile_id`, text, required): The identifier of the messaging profile.
- Page number (`page_number`, number): Page number to retrieve (1-based). Default: `1`.
- Page size (`page_size`, number): Number of items to return per page. Default: `20`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### List available phone numbers

List available phone numbers.

**Inputs**

- Filter locality (`filter_locality`, text): Filter phone numbers by city.
- Filter administrative area (`filter_administrative_area`, text): Find numbers in a particular US state or CA province.
- Filter country code (`filter_country_code`, text): Filter phone numbers by country.
- Filter national destination code (`filter_national_destination_code`, text): Filter by the national destination code of the number.
- Filter rate center (`filter_rate_center`, text): Filter phone numbers by rate center. This filter is only applicable to USA and Canada numbers.
- Filter phone number type (`filter_phone_number_type`, text): Filter phone numbers by number type. One of: `local`, `toll_free` (Toll free), `mobile`, `national`, `shared_cost` (Shared cost).
- Filter limit (`filter_limit`, number): Limits the number of results.
- Filter best effort (`filter_best_effort`, true/false): Filter to determine if best effort results should be included. Only available in USA/CANADA.
- Filter quickship (`filter_quickship`, true/false): Filter to exclude phone numbers that need additional time after to purchase to activate. Only applicable for +1 toll_free numbers.
- Filter reservable (`filter_reservable`, true/false): Filter to ensure only numbers that can be reserved are included in the results.
- Filter exclude held numbers (`filter_exclude_held_numbers`, true/false): Filter to exclude phone numbers that are currently on hold/reserved for your account.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "best_effort_results": 1,
      "total_results": 1
    },
    "metadata": {
      "best_effort_results": 1,
      "total_results": 1
    }
  }
}
```

### List messaging profiles

Lists messaging profiles owned by the authenticated account. Apply the documented filters and pagination parameters to narrow the result set.

**Inputs**

- Filter name eq (`filter_name_eq`, text): Filter profiles by exact name match.
- Filter name contains (`filter_name_contains`, text): Filter profiles by name containing the given string.
- Filter name (`filter_name`, text): Filter by name
- Page (`page`, number): The page number to load. At least 1. Default: `1`.
- Page size (`page_size`, number): The size of the page. From 1 to 250. Default: `20`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### List phone numbers

List phone numbers.

**Inputs**

- Sort (`sort`, text): Specifies the sort order for results. If not given, results are sorted by created_at in descending order. One of: `purchased_at` (Purchased at), `phone_number` (Phone number), `connection_name` (Connection name), `usage_payment_method` (Usage payment method).
- Handle messaging profile error (`handle_messaging_profile_error`, text): Handle messaging profile error. One of: `true`, `false`. Default: `false`.
- Page size (`page_size`, number): The size of the page. From 1 to 250. Default: `20`.
- Page (`page`, number): The page number to load. At least 1. Default: `1`.
- Filter tag (`filter_tag`, text): Filter by phone number tags.
- Filter without tags (`filter_without_tags`, text): When set to 'true', filters for phone numbers that do not have any tags applied. All other values are ignored. One of: `true`, `false`.
- Filter phone number (`filter_phone_number`, text): Filter by phone number. Requires at least three digits. Non-numerical characters will result in no values being returned.
- Filter status (`filter_status`, text): Filter by phone number status. One of: `purchase-pending`, `purchase-failed`, `port-pending`, `active`, `deleted`, `port-failed`, `emergency-only`, `ported-out`, `port-out-pending`.
- Filter connection ID (`filter_connection_id`, text): Filter by connection_id.
- Filter voice usage payment method (`filter_voice_usage_payment_method`, text): Filter by usage_payment_method. One of: `pay-per-minute`, `channel`.
- Filter billing group ID (`filter_billing_group_id`, text): Filter by the billing_group_id associated with phone numbers. To filter to only phone numbers that have no billing group associated them, set the value of this filter to the string 'null'.
- Filter emergency address ID (`filter_emergency_address_id`, text): Filter by the emergency_address_id associated with phone numbers. To filter only phone numbers that have no emergency address associated with them, set the value of this filter to the string 'null'.
- Filter customer reference (`filter_customer_reference`, text): Filter numbers via the customer_reference set.
- Filter source (`filter_source`, text): Filter phone numbers by their source. Use 'ported' for numbers ported from other carriers, or 'purchased' for numbers bought directly from Telnyx. One of: `ported`, `purchased`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "errors": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### List profile phone numbers

Returns the phone numbers currently associated with the specified messaging profile.

**Inputs**

- Messaging profile (`messaging_profile_id`, text, required): The id of the messaging profile to retrieve
- Page (`page`, number): The page number to load. At least 1. Default: `1`.
- Page size (`page_size`, number): The size of the page. From 1 to 250. Default: `20`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### List profile short codes

Returns the short codes currently associated with the specified messaging profile.

**Inputs**

- Messaging profile (`messaging_profile_id`, text, required): The id of the messaging profile to retrieve
- Page (`page`, number): The page number to load. At least 1. Default: `1`.
- Page size (`page_size`, number): The size of the page. From 1 to 250. Default: `20`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### List webhook deliveries

Lists webhook_deliveries for the authenticated user

**Inputs**

- Page (`page`, number): The page number to load. At least 1. Default: `1`.
- Page size (`page_size`, number): The size of the page. From 1 to 250. Default: `20`.
- Filter event type (`filter_event_type`, text): Return only webhook_deliveries matching the given value of `event_type`. Accepts multiple values separated by a `,`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": [],
    "meta": {
      "page_number": 1,
      "page_size": 1,
      "total_pages": 1,
      "total_results": 1
    }
  }
}
```

### Schedule message

Schedule message.

**Inputs**

- From number (`from_number`, text): Sending address (+E.164 formatted phone number, alphanumeric sender ID, or short code). **Required if sending with a phone number, short code, or alphanumeric sender ID.**
- Messaging profile (`messaging_profile_id`, text): Unique identifier for a messaging profile. **Required if sending via number pool or with an alphanumeric sender ID.**
- To (`to`, text, required): Receiving address (+E.164 formatted phone number or short code).
- Text (`text`, text): Message body (i.e., content) as a non-empty string. **Required for SMS**
- Subject (`subject`, text): Subject of multimedia message
- Media URLs (`media_urls`, list): A list of media URLs. The total media size must be less than 1 MB. **Required for MMS**
- Webhook URL (`webhook_url`, text): The URL where webhooks related to this message will be sent.
- Webhook failover URL (`webhook_failover_url`, text): The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
- Use profile webhooks (`use_profile_webhooks`, true/false): If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile. Default: `true`.
- Type (`type`, text): The protocol for sending the message, either SMS or MMS. One of: `SMS`, `MMS`.
- Auto detect (`auto_detect`, true/false): Auto detect. Default: `false`.
- Send at (`send_at`, date and time, required): ISO 8601 formatted date indicating when to send the message - accurate up till a minute.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "body": {
        "text": "example"
      },
      "cc": [],
      "child_message_id": "example",
      "completed_at": "example",
      "cost": {
        "amount": "example",
        "currency": "example"
      },
      "cost_breakdown": {
        "carrier_fee": {
          "amount": "example",
          "currency": "example"
        },
        "rate": {
          "amount": "example",
          "currency": "example"
        }
      },
      "direction": "outbound",
      "encoding": "example",
      "errors": [],
      "from": {
        "agent_id": "example",
        "agent_name": "example",
        "carrier": "example",
        "line_type": "Wireline",
        "phone_number": "example"
      },
      "id": "example",
      "media": [],
      "messaging_profile_id": "example",
      "num_chars": 1,
      "organization_id": "example",
      "parent_message_id": "example",
      "parts": 1,
      "received_at": "example",
      "record_type": "message",
      "sent_at": "example",
      "smart_encoding_applied": false,
      "subject": "example",
      "tags": [],
      "tcr_campaign_billable": false,
      "tcr_campaign_id": "example",
      "tcr_campaign_registered": "example",
      "template_id": "example",
      "template_name": "example",
      "text": "example",
      "to": [],
      "type": "SMS",
      "valid_until": "example",
      "wait_seconds": 1.0,
      "webhook_failover_url": "example",
      "webhook_url": "example"
    }
  }
}
```

### Send group MMS

Queues an MMS addressed to multiple recipients as a group conversation. Delivery events are reported asynchronously through messaging webhooks.

**Inputs**

- Idempotency key (`idempotency_key`, text): Idempotency key.
- From number (`from_number`, text, required): Phone number, in +E.164 format, used to send the message.
- To (`to`, list, required): A list of destinations. No more than 8 destinations are allowed.
- Text (`text`, text): Message body (i.e., content) as a non-empty string.
- Subject (`subject`, text): Subject of multimedia message
- Media URLs (`media_urls`, list): A list of media URLs. The total media size must be less than 1 MB.
- Webhook URL (`webhook_url`, text): The URL where webhooks related to this message will be sent.
- Webhook failover URL (`webhook_failover_url`, text): The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
- Use profile webhooks (`use_profile_webhooks`, true/false): If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile. Default: `true`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "body": {
        "text": "example"
      },
      "cc": [],
      "child_message_id": "example",
      "completed_at": "example",
      "cost": {
        "amount": "example",
        "currency": "example"
      },
      "cost_breakdown": {
        "carrier_fee": {
          "amount": "example",
          "currency": "example"
        },
        "rate": {
          "amount": "example",
          "currency": "example"
        }
      },
      "direction": "outbound",
      "encoding": "example",
      "errors": [],
      "from": {
        "agent_id": "example",
        "agent_name": "example",
        "carrier": "example",
        "line_type": "Wireline",
        "phone_number": "example"
      },
      "id": "example",
      "media": [],
      "messaging_profile_id": "example",
      "num_chars": 1,
      "organization_id": "example",
      "parent_message_id": "example",
      "parts": 1,
      "received_at": "example",
      "record_type": "message",
      "sent_at": "example",
      "smart_encoding_applied": false,
      "subject": "example",
      "tags": [],
      "tcr_campaign_billable": false,
      "tcr_campaign_id": "example",
      "tcr_campaign_registered": "example",
      "template_id": "example",
      "template_name": "example",
      "text": "example",
      "to": [],
      "type": "SMS",
      "valid_until": "example",
      "wait_seconds": 1.0,
      "webhook_failover_url": "example",
      "webhook_url": "example"
    }
  }
}
```

### Send message

Send message.

**Inputs**

- Idempotency key (`idempotency_key`, text): Idempotency key.
- From number (`from_number`, text): Sending address (+E.164 formatted phone number, alphanumeric sender ID, or short code). **Required if sending with a phone number, short code, or alphanumeric sender ID.**
- Messaging profile (`messaging_profile_id`, text): Unique identifier for a messaging profile. **Required if sending via number pool or with an alphanumeric sender ID.**
- To (`to`, text, required): Receiving address (+E.164 formatted phone number or short code).
- Text (`text`, text): Message body (i.e., content) as a non-empty string. **Required for SMS**
- Subject (`subject`, text): Subject of multimedia message
- Media URLs (`media_urls`, list): A list of media URLs. The total media size must be less than 1 MB. **Required for MMS**
- Webhook URL (`webhook_url`, text): The URL where webhooks related to this message will be sent.
- Webhook failover URL (`webhook_failover_url`, text): The failover URL where webhooks related to this message will be sent if sending to the primary URL fails.
- Use profile webhooks (`use_profile_webhooks`, true/false): If the profile this number is associated with has webhooks, use them for delivery notifications. If webhooks are also specified on the message itself, they will be attempted first, then those on the profile. Default: `true`.
- Type (`type`, text): The protocol for sending the message, either SMS or MMS. One of: `SMS`, `MMS`.
- Auto detect (`auto_detect`, true/false): Auto detect. Default: `false`.
- Send at (`send_at`, date and time): ISO 8601 formatted date indicating when to send the message - accurate up till a minute.
- Encoding (`encoding`, text): Encoding. One of: `auto`, `gsm7`, `ucs2`. Default: `auto`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "body": {
        "text": "example"
      },
      "cc": [],
      "child_message_id": "example",
      "completed_at": "example",
      "cost": {
        "amount": "example",
        "currency": "example"
      },
      "cost_breakdown": {
        "carrier_fee": {
          "amount": "example",
          "currency": "example"
        },
        "rate": {
          "amount": "example",
          "currency": "example"
        }
      },
      "direction": "outbound",
      "encoding": "example",
      "errors": [],
      "from": {
        "agent_id": "example",
        "agent_name": "example",
        "carrier": "example",
        "line_type": "Wireline",
        "phone_number": "example"
      },
      "id": "example",
      "media": [],
      "messaging_profile_id": "example",
      "num_chars": 1,
      "organization_id": "example",
      "parent_message_id": "example",
      "parts": 1,
      "received_at": "example",
      "record_type": "message",
      "sent_at": "example",
      "smart_encoding_applied": false,
      "subject": "example",
      "tags": [],
      "tcr_campaign_billable": false,
      "tcr_campaign_id": "example",
      "tcr_campaign_registered": "example",
      "template_id": "example",
      "template_name": "example",
      "text": "example",
      "to": [],
      "type": "SMS",
      "valid_until": "example",
      "wait_seconds": 1.0,
      "webhook_failover_url": "example",
      "webhook_url": "example"
    }
  }
}
```

### Update messaging profile

Updates the supplied settings on the specified messaging profile. Settings omitted from the request remain unchanged.

**Inputs**

- Messaging profile ID (`messaging_profile_id`, text, required): The id of the messaging profile to retrieve
- Name (`name`, text): A user friendly name for the messaging profile.
- Enabled (`enabled`, true/false): Specifies whether the messaging profile is enabled or not.
- Webhook URL (`webhook_url`, text): The URL where webhooks related to this messaging profile will be sent.
- Webhook failover URL (`webhook_failover_url`, text): The failover URL where webhooks related to this messaging profile will be sent if sending to the primary URL fails.
- Webhook API version (`webhook_api_version`, text): Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 2010-04-01 format. One of: `1`, `2`, `2010-04-01`.
- Whitelisted destinations (`whitelisted_destinations`, list): Whitelisted destinations.
- Number pool settings (`number_pool_settings`, object): Number pool settings.
- Url shortener settings (`url_shortener_settings`, object): Url shortener settings.
- Mm7 metadata (`mm7_metadata`, object): MM7 settings for inbound messages
- Alpha sender (`alpha_sender`, text): The alphanumeric sender ID to use when sending to destinations that require an alphanumeric sender ID.
- Daily spend limit (`daily_spend_limit`, text): The maximum amount of money (in USD) that can be spent by this profile before midnight UTC.
- Daily spend limit enabled (`daily_spend_limit_enabled`, true/false): Whether to enforce the value configured by `daily_spend_limit`.
- Mms fall back to sms (`mms_fall_back_to_sms`, true/false): enables SMS fallback for MMS messages. Default: `false`.
- Mms transcoding (`mms_transcoding`, true/false): enables automated resizing of MMS media. Default: `false`.
- Mobile only (`mobile_only`, true/false): Send messages only to mobile phone numbers. Default: `false`.
- Smart encoding (`smart_encoding`, true/false): Enables automatic character encoding optimization for SMS messages. When enabled, the system automatically selects the most efficient encoding (GSM-7 or UCS-2) based on message content to maximize character limits and minimize costs. Default: `false`.
- Features (`features`, object): Telnyx product features the messaging customer can enable on the messaging profile. Keys map to individual feature flags; unknown keys are accepted and preserved for forward compatibility with rolling deployments.
- Ai assistant ID (`ai_assistant_id`, text): The ID of the AI assistant associated with this messaging profile.
- Redaction enabled (`redaction_enabled`, true/false): Set to true to enable message content redaction on this profile, or false to disable it. Ignored if the organization is not on the redaction allowlist. See the [Message Redaction guide](/docs/messaging/messages/message-redaction) for what is redacted. Default: `false`.
- Redaction level (`redaction_level`, number): The redaction level to apply when redaction is enabled. 1: redact message records and reporting only. 2 (default): also redact inbound webhook payloads. See the [Message Redaction guide](/docs/messaging/messages/message-redaction). Default: `2`.

**Outputs**

- `data` (object): The response from Telnyx.

**Example output**

```json
{
  "data": {
    "data": {
      "ai_assistant_id": "example",
      "alpha_sender": "example",
      "created_at": "example",
      "daily_spend_limit": "example",
      "daily_spend_limit_enabled": false,
      "enabled": false,
      "features": {
        "ai_opt_out_detection_enabled": false,
        "auto_chunk_long_messages": false
      },
      "health_webhook_url": "example",
      "id": "example",
      "mm7_metadata": {
        "mm7_failover_webhook_url": "example",
        "mm7_webhook_url": "example"
      },
      "mms_fall_back_to_sms": false,
      "mms_transcoding": false,
      "mobile_only": false,
      "name": "example",
      "number_pool_settings": {
        "geomatch": false,
        "long_code_weight": 1.0,
        "skip_unhealthy": false,
        "sticky_sender": false,
        "toll_free_weight": 1.0
      },
      "organization_id": "example",
      "record_type": "messaging_profile",
      "redaction_enabled": false,
      "redaction_level": 1,
      "resource_group_id": "example",
      "smart_encoding": false,
      "updated_at": "example",
      "url_shortener_settings": {
        "domain": "example",
        "prefix": "example",
        "replace_blacklist_only": false,
        "send_webhooks": false
      },
      "v1_secret": "example",
      "webhook_api_version": "1",
      "webhook_failover_url": "example",
      "webhook_url": "example",
      "whitelisted_destinations": []
    }
  }
}
```
