> For the complete documentation index, see [llms.txt](https://www.webln.guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.webln.guide/building-lightning-apps/webln-reference/webln.keysend.md).

# webln.keysend()

Request the user to send a keysend payment. This is a spontaneous payment that does not require an invoice and only needs a destination public key and and amount.

#### Method

```typescript
async keysend(args: KeysendArgs): SendPaymentResponse;
```

#### Parameters

```typescript
interface KeysendArgs {
  destination: string;
  amount: string | number;
  customRecords?: Record<string, string>;
}
```

* `destination`\
  Hex encoded public key of the destination node. This is a string of length 66 that starts either with `02` or `03`.
* `amount`\
  The amount of satoshis you want to send as a stringified integer.
* `customRecords`\
  A `map<string, string>` of records that are appended to the payment. The key should be a stringified integer from the [TLV Registry](https://github.com/satoshisstream/satoshis.stream/blob/main/TLV_registry.md). The value should be an *unencoded*, plain string. \
  \
  The WebLN provider should handle the encoding if necessary. If no custom records are needed, this parameter can be omitted.

#### Response

```typescript
interface SendPaymentResponse {
  preimage: string;
}
```

* `preimage`\
  Note that the `preimage` is not a proof of payment, because unlike a bolt11 payment it is generated by the sender, not by the recipient.

### Code Examples

#### Sending a message

```typescript
await webln.enable();
const result = await webln.keysend({
    destination: "03006fcf3312dae8d068ea297f58e2bd00ec1ffe214b793eda46966b6294a53ce6", 
    amount: "1", 
    customRecords: {
        "34349334": "HELLO AMBOSS"
    }
});
```

{% embed url="<https://codepen.io/getalby/pen/jOYJYzP>" %}

#### 🎧 Podcasting 2.0: Send a boostagram

Manual payments to a podcast or episode and attach your own message.

{% embed url="<https://codepen.io/getalby/pen/PoeezNj>" %}

#### 🎧 Podcasting 2.0: Send a stream payment

Automatic payments while listening to an episode.&#x20;

{% embed url="<https://codepen.io/getalby/pen/QWrrErJ?editors=1011>" %}

### Resources

* [TLV Registry](https://github.com/satoshisstream/satoshis.stream/blob/main/TLV_registry.md)
* [Podcasting 2.0 BLIP](https://github.com/lightning/blips/blob/master/blip-0010.md)
* [Builder's Guide: Sending messages with keysend](https://docs.lightning.engineering/lightning-network-tools/lnd/send-messages-with-keysend)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.webln.guide/building-lightning-apps/webln-reference/webln.keysend.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
