Skip to main content

Receiving Form Contact Data

This guide describes how to add a webhook that will receive form contact data after chatbot users answer questions.

This guide assumes that your account has the necessary permissions.

Service Provider Setup#

To start, you will need to have a service provider configured. You can find instructions in the guide Adding A Service Provider. Your service provider must have the capability for form_contact. To register this capability, you can use the REST API register operation. Here is an example of the data that should be sent to that API:

{  "name": "form_contact",  "status": "Enabled",  "apiVersion": "V1",  "description": "Optional description for this capability"}

Once you have done this, your service provider should look similar to this:

Service Provider - Form Contact

When form data is submitted in a chatbot conversation, then we will send that data to a webhook that uses the base URL defined in your service provider. For example, if your base URL is https://my-university.com/api, then the form data will be sent in a POST request to https://my-university.com/api/webhook/handle.

Receiving data#

With your service provider all setup, you are now ready to receive form data. The form data currently can come from 2 different sources: contact forms, and inquiry forms.

Contact Forms#

You can configure your chatbot to ask the user to fill out a contact form when the chatbot is asked a question that it does not know (considered an "IDK"). If this is enabled for an office, you will be able to receive the form data after the user answers all of the form's questions.

First, navigate to the Chatbot -> Bot Behavior settings page. Find the office that you would like to enable contact forms in, then click the "Edit" button.

Bot Behavior Settings

In the "IDK Settings" section, choose "Contact Form" in the "Behavior" dropdown. Then set an email to be contacted. This email address will receive a transcript of the chat conversation. Optionally select additional fields that you would like the chatbot to request from the user, and a message to be sent to the user once they complete the form. Once you ready, click the "Save" button.

Bot Behavior Settings - IDK Contact Form

Now when users interact with the chatbot in that office, if they ask a question that the bot is unable to answer, the bot will ask the user if they would like to fill out a contact form. If they agree, then once they answer all the questions, we will send the form data to your webhook URL in a POST request. For example, if the user has the following conversation with the chatbot:

Chatbot Conversation - Contact Form

Then our system will POST the following data to your webhook:

{  "formId": "contact",  "values": {    "body": "User:\nSkip Question(s)\n\nEdbot:\nOk, what would you like to know?\n\nUser:\nhow deep is your love?\n\nEdbot:\nSorry, I don't have the answer to that. Would you like to contact the office?\n\nUser:\nYes, please\n\nEdbot:\nI can help you reach someone. What is your name?\n\nUser:\nJohn Smith\n\nEdbot:\nWhat is your e-mail address?\n\nUser:\njohn.smith@mail.com\n\nEdbot:\nWhat is the best phone number to reach you?\n\nUser:\n555-123-4567\n\nEdbot:\nWhat is your student ID number? You can also say \"I don't have one.\"\n\nUser:\n9987766\n\nEdbot:\nYou're almost done! Answer this last question and the transcript of our conversation will be sent. Is there anything else you'd like to add?\n\nUser:\nno thank you\n\nEdbot:\nThanks for filling out that form! Someone will be with you shortly ๐Ÿ™‚\n\n",    "name": "John Smith",    "email": "john.smith@mail.com",    "phone": "555-123-4567",    "triggerMessage": "how deep is your love?",    "campus": "Boulder Campus",    "office": "Diversity Office",    "studentId": "9987766"  }}

Inside the values object, there will be the chat transcript in the body field. Then there will be a field for the question/answer values that were selected when you configured your IDK Settings in your chatbot's bot behavior settings.

Inquiry Forms#

When inquiry forms are enabled for an office, you will be able to receive the form data after the user answers all of the form's questions.

First, navigate to the Chatbot -> Bot Behavior settings page. Find the office that you would like to enable inquiry forms in, then click the "Edit" button.

Bot Behavior Settings

After choosing to enable the form in this office, you will see a list of the possible form questions that can be asked to the chatbot user. Select as many as you like, with at least 1 being required. Once you are ready, click the "Save" button.

Bot Behavior Settings - Inquiry Form

Now when users interact with the chatbot in that office, they will first be presented with an inquiry form. Once they have completed the form, we will send the form data to your webhook URL in a POST request. For example, if the user has the following conversation with the chatbot:

Chatbot Conversation - Inquiry Form

Then our system will POST the following data to your webhook:

{  "formId": "inquiry_form",  "values": {    "body": "User:\nAnswer Question(s)\n\nEdbot:\nWhat is your first and last name?\n\nUser:\nJohn Smith\n\nEdbot:\nWhat is your email address?\n\nUser:\njohn.smith@mail.com\n\nEdbot:\nWhat is your phone number?\n\nUser:\n555-123-4567\n\nEdbot:\nOk, what would you like to know?\n\n",    "office": "Diversity Office",    "name": "John Smith",    "email": "john.smith@mail.com",    "phone": "555-123-4567"  }}

Inside the values object, there will be the chat transcript in the body field. Then there will be a field for each of the question/answer values that were selected when you configured inquiry form in your chatbot's bot behavior settings.