Hey there! I am using an API called htmldocs to ge...
# 💻developers
p
Hey there! I am using an API called htmldocs to generate a pdf based on data from the bot. Now I want to provide the user a link, so he can click on it. Unfortunately the variable is not changing at all when I do it from the code cell. The api needs a few seconds to respond and when I do console.log() it logs the url correctly, but it does not save it to my variable. Please help. My code:
Copy code
javascript
const API_KEY_HTMLDOCS = '...'

axios
  .post(
    'https://api.htmldocs.com/v1/api/generate',
    {
      projectId: '...',
      path: 'index.html',
      context: {
        business: 'test'
      }
    },
    {
      headers: {
        'Content-Type': 'application/json',
        Authorization: 'Bearer ' + API_KEY_HTMLDOCS
      }
    }
  )
  .then((response) => {
    console.log(response.data.url)
    workflow.pdf_url = response.data.url
  })
  .catch((error) => {
    console.log(error)
  })