Context

A dialogue consists not only of the sentences written, but also of the context of a conversation. This is additional information that helps you to formulate more precise answers. You can save these values and access them again and again.

General concepts

There is a distinction between different access levels for the context parameters: non, read and read+write.

  • Non are internal parameters that can neither be read nor written.
  • Read permission means parameters that can be read but not modified. These are fields that only the bot itself can edit, but cannot be edited by context changes entered in the Web application.
  • Read and write access: The parameters can be used as placeholders in messages (see below) and can also be changed in context updates.

What contexts are there?

Game (read+write)

You can create parameters that only play a role in certain games and can only be used in certain games. For example if you want to count how often someone has triggered a certain intent in that game. Parameters in the game context are non-persistent and public.

Global (read+write)

If you want to use parameters across multiple games, you can save them in a global context. This can be interesting if you want to save whether a user has already used the bot and play out different answers accordingly. The global context is persistent and public.

User (read+write)

Information about the user is stored in the user context. The following is a list of the possible stored values:

General:

  • firstName
  • lastName
  • name (either derived from first and last name, or in case only full name is elicited or first/last distinction is not applicable)
  • gender (fixed format, e.g. m/f/d)
  • birthdate
  • company
  • accountIDfür den Fall, dass die Company per ID mit anderen Systmen synchronisiert werden muss
  • department
  • jobTitle
  • affiliation
  • phone
  • mobilePhone
  • email
  • postcode
  • city
  • country
  • address (either street information or full address, depending on use case)
  • location (geo coordinates)
  • locale
  • language
  • timezone (e.g. as UTC offset)
  • currency

Channel info:

  • facebookId
  • facebookName
  • alexaID
  • whatsAppID
  • webID

Analytics info:

  • firstSeen (datetime)
  • lastSeen (datetime)
  • numberOfMessages
  • campaignID
  • campaignTerm
  • campaignSource

Preference (read)

The preference context only comes into play if you have content objects and the preference game. Here the preferences of the user are stored. These preferences are only changed by the bot in the course of the conversation, but can be used as placeholders in bot texts.

Bookmark (read)

The preference context only comes into play if you have content objects and the bookmark game. Here the bookmarks of the user are stored. These bookmarks are only changed by the bot in the course of the conversation, but can be used as placeholders in bot texts.

Subscription (read)

The subscription context only comes into play if you have subscriptions and the subscription game. Here the subcriptions of the user are stored. These subscriptions are only changed by the bot in the course of the conversation, but can be used as placeholders in bot texts.

Form (read+write)

The information that a user enters into the bot during a form filling is stored in the form context. This can be used to ask users if the bot has understood the correct information (e.g. "Is your phone number ?"; phone number is the label of the form field) or to make other fields dependent on the values of a form field (e.g. only the email address is asked if the applicant can be reached via email).

How to use a context parameter?

There are different ways to use your parameters in the bot.

Create context parameter

You can only create global and game parameters yourself. The other parameters are already predefined.

You can create the global parameters either in the game overview or in one of the generic games. The game parameters only in the corresponding games.

Create context parameter

When you create a parameter, you simply specify a name, a description, the type of the parameter and what initial value you want the parameter to have. This can also be empty.

Context parameter in text

You can present your context parameters in text. For example you want to call the user by his name or like to show him, what he wrote in the form filling. Than you can use this:

Context Placeholder
Game ${[LABEL]}
Global ${global.[LABEL]}
User ${user.[LABEL]}
Preference ${preferences.(soft|hard).[CONTENT TYPE].[SLOT LABEL]}
Bookmark ${bookmarks.[CONTENT TYPE]}
Subscription ${subscriptions.active} und ${subscriptions.invited}
Form ${forms.[GAME NAME].[FORM FIELD LABEL]}

Replacement syntax

Especially in the case of placeholders that stand for values of content object attributes, it might happen that the value is not the representation you want to include in a message. In this case, you can use the following replacement syntax: ${placeholder[value 1: replacement 1, value 2: replacement 2]}. You can use quotes around values and replacements (and you have to do so, when your value or replacement contains a colon, comma, or double quotes).

Values for which no replacement is specified will be displayed as they are. Alternatively, you can include an else clause. If you want to include the actual value in the else clause, you can use <_> as placeholder. See examples below.

Here are some examples:

Das ist ${difficulty[1: ein bisschen, 2: ziemlich, 3: sehr]} schwierig.
Der Planet ist ${category["terrestrial": "erdähnlich", "gas-giant": "ein Gasriese", "ice-giant": "ein Eisriese"]}.
Das Rezept ist ${vegetarian[true: vegetarisch, false: nicht vegetarisch]}.
Der Planet hat ${moons[1: einen Mond, else: mehrere Monde]}.
Der Planet hat ${moons[1: einen Mond, else: <_> Monde]}.

Context parameter in a condition

In the Generic Game different answers can be given to the same question. Which answer is played out can be made dependent on context parameters. These must be at least protected.

Context in Generic

Context and form filling

As mentioned above, you can select context parameters as conditions for form fields.

Context in FormFilling

Context updates

In some cases you may want to change values in the parameters when the user triggers a certain intent. This may be the case if you want to know if a user has already used the bot or if you want to count how often someone has triggered an intent. The context update is done on the bot page. You can only edit parameters in the gerneic and form filling game and that are public.

Context Update

Integration syncs

You can synchronize the information from the context parameters with your crm system through the integrations. To do this, you choose into the integration with your crm system and select the parameters you want to transfer. These will then be synchronized with the crm at the interval you choose.

Integration

Inbox/operator interface & user

In the inbox and in the user overview you can see what values the context parameters of the users have. In the user view you can also filter and sort by specific parameters.

Inbox

Activation/Broadcast

Do you want to send a message to your female users only or to everyone over 25? No problem! Use context parameters as filters to narrow down the recipients of your Activity and Broadcast plans by using them as filters.

Push Filter