Adding scripts into the header`

I am a programmer and want to add Bootstrap to my site. Is there a way to add scripts to the Header of all my pages?


https://support.wix.com/en/article/about-tracking-tools-analytics
https://support.wix.com/en/article/embedding-custom-code-to-your-site

Also see if Wix has their NodeJS already too.
https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager

@givemeawhisky thanks for being helpful as always.
Does that mean that @roi-bendet 's comment at https://www.wix.com/corvid/forum/community-discussion/using-external-javascript is outdated, and it is now possible to import code this way?

What I’m trying to do:
As described here: http://media.twiliocdn.com/sdk/js/chat/releases/3.3.1/docs/
I added the following script to the header:

<script src="https://media.twiliocdn.com/sdk/js/chat/v3.3/twilio-chat.min.js"></script>

Running the following code from the page failed:

Twilio.Chat.Client.create(token).then(client => {
// Use client
});

with ReferenceError: Twilio is not defined

Any ideas? Should this be supported at this point in time? If not, is there any other way to achieve this?

@experimentnoxx
You should be running that code also in tracking & analytics and you will need to wrap it inside a function that waits for the SDK to be downloaded. You can probably do that with DOMContentLoaded or an onload event of the script element itself.

Also, if you are linking to that Twilio document about using NPM, then why not just see if Wix have the Twilio nodeJS in the Wix Package Manager and use that instead.
https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager

Or just use their own API and use it with either Wix Fetch or Wix HTTP Functions.
https://www.twilio.com/docs

https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api

https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
How to Use HTTP Functions to Expose Your Site’s API | Corvid by Wix

Expose site Corvid example.
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient

Wix did it, so you can do too!
https://www.twilio.com/blog/2012/09/wix-simplifying-web-design-and-call-centers-with-twilio.html

Did you mean I should run the create code in the tracking and analytics? How?
I did put the script in the header in tracking and analytics. I tried adding defer to the script, so it should have downloaded. I also added a 10 second delay to give it time to load. None of those helped.

Wix fetch might be doable, but is probably significantly more complex. Thanks for the vote of confidence that I can (easily!) do whatever Wix does :slight_smile:
Wix has a Twilio node.js, but only the backend one. I need to add twilio-chat. In the past they rejected twilio-video because it was for front-end use. But in the mean time they recently enabled npm packages for frontend, so i requested they add twilio-chat…
Please see my reply to Lee above