I have a Python Lambda function that can respond to both an IoT Button and Alexa skill.
Is there a way to read the event
or context
handed to the handler function to identify which service triggered the function (Alexa or IoT)?
There is no way to reliably accomplish this. The closest you can get is to familiarize yourself with the contents of the various events generated by different services, and (hope to) identify a reliably unique key present in each of the series you are interested in that you can then check for in your code, e.g. with
if 'distinctKey' in event.keys():
# ...
However this is hardly a reliable approach, since it requires that you