# Buttons with URLs

**URL:** <https://forums.rocket.chat/t/buttons-with-urls/15921>\
**Category:** Development\
**Created:** [February 6, 2023, 11:51am UTC](https://forums.rocket.chat/t/buttons-with-urls/15921 "2023-02-06T11:51:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![r3plica](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@r3plica](https://forums.rocket.chat/u/r3plica)\
**Post date:** [February 6, 2023, 11:51am UTC](https://forums.rocket.chat/t/buttons-with-urls/15921/1 "2023-02-06T11:51:12Z")

</div>

Hi all,

I hope someone can help me.  
I am trying to build a rocket chat app that has a button. When you click that button, it opens a new window to a URL.

I have looked at the developer documentation and found that the button already has a URL property:

> **[Building blocks](https://developer.rocket.chat/apps-engine/adding-features/uikit/uikit-building-blocks)**

There is a \* by the URL property, but it doesn’t say what the \* is for (i.e. there is no other \* on the page).  
Here is my code as it stands:

```auto
export class RmgExperienceAppCommand implements ISlashCommand {
    public command = "video";
    public i18nDescription = "Sends a video call link to the shopper";
    public i18nParamsExample = "";
    public providesPreview = false;

    constructor(private commandHelper: ICommandHelper) {}

    public async executor(
        context: SlashCommandContext,
        read: IRead,
        modify: IModify,
        http: IHttp
    ): Promise<void> {
        const creator = modify.getCreator();
        const messageStructure = creator.startMessage();
        const sender = context.getSender(); // the user calling the slashcommand
        const room = context.getRoom() as any; // the current room
        const brand = await read
            .getEnvironmentReader()
            .getSettings()
            .getValueById(AppSetting.RmgBrand);

        let message = "";

        const { id: rocketChatRoomId } = room;
        const { username: visitorUsername, token: visitorToken } = room.visitor;
        const { username: agentName } = sender;

        const experienceAppUrl: Record<string, any> =
            await this.commandHelper.getExperienceAppUrl(
                brand,
                visitorUsername,
                visitorToken,
                agentName,
                rocketChatRoomId
            );

        if (experienceAppUrl.error) {
            message = experienceAppUrl.error;
        } else {
            const blockBuilder = creator.getBlockBuilder();

            blockBuilder.addActionsBlock({
                blockId: "video-call",
                appId: "experience-app",
                elements: [
                    blockBuilder.newButtonElement({
                        actionId: "join-call",
                        text: blockBuilder.newPlainTextObject("Join Call"),
                        style: ButtonStyle.PRIMARY,
                        url: `${experienceAppUrl.data}?agent=1`,
                    }),
                ],
            });
            messageStructure.setBlocks(blockBuilder);
        }

        messageStructure.setSender(sender).setRoom(room).setText(message);

        await creator.finish(messageStructure);
    }

```

I hoped that would work, but unfortunately it doesn’t do anything (when I type /video no message is presented to the agent or customer)

Any help would be appreciated

---

<div class="post-metadata">

**Author:** ![shahrukh](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@shahrukh](https://forums.rocket.chat/u/shahrukh)\
**Post date:** [February 7, 2023, 1:50pm UTC](https://forums.rocket.chat/t/buttons-with-urls/15921/2 "2023-02-07T13:50:15Z")

</div>

You need to register this command under " [extendConfiguration](https://rocketchat.github.io/Rocket.Chat.Apps-engine/classes/app.app-1.html#extendconfiguration)" you can refer [Sub-command pattern - Rocket.Chat Developer](https://developer.rocket.chat/apps-engine/sample-app-snippets/sub-command-pattern)

---

<div class="post-metadata">

**Author:** ![r3plica](https://avatars.discourse-cdn.com/v4/letter/r/ebca7d/32.png) [@r3plica](https://forums.rocket.chat/u/r3plica)\
**Post date:** [February 17, 2023, 10:06am UTC](https://forums.rocket.chat/t/buttons-with-urls/15921/4 "2023-02-17T10:06:16Z")

</div>

Do you have an example, both them links I have tried before and they do not mention opening URLs/Links
