How can I get the raw tx hex from bitcoind with the txid? Is there any way to get the raw tx hex when I know the txid using bitcoind not third party. Currently I'm using a thirdparty (blockcypher) but now I want to switch to bitcoind.
You can enable the transaction index by using setting txindex=1 in your bitcoin.conf file or starting bitcoind with the -txindex option. This option will allow you to use the getrawtransaction command on any transaction in the Bitcoin blockchain or in the node's mempool.

Note that setting this option will require you to reindex bitcoind if it was not already enabled.