https://discord.gg/botpress logo
#🤝help
adding bot press to Wordpress
# 🤝help
h

high-advantage-93953

07/24/2023, 7:45 AM
Hi All, I have copied the pre-configured code and added it to my Wordpress site within head tags (I’ve also tried body tags too), but when I then update my site and view the page it just shows the link to the bot. How do I get it to show the chat icon instead?
f

freezing-printer-49373

07/24/2023, 2:43 PM
you want to use the script in this section of your bot or this one (pre-configured, configurable)

https://cdn.discordapp.com/attachments/1132941707336503296/1133046917622927461/Screenshot_2023-07-24_at_10.43.19_AM.png

https://cdn.discordapp.com/attachments/1132941707336503296/1133046917891375216/Screenshot_2023-07-24_at_10.43.40_AM.png

a

adventurous-glass-22349

07/24/2023, 4:11 PM
Take a very close look as the icon is tiny. Mine was hidden by the page footer as the same colour
h

high-advantage-93953

07/25/2023, 6:41 AM
Hey @freezing-printer-49373 I have used the pre-configured one and I’ve tried adding it into the body and the head parts of the site but still just shows the link and not the icon?
@adventurous-glass-22349 The page is white, so I don’t think it’s that?
r

rich-oxygen-43707

07/25/2023, 6:46 AM
Are you able to share a URL where this is installed?
h

high-advantage-93953

07/25/2023, 6:58 AM
@rich-oxygen-43707 This is one that I’ve setup for testing it, so ignore the text but you’ll see there is links to the actual bot but no icon https://cgai4.wordpress.com/about/
r

rich-oxygen-43707

07/25/2023, 7:07 AM
How did you include the scripts in your page? Looking at the source that is rendered, obviously, I just see the links. I don't see the <script src= etc that is shown in @freezing-printer-49373 's image above. Can you show a screen snip of where and how you included the scripts?

https://cdn.discordapp.com/attachments/1132941707336503296/1133294458880925796/image.png

h

high-advantage-93953

07/25/2023, 7:10 AM
So yeah I just noticed that too. What I did was copied the script src from my botpress and inserted it inside of a body tag (like I said I have also tried it inside a head tag too), but looks like it’s been changed to an ahref instead (not done by me) so obviously I’m doing something wrong so how can I stop that from happening?
Can you confirm the tag where I should be inserting this? And also does it matter where in the code I put it? (Sorry not an HTML expert or novice even for that matter 😂)
r

rich-oxygen-43707

07/25/2023, 7:15 AM
well, if your theme gives you a way to add scripts it might look like this.

https://cdn.discordapp.com/attachments/1132941707336503296/1133296501423095878/image.png

ANother option is to put something like this in functions.php function enqueue_custom_scripts() { // Enqueue the first script wp_enqueue_script( 'botpress-inject', 'https://cdn.botpress.cloud/webchat/v0/inject.js', array(), '1.0', true ); // Enqueue the second script with the "defer" attribute wp_enqueue_script( 'botpress-config', 'https://mediafiles.botpress.cloud/9223b195-3517-489e-b0cc-0bb9c7f72749/webchat/config.js', array(), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'enqueue_custom_scripts' );
h

high-advantage-93953

07/25/2023, 7:20 AM
Can I do this on the free plan? If so, how do I find them? I’ve gone to customise my theme but can’t find how to add scripts to it? Also I’ve been looking at updating functions.php, but again I can’t find that either
r

rich-oxygen-43707

07/25/2023, 7:25 AM
I have never used wordpress.com, I have dozens of sites self-hosted with WordPress. So I'm not sure what all of the restrictions are, what they let you do or what you can't do. Sorry. But I would think that if you have a theme that gives you a place to add scripts, it would work. You may also be able to just copy the code into an HTML block. Maybe add an HTML block in your footer and add the code and see if it works. Just make sure you are copying exactly like this, don't try to go get the contents of those js files.

https://cdn.discordapp.com/attachments/1132941707336503296/1133298946408722512/image.png

I have to go to bed, hopefully this was at least a little helpful.
h

high-advantage-93953

07/25/2023, 7:30 AM
No problem! I appreciate all your help
a

adventurous-glass-22349

07/25/2023, 4:47 PM
Hey I just added an html block to a Wordpress page and dropped the default botpress script it gives you into that and all works fine BUT mine is self hosted Wordpress not Wordpress.com. Does Wordpress.com allow you to run external scripts??? You may want to ask them as not sure you can run this on their platforms…
h

high-advantage-93953

07/25/2023, 7:13 PM
Hey, thanks for that. I’ve tried that but for some reason Wordpress seems to add tags. Any ideas?
r

rich-oxygen-43707

07/25/2023, 7:16 PM
Can you share a screen print showing clearly what you are pasting and where?