telnyx v0.3.0 Telnyx.MessagingPhoneNumbers View Source
Context for managing messaging phone numbers
Link to this section Summary
Functions
Lists all messaging phone numbers.
Retrieves a messaging phone number.
Updates a messaging phone number.
Link to this section Functions
Lists all messaging phone numbers.
api_key = "YOUR_API_KEY"
Telnyx.MessagingPhoneNumbers.list(api_key, page: %{size: 10})
Example response:
{:ok,
[
%{
"MMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"SMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"country_code" => "US",
"created_at" => "2020-04-27T15:33:17.098Z",
"eligible_messaging_products" => ["A2P", "P2P"],
"features" => %{
"mms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
},
"sms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
}
},
"health" => %{
"inbound_outbound_ratio" => 0.06521739130434782,
"message_count" => 98.0,
"spam_ratio" => 0.0,
"success_ratio" => 1.0
},
"id" => "8787893573721994846",
"messaging_product" => "A2P",
"messaging_profile_id" => "21994846-5bdf-4fd6-b75f-6d2f633b08bd",
"organization_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1",
"phone_number" => "+18665552368",
"phone_number_country" => "US",
"phone_number_type" => "longcode",
"record_type" => "messaging_phone_number",
"traffic_type" => "A2P",
"type" => "longcode",
"updated_at" => "2020-04-27T15:33:17.098Z",
"user_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1"
}
]
}
Retrieves a messaging phone number.
Examples
api_key = "YOUR_API_KEY"
Telnyx.MessagingPhoneNumbers.retrieve("+18665552368", api_key)
Example response:
{:ok,
%{
"MMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"SMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"country_code" => "US",
"created_at" => "2020-04-27T15:33:17.098Z",
"eligible_messaging_products" => ["A2P", "P2P"],
"features" => %{
"mms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
},
"sms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
}
},
"health" => %{
"inbound_outbound_ratio" => 0.06521739130434782,
"message_count" => 98.0,
"spam_ratio" => 0.0,
"success_ratio" => 1.0
},
"id" => "8787893573721994846",
"messaging_product" => "A2P",
"messaging_profile_id" => "21994846-5bdf-4fd6-b75f-6d2f633b08bd",
"organization_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1",
"phone_number" => "+18665552368",
"phone_number_country" => "US",
"phone_number_type" => "longcode",
"record_type" => "messaging_phone_number",
"traffic_type" => "A2P",
"type" => "longcode",
"updated_at" => "2020-04-27T15:33:17.098Z",
"user_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1"
}}
See https://developers.telnyx.com/docs/api/v2/messaging/Phone-Numbers#retrieveMessagingPhoneNumber
Updates a messaging phone number.
Examples
api_key = "YOUR_API_KEY"
{:ok, number} = Telnyx.MessagingPhoneNumbers.retrieve("+18665552368", api_key)
%{messaging_profile_id: "uuid"}
|> Telnyx.MessagingPhoneNumbers.update(number["id"], api_key)
Example response:
{:ok,
%{
"MMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"SMS" => %{
"domestic_two_way" => true,
"enabled" => false,
"international_inbound" => false,
"international_outbound" => false
},
"country_code" => "US",
"created_at" => "2020-04-27T15:33:17.098Z",
"eligible_messaging_products" => ["A2P", "P2P"],
"features" => %{
"mms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
},
"sms" => %{
"domestic_two_way" => true,
"international_inbound" => false,
"international_outbound" => false
}
},
"health" => %{
"inbound_outbound_ratio" => 0.06521739130434782,
"message_count" => 98.0,
"spam_ratio" => 0.0,
"success_ratio" => 1.0
},
"id" => "8787893573721994846",
"messaging_product" => "A2P",
"messaging_profile_id" => "uuid",
"organization_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1",
"phone_number" => "+18665552368",
"phone_number_country" => "US",
"phone_number_type" => "longcode",
"record_type" => "messaging_phone_number",
"traffic_type" => "A2P",
"type" => "longcode",
"updated_at" => "2020-04-27T15:33:17.098Z",
"user_id" => "21994846-d17b-4cde-8fbf-e37bd8baa4b1"
}}
See https://developers.telnyx.com/docs/api/v2/messaging/Phone-Numbers#updateMessagingPhoneNumber