1. Webchat
  2. Webchat Notification Parameters

Webchat

Webchat Notification Parameters

Basic payload

  • To send a payload you need to know the webchat client sessionuuid
  • You may send any combination of message and client configuration in a single payload
        {
  "message_out_webchat": {
    "platforms": {
      "webchat": {
        "sessionuuid": "~~stub.data.heimdall.webchat.sessionuuid",
      }
    }
  }
}

      

Sending a message

To send a message add webchat_message to the webchat object

webchat_agent is optional (Default : 'Agent')

webchat_message.type ( text / markdown / html )

        {
  "webchat": {
    "sessionuuid": "~~stub.data.heimdall.webchat.sessionuuid",
    "webchat_message": {
      "type": "markdown",
      "value": "Your message was received by stubber. This is an example of a reply"
    }
  }
}

      

Sending a message with custom agent name

Add webchat_agent to the webchat object

webchat_agent is optional (Default : 'Agent')

        {
  "webchat": {
    "sessionuuid": "~~stub.data.heimdall.webchat.sessionuuid",
    "webchat_agent": {
      "name": "AI assistant"
    },
    "webchat_message": {
      "type": "markdown",
      "value": "Your message was received by stubber. This is an example of a reply"
    }
  }
}

      

Sending a form

form_name is used as a unique identifier

        {
  "webchat": {
    "sessionuuid": "~~stub.data.heimdall.webchat.sessionuuid",
    "webchat_agent": {
      "name": "AI assistant"
    },
    "webchat_message": {
      "type": "form",
      "value": {
        "form_name": "email_form",
        "spec": {
          "fields": {
            "email": {
              "fieldtype": "email"
            },
          },
        },
      }
    }
  }
}

      

Sending client settings

To update client settings add webchat_client_configuration to the webchat object

        {
  "webchat": {
    "sessionuuid": "~~stub.data.heimdall.webchat.sessionuuid",
    "webchat_client_configuration": {
      "setting_one": {
        "type": "default_country_code",
        "value": "ZA"
      }
      // you may add multiple setting objects in one payload
    }
  }
}

      

Available settings :

default country code

Sets the default country code for any fields requiring country specific entries

        {
  "setting_one": {
    "type": "default_country_code",
    "value": "ZA"
  }
}

      

switching

Enables users to switch between different communication platforms, providing the option to continue conversations on alternative channels directly from the webchat.

        
"channel_switching": {
  "type": "switching",
  "value": {
    "whatsapp": true,
    "sms": false,
    "email": true
  }
},

      

switching return

When a user selects a platform and submits their details the following payload will be sent to the stub

        "_incoming_webchat_data": {
  "sessionuuid": "136b6023-44f3-48d5-aaa5-5e8024e055fd",
  "webchat_client_configuration": {
    "platform_switch": {
      "platform_name": "whatsapp", // this can be sms or email
      "type": "mobile",
      "value": "+18005550100"
    }
  }
}

      

file upload

Allow file uploading with messages.

        {
  "setting_one": {
    "type": "files",
    "value": {
      "enable": true
    }
  }
}

      

voice notes

Allow user to send voice notes instead of messages

        {
  "setting_one": {
    "type": "voicenote",
    "value": {
      "enable": true
    },
  }
}

      

Receiving payloads from webchat client via heimdall

On webchat Open

When a user opens up the chat window an event is emitted on the following Heimdall path:

stubber.systems.notifications.webchat.org.{{orguuid}}.name.{{chatname}}.webchatmessagetype.initialize

Any Stub registered on this path will receive the following payload:

Initial Payload
        "heimdall": {
  "webchat": {
    "sessionuuid": "23532740-07df-4628-af83-43db12c8f4ad",
    "webchat_configuration": {
      "orguuid": "96305d53-2fb0-512d-9d59-3f2b03aa679a",
      "chatname": "documentationexample",
      "passthroughData": "{'some':'data'}"
    }
  }
}

      

The purpose of this message is to allow the stub to get the session uuid of the new user. You may also use the session uuid to send a message before the user responds.

On user message

When a user sends a message an event is emitted on the following Heimdall path:

stubber.systems.notifications.webchat.org.{{orguuid}}.name.{{chatname}}.sessionuuid.{{sessionuuid}}.webchatmessagetype.message

Any Stub registered on this path will receive the following payload:

Client message payload
        "heimdall": {
  "webchat": {
    "sessionuuid": "23532740-07df-4628-af83-43db12c8f4ad",
    "webchat_message": {
      "type": "text",
      "value": "user message"
    },
    "webchat_configuration": {
      "orguuid": "96305d53-2fb0-512d-9d59-3f2b03aa679a",
      "chatname": "documentationexample",
      "passthroughData": "{'some':'data'}"
    }
  }
}

      

On configuration submit

When a user submits data into a field an event is emitted on the following Heimdall path:

stubber.systems.notifications.webchat.org.{{orguuid}}.name.{{chatname}}.sessionuuid.{{sessionuuid}}.sessionuuid.{{sessionuuid}}.webchatmessagetype.configuration

Any Stub registered on this path will receive the following payload:

Client configuration payload
        "heimdall": {
  "webchat": {
    "sessionuuid": "23532740-07df-4628-af83-43db12c8f4ad",
    "webchat_client_configuration": {
      "platform_switch": {
        "platform_name": "whatsapp",
        "type": "mobile",
        "value": "+18005550100"
      }
    },
    "webchat_configuration": {
      "orguuid": "96305d53-2fb0-512d-9d59-3f2b03aa679a",
      "chatname": "documentationexample",
      "passthroughData": "{'some':'data'}"
    }
  }
}