  Using APEX-1 and APEX-2 observations, we have detected and studied the
rotational lines of the HC$_3$N molecule (cyanoacetylene) in the powerful
outflow/hot molecular core G331.512-0.103. We identified thirty-one rotational
lines at $J$ levels between 24 and 39; seventeen of them in the ground
vibrational state $v$=0 (9 lines corresponding to the main C isotopologue and 8
lines corresponding to the $^{13}$C isotopologues), and fourteen in the lowest
vibrationally excited state $v_7$=1. Using LTE-based population diagrams for
the beam-diluted $v$=0 transitions, we determined $T_{\rm exc}$=85$\pm$4 K and
$N$(HC$_3$N)=(6.9$\pm$0.8)$\times$10$^{14}$ cm$^{-2}$, while for the
beam-diluted $v_7$=1 transitions we obtained $T_{\rm exc}$=89$\pm$10 K and
$N$(HC$_3$N)=2$\pm$1$\times$10$^{15}$ cm$^{-2}$. Non-LTE calculations using
H$_2$ collision rates indicate that the HC$_3$N emission is in good agreement
with LTE-based results. From the non-LTE method we estimated $T_{\rm kin}$
$\simeq$90~K, $n$(H$_2$)$\simeq$2$\times$10$^7$~cm$^{-3}$ for a central core of
6 arcsec in size. A vibrational temperature in the range from 130~K to 145~K
was also determined, values which are very likely lower limits. Our results
suggest that rotational transitions are thermalized, while IR radiative pumping
processes are probably more efficient than collisions in exciting the molecule
to the vibrationally excited state $v_7$=1. Abundance ratios derived under LTE
conditions for the $^{13}$C isotopologues suggest that the main formation
pathway of HC$_3$N is ${\rm C}_2{\rm H}_2 + {\rm CN} \rightarrow {\rm HC}_3{\rm
N} + {\rm H}$.
