Skip to content

Rocket.chat

URL Format

rocketchat://[username@]rocketchat-host/token[/channel|@recipient]*

URL Fields

  • UserName
    Default: empty
    URL part: rocketchat://username@host:port/tokena/tokenb/channel
  • Host (Required)
    URL part: rocketchat://username@host:port/tokena/tokenb/channel
  • Port (Required)
    URL part: rocketchat://username@host:port/tokena/tokenb/channel
  • TokenA (Required)
    URL part: rocketchat://username@host:port/tokena/tokenb/channel
  • TokenB (Required)
    URL part: rocketchat://username@host:port/tokena/tokenb/channel
  • Channel (Required)
    URL part: rocketchat://username@host:port/tokena/tokenb/channel

Query/Param Props

The services does not support any query/param props

Creating a Webhook in Rocket.chat

  1. Open up the chat Administration by clicking on Administration menu Screenshot 1

  2. Open Integrations and then click New Screenshot 2

  3. Fill in the information for the webhook and click Save. Please don't forget to Enable your integration. Screenshot 3

  4. If you did everything correctly, Rocket.chat will give you the URL and Token to your newly created webhook. Screenshot 4

  5. Format the service URL

    rocketchat://your-domain.com/8eGdRzc9r4YYNyvge/2XYQcX9NBwJBKfQnphpebPcnXZcPEi32Nt4NKJfrnbhsbRfX
                                 └────────────────────────────────────────────────────────────────┘
                                                               token
    

Additional URL configuration

Rocket.chat provides functionality to post as another user or to another channel / user, compared to the webhook configuration.
To do this, you can add a sender and/or channel / receiver to the service URL.

rocketchat://shoutrrrUser@your-domain.com/8eGdRzc9r4YYNyvge/2XYQcX9NBwJBKfQnphpebPcnXZcPEi32Nt4NKJfrnbhsbRfX/shoutrrrChannel
             └──────────┘                 └────────────────────────────────────────────────────────────────┘ └─────────────┘
                sender                                                   token                                   channel

rocketchat://shoutrrrUser@your-domain.com/8eGdRzc9r4YYNyvge/2XYQcX9NBwJBKfQnphpebPcnXZcPEi32Nt4NKJfrnbhsbRfX/@shoutrrrReceiver
             └──────────┘                 └────────────────────────────────────────────────────────────────┘ └───────────────┘
                sender                                                   token                                    receiver

Passing parameters via code

If you want to, you also have the possibility to pass parameters to the send function.
The following example contains all parameters that are currently supported.

params := (*types.Params)(
    &map[string]string{
        "username": "overwriteUserName",
        "channel": "overwriteChannel",
    },
)

service.Send("this is a message", params)

This will overwrite any options, that you passed via URL.

For more Rocket.chat Webhooks options see official guide.