You want to use the Lightning Notifications Library. This has the capability to show toasts or notifications.
You can reference the documentation and examples here
Here is a basic example shown from documenation:
<aura:component>
<lightning:notificationsLibrary aura:id="notifLib"/>
<lightning:button name="notice" label="Show Notice" onclick="{!c.handleShowNotice}"/>
</aura:component>
({
handleShowNotice : function(component, event, helper) {
component.find('notifLib').showNotice({
"variant": "error",
"header": "Something has gone wrong!",
"message": "Unfortunately, there was a problem updating the record.",
closeCallback: function() {
alert('You closed the alert!');
}
});
}
})
And here is how you can show a toast
<aura:component>
<lightning:notificationsLibrary aura:id="notifLib"/>
<lightning:button name="toast" label="Show Toast" onclick="{!c.handleShowToast}"/>
</aura:component>
({
handleShowToast : function(component, event, helper) {
component.find('notifLib').showToast({
"title": "Success!",
"message": "The record has been updated successfully."
});
}
})
With the notification library, you have a much more robust system in place to show various messages to your user as it has tons of flexibility and options.