Here's the fruit of my experience for anyone who might care to listen . . . and might benefit. Amitriptyline is very constipating. Add an opioid to that, and the gut slows way down. The result is constipation and belly pain.
There is a solution. Take an osmotic laxative, as often as needed, to make sure you poop every day. Otherwise you can damage your colon and end up with diverticulitis. (Happened to me.) Stimulant laxatives - like senna - irritate the lining of your gut. They're not the best choice. Osmotic laxatives - like Miralax or milk of magnesia - are the absolute best choice. Taking a dose of either one every day will not harm you. Miralax is great stuff. (The store generic knockoff is cheaper and is exactly the same stuff.). You can even take several doses in one day, if badly blocked up. (This is the same stuff they give you to clean out before getting a colonoscopy.)
The only caveat is this: Don't take any laxative, if your problem could possibly be appendicitis. You'll just get sicker. An X-Ray at the ER can pinpoint the problem for you, if you're not sure.
One more caveat: Don't swallow anything, if you feel very nauseated. Otherwise you might throw up and accidentally inhale your own vomit. That can be life-threatening.
Normal poop is not hard or painful to pass. Anyone who is passing hard poop should be taking an osmotic laxative, as often as needed to maintain soft stools. Doing that faithfully can stave off some really bad problems and the misery that goes with them.