x-user-key
header yourself. Check out the Authentication section for more information.
https://chat.botpress.cloud/$YOUR_WEBHOOK_ID/hello
.
createUser
operation.
createConversation
operation. You will need to provide a user key to authenticate yourself.
createMessage
operation. You will need to provide:
{ "type": "text", "text": "hello bot" }
.listMessages
operation. You will need to provide:
x-user-key
header. There are two ways to get this user key:
createUser
operation and get the key in the response’s body. This operation is the only one that isn’t authenticated.x-user-key
header is a JWT. Here’s how to sign it using the jsonwebtoken NodeJS library:
x-user-key
JWT header. If the signature is invalid, the request will be rejected with an unauthorized status code.
By manually signing your requests, you ensure that nobody except you can chat with your bot over the Chat API.
createUser
will result in an error response. When needed, call getOrCreateUser instead.listenConversation
operation. This operation will open an SSE stream that you can listen to.