Tekos
  • General overview
  • Tekos Chat Workspace
    • Tekos Chat
      • Design and Interface of chat
      • Apps
    • Tekos Chat FAQ
      • How to create a workspace for my team?
      • How to invite members to my workspace?
      • What is a room and to create it?
      • Public or private room? What is the difference?
      • What is Roles & Permissions?
      • What is power level and how does it work?
      • How do I know if my message was read?
      • How can I share a file?
      • How to search messages and/or files.
      • How do I make video calls?
      • How do I change my profile settings?
      • Notifications settings.
      • Room settings.
      • How to leave a room?
      • Lab features
  • Flow Builder
    • Tekos Flow
      • Editor UI
      • Building your first flow
        • Import / Export Flow
      • Flow.tekos library
      • Subflows
  • Omnichannel Live Chat
    • Overview
    • Channels
      • WhatsApp
  • Building Apps
    • Building Apps
      • Connecting flow with the chat
      • HTTP Requests
        • Handle query parameters passed to an HTTP endpoint
        • Handle url parameters in an HTTP endpoint
    • Chat Surfaces
      • Modals - Adaptive Cards
        • Building An Adaptive Card
        • Basic usage of Cards
        • Variables in the Cards
        • Action Buttons
      • Messages
        • Instant Messaging
          • Message types
        • Getting the Messages
        • Getting events for a room
        • Messages webhook
    • Interactivity in the Chat
      • Shortcuts
      • Slash Commands
      • Buttons
Powered by GitBook
On this page

Was this helpful?

  1. Building Apps
  2. Building Apps
  3. HTTP Requests

Handle url parameters in an HTTP endpoint

PreviousHandle query parameters passed to an HTTP endpointNextChat Surfaces

Last updated 4 years ago

Was this helpful?

Problem

You want to create a single HTTP endpoint that can handle requests where parts of the path are set per-request.

For example, a single endpoint that can handle requests to both:

http://example.com/hello-param/Nick
http://example.com/hello-param/Dave

Solution

Use named path parameters in your HTTP In node’s URL property and then access the specific value provided in a request using the msg.req.params property of the message.

Flow

Example

[~]$ curl http://localhost:1880/hello-param/Nick
<html>
    <head></head>
    <body>
        <h1>Hello Nick!</h1>
    </body>
</html>

Discussion

Named path parameters in the URL property can be used to identify parts of the path that can vary between requests.

The msg.req.params property is an object of key/value pairs for each path parameter.

In the above example, the node is configured with a URL of /hello-params/:name, so a request to /hello-param/Nick results in the msg.req.params property containing:

{
    "name": "Nick"
}