---
updatedAt: 2025-11-11T00:12:32.000Z
agentTools:
  projectIndex: https://developers.openweb.com/llms.txt
---

# View Actions Callback

The `SPViewActionsCallbacks` interface supports exposing user interactions with OpenWeb's internal views. This interface has one method: `callback`.

<br />

```kotlin
fun callback(type: SPViewActionCallbackType, source: SPViewSourceType, postId: String)
```

| Argument Name                   | Value                                                                                          |
| ------------------------------- | ---------------------------------------------------------------------------------------------- |
| `postId` String                 | Current post ID of the Pre-Conversation or Conversation                                        |
| `source` SPViewSourceType       | Source view where the action takes place<br /><br />See: [SPViewSourceType](#spviewsourcetype) |
| `type` SPViewActionCallbackType | Type of view action<br /><br />See: [SPViewActionCallbackType](#spviewactioncallbacktype)      |

When an action occurs, the SDK calls the `callback` method with the relevant parameters.

<br />
<hr />

## Set SPViewActionsCallbacks on a view

When using the `SpotIm` to get the Pre-Conversation or to open the full Conversation, you can set the `SPViewActionsCallbacks` parameter as shown in the following example.

```kotlin
private val viewActionCallback = object : SPViewActionsCallbacks {
    override fun callback(type: SPViewActionCallbackType, source: SPViewSourceType, postId: String) {
        when(type) {
            is SPViewActionCallbackType.ArticleHeaderPressed -> Log.d("ViewActionCallback", "ARTICLE_HEADER_PRESSED source: " + source.value)
            is SPViewActionCallbackType.OpenUserProfile -> Log.d("ViewActionCallback", "OpenPublisherUser for user: " + type.userId)
        }
    }
}

...
  
SpotIm.getPreConversationFragment(CONVERSATION_ID,
    conversationOptions,
        object : SpotCallback<Fragment> {
        override fun onSuccess(response: Fragment) {}
        override fun onFailure(exception: SpotException) {}
        },
    viewActionCallback
)
  
SpotIm.getConversationIntent(context, CONVERSATION_ID,
    conversationOptions
    object : SpotCallback<Intent> {
        override fun onSuccess(response: Intent) {}
        override fun onFailure(exception: SpotException) {}
    },
    viewActionCallback
)
```

<br />
<hr />

## Reference

### SPViewActionCallbackType

`SPViewActionCallbackType` is the type of view action. The following table lists the possible enums.

<HTMLBlock>{`
<span class="manual-tbl-font">
    <table>
        <thead>
            <tr>
                <th>SPViewActionCallbackType</th>
                <th>Possible SPViewSourceType</th>
                <th>Description</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td width="30%"><code>ArticleHeaderPressed</code></td>
                <td width="35%"><code>.CONVERSATION</code>,<br /><code>.CREATE_COMMENT</code></td>
                <td width="35%">Click on article header view.</td>
            </tr>
            <tr>
                <td><code>OpenUserProfile(val userId: String, val context: Context)</code></td>
                <td><code>.PRE_CONVERSATION</code>,<br /><code>.CONVERSATION</code></td>
                <td>Click on profile (only when configured to receive a callback instead of opening the profile page).</td>
            </tr>
        </tbody>
    </table>
</span>
`}</HTMLBlock>

<br />
<br />

### SPViewSourceType

`SPViewSourceType` is the source view where the action takes place. The following table lists the possible enums.

<HTMLBlock>{`
<span class="manual-tbl-font">
    <table>
        <thead>
            <tr>
                <th>SPViewSourceType</th>
                <th>Description</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td width="30%"><code>CONVERSATION</code></td>
                <td width="70%">Conversation View</td>
            </tr>
            <tr>
                <td><code>CREATE_COMMENT</code></td>
                <td>Create Comment View</td>
            </tr>
            <tr>
                <td><code>LOGIN</code></td>
                <td>Login View</td>
            </tr>
            <tr>
                <td><code>PRE_CONVERSATION</code></td>
                <td>Pre-Conversation View</td>
            </tr>
        </tbody>
    </table>
</span>
`}</HTMLBlock>

<br />

<HTMLBlock>{`

  
<style>
.rm-Pagination {
  display: none;
}
</style>
`}</HTMLBlock>