# `KapsoEx.Platform.Media`
[🔗](https://github.com/rocket4ce/kapso_ex/blob/v0.1.0/lib/kapso_ex/platform/media.ex#L1)

Ingest media from a public URL so it can be sent in messages.

To upload bytes, use `KapsoEx.WhatsApp.Media.upload/4`.

# `upload`

```elixir
@spec upload(KapsoEx.Client.t(), String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, KapsoEx.Error.t()}
```

Fetches `source` (a public URL) and uploads it to Meta for
`phone_number_id`.

## Options

  * `:delivery` - `"meta_media"` (default, returns a media ID for
    messages) or `"meta_resumable_asset"` (returns a handle, for example
    for template headers or profile pictures).
  * `:filename`, `:mime_type` - override what is inferred from the URL.

## Examples

    {:ok, %{"data" => %{"target" => %{"media_id" => media_id}}}} =
      Platform.Media.upload(client, phone_number_id, "https://example.com/menu.pdf")

---

*Consult [api-reference.md](api-reference.md) for complete listing*
