Let's start from scratch. Take the positions eigenvectors, $\left|x\right>$. They are such that $X\left|x\right> = x\left|x\right>$. Now, take a general ket for a wavefunction, $\left|\psi\right>$. If we want to know $\psi(x)$, that is, the wavefunction in the position representation, then we take the following scalar product : $\left<x\right|\left|\psi\right> = \psi(x)$. Indeed, this is true since the position representation of $\left|x\right>$ is $\delta(x)$ (I can show this if need be). From this is also follows that $\int\left|x\right>\left<x\right|dx = I$ where I is the identity (called the completeness relation).
So, let's get back to the question. Analogously, we have that $\psi(p) = \left<p\right|\left|\psi\right> =\int \left<p\right|\left|x\right>\left<x\right|\left|\psi\right>dx$ using the completeness relation. All we have to do now, is determine $\left<p\right|\left|x\right>$. This is done by the defining equation of $\left|p\right>$ which simply is $P\left|p\right> = p\left|p\right>$.
Taking the scalar product with $\left<x\right|$ and using the positiong representation of $P = -i\hbar\nabla$ we get the following equation :
$ -i\hbar\frac{d p(x)}{d x} = pp(x)$$$ -i\hbar\frac{d p(x)}{d x} = pp(x)$$
Where $p(x) = \left<x\right|\left|p\right>$
Solving this equation you find $p(x) = Ae^{ip/\hbar x}$
Finally, using the hermiticity properties of the scalar product and plugging back in our initial integral we get :
$\psi(p) = \int Ae^{-ip/\hbar x}\psi(x)$$$\psi(p) = \int Ae^{-ip/\hbar x}\psi(x)$$
The constant A$A$ is taken to be $\frac{1}{\sqrt{2\pi\hbar}}$ arbitrarily to get the usual form of the fourierFourier transform. This is because since the position representation of the $p$ eigenvectors cannot be normalised, this constant A$A$ is arbitrary.