Legacy Dev Forum Posts

 View Only

Sign Up

Callback DataAction - Callback Number is required

  • 1.  Callback DataAction - Callback Number is required

    Posted 06-05-2025 18:44

    alex7 | 2023-10-17 18:36:49 UTC | #1

    I'm trying to create a DataAction to create a callback. I followed a Request Template I saw on this forum, and modified it to handle an agent owned callback.

    { "requestUrlTemplate": "/api/v2/conversations/callbacks", "requestType": "POST", "headers": {}, "requestTemplate": "{\"routingData\": {\"queueId\": \"${input.queueId}\", \"scoredAgents\": [\"agent\":{\"id\":\"${input.agentId}\"},\"score\": ${input.score}}],\"routingFlags\":[\"${input.routingFlag}\"]},\"callbackNumbers\":[\"${input.callbackNumbers}\"]}"}

    When I do a test, I have all of the input parameters filled, but I get back an error: "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\"message\":\"callbackNumbers is required\",\"code\":\"callback.error.missing.callback.numbers\"

    But I am sending the callback number.

    Since I can't see what is the actual JSON request being sent to the API, is there a way for me to troubleshoot this?

    Does anyone see anything blatantly incorrect?

    EDIT: I noticed the escape characters are removed when I post. But know that the escape characters are before every double-quote within the requestTemplate value.


    zubair | 2023-10-17 19:58:56 UTC | #2

    I see some syntax and schema errors in the requestTemplate. for example

    alex7, post:1, topic:22592
    ${input.score}

    Missing quotes

    alex7, post:1, topic:22592
    "scoredAgents": ["

    Missing curly bracket after [

    Happy to assist further if you can provide screenshot of Request Body Template under Configuration. Or attach the complete export of your Data Action.

    Note: Redact/Remove any sensitive data before you upload anything.


    alex7 | 2023-10-17 20:21:04 UTC | #3

    I'm still getting the same error. I put the quotes around $(input.score} however, I omitted them originally because it is an integer value, not a string.

    I added the curly bracket within the scoredAgents array (good catch). But the error persists...


    zubair | 2023-10-17 21:49:46 UTC | #4

    Have you copied the complete JSON within the Request Body Template? This is only done if you change the Action Configuration from Simple to JSON (which is at the top under Configuration tab).

    Anyways, under configuration tab, check to confirm your configuration looks like

    and copy the following inside Request Body Template. make sure score is configured as Integer under Input Contracts (yes in that case don't need quotes)

    {
      "routingData": {
        "queueId": "${input.queueId}",
        "scoredAgents": [{
          "agent":{
            "id":"${input.agentId}"
          },
            "score": ${input.score}
        }],
        "routingFlags":["${input.routingFlag}"],
        "callbackNumbers":["${input.callbackNumbers}"]
        }
      }

    See how you go


    alex7 | 2023-10-18 09:40:49 UTC | #5

    My screen doesn't look the same.


    alex7 | 2023-10-18 09:52:35 UTC | #6

    Also, just FYI... I have tested this in the API Explorer with the same parameters and it works fine.


    alex7 | 2023-10-18 11:00:35 UTC | #7

    I got it to work, but I'm not exactly sure why it works now.

    Steps:

    1. Rebuild the Data Action (still failed with same error)
    2. Take the API Explorer JSON request which works and put that into the Request Template, escaping the double-quotes, and all values are hardcoded. It worked.
    3. Gradually replaced hard-coded values, one at a time, with ${input.xxxxx}, and each time it continued to work
    4. I decided to leave the routing flag and score hardcoded because for the purpose of this Data Action, it will always be those values.

    EDIT: I also just now noticed in my reply above, when I showed the JSON of the request template, "requestTemplate" was included in the string value of the requestTemplate. I'm not sure how that got there when the "Simple" version did not show that. So that is likely the cause of the problem since the JSON is in a different structure and it couldn't find the callbackNumbers node.


    zubair | 2023-10-18 17:53:56 UTC | #8

    Yea as I said earlier the Request Body Template wasn't looking right to me. Glad that its sorted now. Cheers


    system | 2023-11-18 17:53:57 UTC | #9

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 22592