Broadcast google home with smartthing multipurpose sensor opened

Hi,
I wonder how people can play music through google home speaker when the door is opened, or makes google home say specific phase or words.