You can use the API provided by
UndauntedDaily.
Lua Code:
local dungeons = UndauntedDaily.GetPledgeDungeons() -- optionally pass an offset to get other days than today
"dungeons" contains 3 dungeon objects for Maj al-Ragath, Gilirion and Urgalarg respectively which give you the name and activityId for it:
Lua Code:
local majDungeon = dungeons[1]
local name = majDungeon:GetName()
local normalActivityId = majDungeon:GetNormalId()
local vetActivityId = majDungeon:GetVeteranId()