I'm trying to build a custom Alexa skill that takes 4 values as input, the first 3 of which are required. I have my dialog model fully set up so that Alexa will ask the user for required values until all slots are filled. My problem is that whenever Alexa gets to the last required slot to fill, once the user gives their input, the skill invariably says "Sorry, something went wrong" (physical device) or "There was a problem processing your input" (simulator). When making the first 3 required, it fails after the user gives an answer to the 3rd slot. If I make only 2 required, it fails after the user gives an answer to the 2nd slot. Same thing if only one is required. If all 4 are required, the skill works in the simulator, but not on the physical device. Here's my Intent, in golang:
case "OpenTicketIntent":
log.Println("OpenTicketIntent triggered")
// The request variable here is the IntentRequest object sent to the skill.
if strings.ToUpper(request.DialogState) == "STARTED" {
log.Println("DialogState == STARTED")
// Pre-fill slots: update the intent object with slot values for which
// you have defaults, then return Dialog.Delegate with this updated intent
// in the updatedIntent property.
// myMap := make(map[string]alexa.IntentSlot)
// myMap["Assignee"] = alexa.IntentSlot{
// Name: "assignee",
// Value: "Unassigned",
// ConfirmationStatus: "NONE",
// }
// i := &alexa.Intent{
// Name: "OpenTicketIntent",
// ConfirmationStatus: "NONE",
// Slots: myMap,
// }
response.AddDialogDirective("Dialog.Delegate", nil)
response.ShouldSessionEnd = false
log.Println("DialogState has exited STARTED")
} else if strings.ToUpper(request.DialogState) != "COMPLETED" {
log.Println("DialogState == IN PROGRESS")
// return a Dialog.Delegate directive with no updatedIntent property.
response.ShouldSessionEnd = false
response.AddDialogDirective("Dialog.Delegate", nil)
log.Println("DialogState has exited IN PROGRESS")
} else {
log.Println("DialogState == COMPLETED")
// Dialog is now complete and all required slots should be filled,
// so call your normal intent handler.
ticketType := request.Intent.Slots["TicketType"].Value
project := request.Intent.Slots["Project"].Value
summary := request.Intent.Slots["Summary"].Value
assignee := request.Intent.Slots["Assignee"].Value
response.ShouldSessionEnd = false
log.Printf("Ticket Type is %s, Project is %s, Issue Title is %s, and Assignee is %s
", ticketType, project, summary, assignee)
jiraClient, err := jira.NewClient(nil, "https://imaginovation.atlassian.net/")
if err != nil {
log.Println(err.Error())
response.SetOutputText("There was a problem creating the Jira Client")
log.Printf("Set Output speech, value now: %s", response.OutputSpeech.Text)
}
log.Println("Created Jira Client...")
jiraClient.Authentication.SetBasicAuth("tcheek@imaginovation.net", "Stormlight94")
i := &jira.Issue{
Fields: &jira.IssueFields{
Summary: "Created from JiraBot",
Type: jira.IssueType{
ID: "10000",
},
Project: jira.Project{
Key: "IMJ",
},
Assignee: &jira.User{
Name: "tcheek",
},
},
}
_, jiraResponse, err := jiraClient.Issue.Create(i)
log.Println(jiraResponse.Status)
if jiraResponse.StatusCode == 400 {
buf := new(bytes.Buffer)
buf.ReadFrom(jiraResponse.Body)
jiraResponseStr := buf.String()
log.Println(jiraResponseStr)
}
if err != nil {
log.Println(err.Error())
response.SetOutputText("There was a problem creating the Jira ticket")
log.Printf("Set Output speech, value now: %s", response.OutputSpeech.Text)
}
log.Println("DialogState has exited COMPLETED")
}
The first thing you might think of is that I'm setting response.ShouldSessionEnd to false. But this doesn't change anything, it fails the same way if it's true or false. I am making it false because 3 seconds is sometimes not enough time for the skill to do the things it needs to do after the else statement, and setting this to false gives the skill the 8 seconds that Alexa gives while expecting a response. If there is no response or the skill finishes, the session will end normally.
The second thing you might think of is that there is an error somewhere I'm not looking for. Here's the Cloudwatch output:
The skill goes through the motions of getting each slot value until the 3rd required slot is filled and then quietly stops.
I'm also getting an Internal Service Error when looking at the logs through the simulator.
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "b528b1ac-9809-4c1a-a2ad-bbff68988ce8"
},
"payload": {
"code": "INTERNAL_SERVICE_EXCEPTION",
"description": "Request could not be executed due to an internal service error."
}
}
Why might my skill be failing on the last slot?