I'm having a bit of trouble sending MQTT messages in an Alexa skill. It is a custom skill hosted by Alexa and the back end is written in python. I need to be able to communicate via mqtt with a device that has already been registered on aws, the device in question publishes and receives (tested on aws) and now I should be able to interact with my alexa skill.
client = boto3.client('iot-data',region_name='eu-west-1')
response = client.publish(
topic='esp32/sub',
payload=json.dumps({"message":"on"})
)
this is the code i used and it should post the message but looking at the logger (through cloudwatch) i have this error:
[ERROR] 2023-06-04T08:53:16.221Z 0f58e1f8-aee8-43bf-a10c-d237592577d6 An error occurred (ForbiddenException) when calling the Publish operation: None
I honestly don't know where to look, other users have also had a similar problem but the conversations are dated and I can't implement the proposed solutions. For example text or text where users suggest to attach a policy to the lambda function, but there are no "buttons" in the amazon developer console that allow me to do this