401 Unauthorized Invalid Access Token

I am trying to integrate webhook into our system. While trying out the webhook API I tried the following curl

curl --location --request POST 'https://bots.kore.ai/chatbot/hooks/st-cef991dd-d4a8-510e-9791-3842510d29d5' \
--header 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6ImNzLWZiYjc2M2QyLWViNWMtNWM4Ny1iNzI2LTBlNWFkMTg5NjQzMyIsInN1YiI6ImtvcmVzdXBwb3J0QGtvcmUuY29tIn0.P-FHhlAVQza6nnti8h9DP4MFD29-HKYH-_mhlp5LLtI' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": {
        "text": "hello"
    },
    "from": {
        "id": "uuid123"
    },
    "to": {
        "id": "uuid345"
    }
}'

I receive invalid access token in response to the same.
There are ways to create a valid jwt token described on the platform Screenshot 2021-06-18 at 4.03.47 PM Screenshot 2021-06-18 at 4.03.57 PM. Have tried using both of the methods but the jwt token created doesn’t seem to work. I ensured that I was signing them with the correct client secret.

Can someone from the team please confirm which of them is the correct method. Or if incase there is an issue with configuring can you please point out or provide some help?

@nayan.teja

I have decrypted the jwt from the cURL you have sent. Payload wise it looks ok. Please check if you have signed it with the secret. And you will need to have the channel published.

If you have done both, please add koresupport@kore.com as a user in your admin console and then invite us on the bot.

To help you, here is a working webhook. Try to have the same “email/ any id” which you used in ‘sub’ of the JWT in “from” below. And keep bot-id in “to”. Ignore, customEmailId it is just “custom data” and is optional.

curl --location --request POST 'https://bots.kore.ai/chatbot/hooks/st-59d03560-8722-5a69-b4c6-0904a0cde8a1' \

–header ‘Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJrb3Jlc3VwcG9ydEBrb3JlLmNvbSIsImFwcElkIjoiY3MtZTJlMzA0NDEtN2M5NC01NTNiLTlkOTctNjY2ZDQxNTFjNDBhIn0.-8-haiFoGLVJ3jMZy7vJm4WAb5mNDHH_z7B21BGNUpA’ \

–header ‘Content-Type: application/json’ \

–data-raw '{

    "session" :{            

        "new" : true

    },

    "message":{

        "text" : "Hello"

    },

    "from" :{

        "id": "a@b.com"

    },

    "to" :{

        "id": "st-59d03560-8722-5a69-b4c6-0904a0cde8a1"

    },

    "customEmailId" : "zeetv@btv.com"

}