Chatting over a Webhook Endpoint

This page describes how you can chat programatically over the API while receiving the responses over a webhook endpoint.

For the first request, use the api key and the channel ID you obtained from your channel provider. Leave the room ID blank, as you don’t have one for the first request.

Step 1: ask

POST https://proxy.opendatagermany.io/api/chm/channels/webhook/messages  
accept: application/json
Content-Type: application/json
x-api-key: ***

{
  "channelId": "***",
  "content": {
    "type": "Text",
    "text": "Hi Emma, what can you do for me?",
    "caption": "asked over the webhook!"
  }
}

Step 2: Get the reply

The API responds with the room ID of your newly created room! Use that for the next call to maintain the conversation’s context.

{  
  "roomId": "***"
}

Step 3: wait for the response

After processing your question, the bot answers the webhook as follows, again including your channel ID and room ID.

{  
  "messages": [
    {
      "text": "Hello! I'm Emma, your digital travel companion for Germany. I can assist you in planning your trip by providing information on sights, activities, accommodation, and much more. Whether you're interested in hiking through the Black Forest, taking a boat trip on the Elbe, or visiting the Oktoberfest in Bavaria, I'm here to help you plan an unforgettable journey through Germany!",
      "type": "Text",
      "caption": "AI generated info"
    }
  ],
  "roomId": "***",
  "channelId": "***"
}

Step 4: Ask on

For your followup question, use your room ID.

POST https://proxy.opendatagermany.io/api/chm/channels/webhook/messages  
accept: application/json
Content-Type: application/json
x-api-key: ***

{
  "channelId": "***",
  "roomId": "***",
  "content": {
    "type": "Text",
    "text": "That is great, I want to learn about a German Brauhaus!"
  }
}

Step 5: wait for another response

{
  "messages": [
    {
      "text": "Germany is renowned for its beer culture, and visiting a Brauhaus is a delightful way to experience this tradition. You can explore the fascinating world of German beer at various locations, such as the Museum of Bread and Art in Ulm, which celebrates the rich history of beer alongside bread. Additionally, Bavaria offers a vibrant beer garden experience where you can enjoy craft beer amidst picturesque surroundings. For more information on German beer traditions, you can visit <a href=\"https://www.germany.travel/en/experience-enjoy/german-beer-a-drinking-tradition.html\" target=\"_blank\">this link</a>.",
      "type": "Text",
      "caption": "AI generated info"
    }
  ],
  "roomId": "***",
  "channelId": "***"
}