0.0.9 • Published 1 year ago

wbb-jadu v0.0.9

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Jadu

With this integration you can create tickets in a designated Jadu workspace.

Blocks Provided

Block NamePurpose
Jadu fetch fieldsThis block fetches and displays all valid fields for a given endpoint
Jadu Create TicketThis 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 authenticateThis 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 NamePurpose
jadu-fieldsFetches valid fields for the endpoint supplied
jadu-create-ticketRaises new ticket using any valid params for the designated case
jadu-authenticateAuthenticates 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

PropertyRequiredDescription
endpointtrueThe endpoint to fetch and display the valid fields of. This should be the same as is used in for creating tickets.
successBlockfalseThe id of the block to display next, defaults to the menu block.
failureBlockfalseThe id of the block to display if the function fails, defaults to webhook-fail

jadu-authenticate

PropertyRequiredDescription
endpointtrueThe endpoint to fetch person from.
confirmUserfalsePrompts user to confirm piece of address information to continue if set to true
confirmUserMessagefalseOverrides default confirm message, can include template to display fields from the users primary address, defaults to Is %%street%% the street you current live at?
confirmFailBlockfalseThe id of the block to dispaly if the user says no to the confirm message
successBlockfalseThe id of the block to display next, defaults to the jadu-create-ticket block.
failureBlockfalseThe id of the block to display if the function fails due to missing args, defaults to webhook-fail.
authFailBlockfalseThe id of the block to display if the found users phone number doesn't match the users input, defaults to data-error
noUserBlockfalseThe 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
unsetfalseUnsets the forms used, if set to true

jadu-create-ticket

PropertyRequiredDescription
endpointtrueThe endpoint used to raise the ticket. This should include any parameters that does not go into the body of the request
unsetfalseUnsets the forms used, if set to true
successMessagefalseThe 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.
successBlockfalseThe id of the block to display next, defaults to the menu block. This will override the successMessage field, and it will not be displayed
failureBlockfalseThe id of the block to display if the function fails, defaults to webhook-fail
jadu specific fieldsfalseThis 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": "example@email.com",
    "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.