# Decode Messages(Event)

SDK can decode ABI-compatible External Inbound, External Outbound and Internal messages.

## Types of messages

ABI-compatible contracts generate abi-compatible messages, or, to be exact, abi-compatible message bodies :)

So, if you have ABI on hands, you can decode these messages.

You can use both full message boc for decoding and only message body for decoding.

## Let's decode!

Core SDK provides

* `decode_message` method for full boc of message decoding
* `decode_message_body` method for only message body decoding.

## Usage

```javascript
const decoded = (await client.abi.decode_message({
        abi: abiContract(HelloEventsContract.abi),
        message: boc,
    }));
switch (decoded.body_type) {
case MessageBodyType.Input:
    log_.push(`External inbound message, function "${decoded.name}", fields: ${JSON.stringify(decoded.value)}` );
    break;
case MessageBodyType.Output:
    log_.push(`External outbound message (return) of function "${decoded.name}", fields: ${JSON.stringify(decoded.value)}`);
    break;
case MessageBodyType.Event:
    log_.push(`External outbound message (event) "${decoded.name}", fields: ${JSON.stringify(decoded.value)}`);
    break;
}
```

## Sample source code

**Core**

<https://github.com/everx-labs/sdk-samples/blob/master/core-examples/node-js/subscribe-and-decode/index.js>

**AppKit**

<https://github.com/everx-labs/sdk-samples/tree/master/appkit-examples/listen-and-decode>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.everos.dev/ever-sdk/guides/work_with_contracts/decode_message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
