Skip to Content

Add Webhook to Chatbot to Retrieve Tracking Info

test
0 %
Add Webhook to Chatbot to Retrieve Tracking Info
Details

Add Webhook to Chatbot to Retrieve Tracking Info

November 10, 2020
Created by
April 26, 2020
Add a webhook call in the package-tracking chatbot to retrieve information for a specific tracking number, using SAP Conversational AI.

You will learn

  • How to set a default webhook endpoint
  • How to call a webhook during a conversation
  • How to display the response

Prerequisites

In the previous tutorial, you created a chatbot to detect the intent of customers who want to track a package and to get the needed information.

In this tutorial, you will modify the chatbot so it calls an API to retrieve information on the package, based on a tracking number, and displays that information to the customer.


Step 1: Set default endpoint for webhooks
  1. Open your shippingbot bot.

  2. At the top right, click Settings.

    Endpoint
  3. Click Versions, and then click the arrow to the right of v1.

    Versions
  4. In the Bot Builder field, enter the endpoint to our application on SAP Cloud Platform: https://sapupschatbot.cfapps.eu10.hana.ondemand.com

  5. Click Save.

This endpoint contains a Python demo script that makes all kinds of API calls, including retrieving package information from UPS.

Log on to answer question
Step 2: Call API to retrieve parcel info
  1. Go back to the Build tab, and click the track-parcel skill.

  2. Go to Actions.

  3. Click Add New Message Group (at the bottom).

    Add group
  4. Click Add Condition.

    After If, click in the field and select @Yes, and then click Save.

    Click Connect External Service | Call Webhook

    Add webhook

    For the URL, enter /track_parcel, and click Save.

    Service path
Log on to answer question
Step 3: Test the bot

You can now test it by starting a conversation to trigger the @track-parcel intent, supplying the tracking number (e.g., 1Z12345E6205277936), and saying Yes, you want to track the package.

Conversation with API
The API to retrieve package information is retrieved if which intent `is-present`? Write it as it appears in the Actions subtab.
×

Next Steps

Back to top