build interaction code