0

Trying to send two messages in Chatbase, in same request, like this:

{
    "messages" : [{
            "api_key" : "XXX",
            "type" : "user",
            "user_id" : 1287,
            "time_stamp" : 1544782312,
            "platform" : "Telegram",
            "message" : "",
            "intent" : "Screen2",
            "version" : "1.1"
        }, {
            "api_key" : "XXX",
            "type" : "agent",
            "user_id" : 1287,
            "time_stamp" : 1544782312,
            "platform" : "Telegram",
            "intent" : "Screen2",
            "version" : "1.1"
        }
    ]
}

But get response error

{
    "reason" : "Error fetching parameter 'user_id': Field was empty.",
    "status" : 400
}

Do you have any thoughts what is wrong here?

Artem Reva
  • 13
  • 4
  • 2
    The [spec](https://chatbase.com/documentation/generic) says that `user_id` is a string but you're presenting a number. – Wayne Phipps Dec 14 '18 at 10:40
  • 1
    Another possibility is that you are sending the message to the chatbase.com/api/message endpoint (for individual messages) instead of the chatbase.com/api/messages endpoint (note the s at the end). – Viknesh Dec 14 '18 at 22:17
  • @Viknesh, thank you, that helped me! Spent forever trying to figure out why it wasn't working, after changing the request from the initial one-message format. – i-know-nothing Dec 27 '19 at 19:55

1 Answers1

2

I have found the issue with user_id field.

In the Chatbase API the user_id field accepts string type value and you have passed integer type of value in user_id field.