Are you really using the Adafruit sensor? https://www.adafruit.com/product/2809
#include <Adafruit_LIS3DH.h>
#include <Adafruit_Sensor.h>
She, Lady ADA/Adafruit always make example code that go with their hardware sensors... start there.
The web also has a bunch of projects that use various sensors within a box to sound alarms or shock or bump when "knocked" or moved. Good reference.
You will need a "driver", either made or purchased, to control the solenoid and the circuit must handle the current and provide a "flyback diode" to protect the electronics. You need to 1) identify the solenoid, 2) obtain the reference sheet, 3) find a relay (physical or solidstate) to handle the relay power; you can alternately find a circuit using a FET or MosFET on the Internet and build that.
Here are just a few examples of knock/knock:
https://forum.arduino.cc/t/knock-knock-box/555253/2