wbb-jadu
v0.0.9
Published
With this integration you can authenticate users, and raise tickets in Jadu with highly customisable fields.
Downloads
4
Readme
Jadu
With this integration you can create tickets in a designated Jadu
workspace.
Blocks Provided
| Block Name | Purpose | | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Jadu fetch fields | This block fetches and displays all valid fields for a given endpoint | | Jadu Create Ticket | This block will ask any necessary questions, and once complete send the data to the APIs to create the ticket. Parameters, explained below, allow you to determine what happens next. | | Jadu authenticate | This block matches a users email and uk phone number to a person in Jadu |
Handler Names
The following handler names and their functions are available :
| Handler Name | Purpose |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| jadu-fields | Fetches valid fields for the endpoint supplied |
| jadu-create-ticket | Raises new ticket using any valid params for the designated case |
| jadu-authenticate | Authenticates user based on email and ukPhoneNumber. The matching persons id is set as a variable wbb-jadu-person-id
|
Configuration Options
Within the function there are a number of options that can be set to configure the behaviour of the integration. The tables below show the settings that are available for each handler.
jadu-fields
| Property | Required | Description |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------ |
| endpoint | true | The endpoint to fetch and display the valid fields of. This should be the same as is used in for creating tickets. |
| successBlock | false | The id of the block to display next, defaults to the menu
block. |
| failureBlock | false | The id of the block to display if the function fails, defaults to webhook-fail
|
jadu-authenticate
| Property | Required | Description |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| endpoint | true | The endpoint to fetch person from. |
| confirmUser | false | Prompts user to confirm piece of address information to continue if set to true |
| confirmUserMessage | false | Overrides default confirm message, can include template to display fields from the users primary address, defaults to Is %%street%% the street you current live at?
|
| confirmFailBlock | false | The id of the block to dispaly if the user says no to the confirm message |
| successBlock | false | The id of the block to display next, defaults to the jadu-create-ticket
block. |
| failureBlock | false | The id of the block to display if the function fails due to missing args, defaults to webhook-fail
. |
| authFailBlock | false | The id of the block to display if the found users phone number doesn't match the users input, defaults to data-error
|
| noUserBlock | false | The id of the block to display if no user is found, or if the api call somehow fails otherwise. Defaults to the error message supplied by jadu api |
| unset | false | Unsets the forms used, if set to true |
jadu-create-ticket
| Property | Required | Description |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| endpoint | true | The endpoint used to raise the ticket. This should include any parameters that does not go into the body of the request |
| unset | false | Unsets the forms used, if set to true |
| successMessage | false | The message you want the bot to display when ticket has been successfully raised. This can include template values, such as %%id%%, which will be filled out dynamically for the user. |
| successBlock | false | The id of the block to display next, defaults to the menu
block. This will override the successMessage
field, and it will not be displayed |
| failureBlock | false | The id of the block to display if the function fails, defaults to webhook-fail
|
| jadu specific fields | false | This is a stand-in for any fields specific to your jadu ticket. These can be either static or use dynamic templates, following the instructions below. Invalid fields are filtered dynamically. A list of valid fields can be fetched through the jadu-fields
handler. |
Templates
Using template strings
, the successMessage
and jadu specific fields
can be set dynamically, using forms, variables, and other integrations (for example, Singlepoint
, to get a users uprn).
To mark an argument as a template, surround the value with %%
, for example "postcode": "%%postcode%%"
, this will replace the value with the value of a field named postcode
.
The fields available depend on any forms used for the function, variables set during the conversation, and the information gathered from the user. Syntax may also vary, if using other integrations, so be sure to check documentation for these.
successMessage
can also make use of fields found in the response to the new ticket request, for example %%id%%
.
### Example config and response
The below is an example of a config, using both static and template values, note that the fields may not be valid for your case.
{
"endpoint": "https://youruat.api.q.jadu.net/api/service-api/case/create-ticket?key=your-api-key-here",
"order-type": "bins",
"order-details": "%%orderDetails%%",
"user-last-name": "%%lastName%%",
"user-email-address": "%%email%%",
"user-telephone-number": "%%ukPhoneNumber%%",
"channel": "Chatbot",
"uprn": "%%wbb-singlepoint-uprn%%",
"successMessage": "Thanks, I have raised a ticket for you, your ticket id is: %%id%%, use it if you have any further inquiries.",
}
Assuming no invalid fields, the above config would send a request to the endpoint https://youruat.api.q.jadu.net/api/service-api/case/create-ticket?key=your-api-key-here
with a body similar to this:
{
"order-type": "bins",
"order-details": "Recycling bins",
"user-last-name": "Smith",
"user-email-address": "[email protected]",
"user-telephone-number": "07777777777",
"channel": "Chatbot",
"uprn": "12345678910"
}
Then the bot would respond, Thanks, I have raised a ticket for you, your ticket id is: 12345, use it if you have any further inquiries.
, and proceed to the menu
block.