telnyx v0.3.0 Telnyx.MessagingProfiles View Source
Context for managing messaging profiles
Link to this section Summary
Functions
Creates a messaging profile.
Deletes a messaging profile.
Lists all messaging profiles.
Lists phone numbers associated with messaging profile.
Lists short codes associated with messaging profile.
Retrieves a messaging profile.
Updates a messaging profile.
Link to this section Functions
Creates a messaging profile.
Examples
api_key = "YOUR_API_KEY"
%{name: "Summer Campaign"}
|> Telnyx.MessagingProfiles.create(api_key)
Example response:
{:ok,
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"enabled" => true,
"id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name" => "Summer Campaign",
"organization_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type" => "messaging_profile",
"updated_at" => "2019-01-23T18:10:02.574Z",
"webhook_api_version" => "2",
"webhook_failover_url" => nil,
"webhook_url" => nil,
"whitelisted_destinations" => ["US"]
}
}
See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles?#createMessagingProfile
Deletes a messaging profile.
Examples
api_key = "YOUR_API_KEY"
{:ok, messaging_profile} = Telnyx.MessagingProfiles.retrieve("uuid", api_key)
Telnyx.MessagingProfiles.delete(messaging_profile["id"], api_key)
Example response:
{:ok,
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"enabled" => true,
"id" => "uuid",
"name" => "Profile for Messages",
"organization_id" => "uuid",
"record_type" => "messaging_profile",
"updated_at" => "2019-01-23T18:10:02.574Z",
"webhook_api_version" => "2",
"webhook_failover_url" => nil,
"webhook_url" => nil,
"whitelisted_destinations" => ["US"]
}
}
See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles#deleteMessagingProfile
Lists all messaging profiles.
api_key = "YOUR_API_KEY"
Telnyx.MessagingProfiles.list(api_key, page: %{size: 10})
Example response:
{:ok,
[
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"enabled" => true,
"id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name" => "Profile for Messages",
"organization_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type" => "messaging_profile",
"updated_at" => "2019-01-23T18:10:02.574Z",
"webhook_api_version" => "2",
"webhook_failover_url" => nil,
"webhook_url" => nil,
"whitelisted_destinations" => ["US"]
}
]
}
Lists phone numbers associated with messaging profile.
Examples
api_key = "YOUR_API_KEY"
Telnyx.MessagingProfiles.list_messaging_profile_phone_numbers("uuid", api_key, page: %{size: 10})
Example response:
{:ok,
[
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"id" => "+18665550001",
"messaging_profile_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"phone_number" => "+18005550001",
"record_type" => "messaging_phone_number",
"updated_at" => "2019-01-23T18:10:02.574Z"
}
]
}
Lists short codes associated with messaging profile.
Examples
api_key = "YOUR_API_KEY"
Telnyx.MessagingProfiles.list_messaging_profile_short_codes("uuid", api_key, page: %{size: 10})
Example response:
{:ok,
[
%{
"country_code" => "US",
"created_at" => "2019-01-23T18:10:02.574Z",
"id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"messaging_profile_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"organization_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type" => "short_code",
"short_code" => "12345",
"updated_at" => "2019-01-23T18:10:02.574Z"
}
]
}
Retrieves a messaging profile.
Examples
api_key = "YOUR_API_KEY"
Telnyx.MessagingProfiles.retrieve("uuid", api_key)
Example response:
{:ok,
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"enabled" => true,
"id" => "uuid",
"name" => "Profile for Messages",
"organization_id" => "uuid",
"record_type" => "messaging_profile",
"updated_at" => "2019-01-23T18:10:02.574Z",
"webhook_api_version" => "2",
"webhook_failover_url" => nil,
"webhook_url" => nil,
"whitelisted_destinations" => ["US"]
}
}
See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles#retrieveMessagingProfile
Updates a messaging profile.
Examples
api_key = "YOUR_API_KEY"
%{name: "Summer Campaign"}
|> Telnyx.MessagingProfiles.update("uuid", api_key)
Example response:
{:ok,
%{
"created_at" => "2019-01-23T18:10:02.574Z",
"enabled" => true,
"id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name" => "Summer Campaign",
"organization_id" => "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"record_type" => "messaging_profile",
"updated_at" => "2019-01-23T18:10:02.574Z",
"webhook_api_version" => "2",
"webhook_failover_url" => nil,
"webhook_url" => nil,
"whitelisted_destinations" => ["US"]
}
}
See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles#updateMessagingProfile