To get the pacifist ending, you need to do the following:
- Reach the final fight without killing anyone. You must have earned no EXP at all
- Befriend Papyrus, if you haven't already. To do this, go to his house and complete the "date" with him
- Befriend Undyne by hanging out with her at her house after sparing her. This is only an option if you gave her water after she collapsed in Hotland
- Beat the game once, with the neutral ending (this doesn't have to be in the same run)
Backtrack out of The Core so your phone works. If you have done everything you need to, Undyne will call you and ask you to deliver a letter, starting the quest for the pacifist run.
Deliver the letter, complete the date with Alphys, and explore the true laboratory.
Once you have done this, return to Asgore to begin the final pacifist battle.