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

Link to this function

create(params, api_key)

View Source
create(map(), String.t()) ::
  {:ok, map()}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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

Link to this function

delete(uuid, api_key)

View Source
delete(String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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

Link to this function

list(api_key, opts \\ [])

View Source
list(String.t(), Keyword.t()) ::
  {:ok, [map()]}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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"]
    }
  ]
}
Link to this function

list_messaging_profile_phone_numbers(uuid, api_key, opts \\ [])

View Source
list_messaging_profile_phone_numbers(String.t(), String.t(), Keyword.t()) ::
  {:ok, [map()]}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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"
      }
    ]
  }

See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles#listMessagingProfilePhoneNumbers

Link to this function

list_messaging_profile_short_codes(uuid, api_key, opts \\ [])

View Source
list_messaging_profile_short_codes(String.t(), String.t(), Keyword.t()) ::
  {:ok, [map()]}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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"
      }
    ]
  }

See https://developers.telnyx.com/docs/api/v2/messaging/Messaging-Profiles#listMessagingProfileShortCodes

Link to this function

retrieve(uuid, api_key)

View Source
retrieve(String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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

Link to this function

update(params, uuid, api_key)

View Source
update(map(), String.t(), String.t()) ::
  {:ok, map()}
  | {:error,
     %Telnyx.Error{
       __exception__: term(),
       error_code: term(),
       message: term(),
       meta: term(),
       source: term(),
       status_code: term(),
       title: term()
     }}

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