Add custom header to JovoWebClient


#1

Hi. I’m trying to add a custom header to an instance of JovoWebClient. The use case is that the client app is authenticated and I’m trying to share its access_token with the Jovo app, so the chatbot can also make requests through the Jovo handlers on behalf of the user.


#2

Hey! You can pass headers in the send-method.

In the client:

await this.$client.createRequest({ type: RequestType.Launch }).send({
  headers: {
      'access_token': 'foobar'
   }
});

In the app:

 LAUNCH() {
    const accessToken = this.$host.headers['access_token'];
    // ...
  },


#3

Thanks, @AlexSwe. You’re correct. This works.