Whilst I'm unskilled with hooking into tooltips, you'll want to look at the code in the Blizzard_ArtifactUI.
The following will print your spellID (and details).
Code:
hooksecurefunc(GameTooltip, "SetArtifactPowerByID", function(self, id)
-- Note: id == artifact power id
-- Return args for C_ArtifactUI.GetPowerInfo(id):
-- spellID, upgradeCost, curRank, maxRank, bonusRank, xpos, ypos, prereqsMet, isStart, isGoldMedal, isFinal
spellid = C_ArtifactUI.GetPowerInfo(id)
print(spellid, GetSpellInfo(spellid))
end)
You should be able to continue on from there.