# Amazon SMS text message sending

**URL:** <https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717>\
**Category:** General\
**Created:** [22 August 2023 15:54 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717 "2023-08-22T15:54:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![holmesjohnnyh](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@holmesjohnnyh](https://discourse.nodered.org/u/holmesjohnnyh)\
**Post date:** [22 August 2023 15:54 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/1 "2023-08-22T15:54:31Z")

</div>

Currently I use a simple python script to send an sms message to my mobile from my amazon aws account. I would like to be able to do this with either a dedicated node or a function node. I am not really sure how to go about this. The main reason is to send a heart beat every day at a set time.

```auto
import os
import boto3

client= boto3.client("sns", aws_access_key_id=" *********************", aws_secret_access_key="**********************", region_name="eu-west-1")
client.publish(PhoneNumber=" **************", Message="The Raspberry Pi Is Working")

```

Any ideas much appreciated.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 August 2023 16:07 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/2 "2023-08-22T16:07:56Z")

</div>

You should be able to run the python script from an Exec node. Put in the full path to the python executable and to your script file. Use forward slashes in paths even if using Windows.

---

<div class="post-metadata">

**Author:** ![holmesjohnnyh](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@holmesjohnnyh](https://discourse.nodered.org/u/holmesjohnnyh)\
**Post date:** [22 August 2023 16:33 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/3 "2023-08-22T16:33:23Z")

</div>

So in the command i have added `sudo python3 /home/johnmholmes/Text.py ` and added a trigger node but I see error 1 when I try to trigger it. Not sure about the executable.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 August 2023 16:42 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/4 "2023-08-22T16:42:59Z")

</div>

Why have you used sudo? You will need to do some additional stuff if it needs sudo.

Use `which python` to find the path to python. Possibly /usr/bin/python.

When you get an error in the exec node add debug nodes to all outputs, set them to Output Complete Message (that is important) and check all the contents of the messages. Somewhere there will probably be an error message.

---

<div class="post-metadata">

**Author:** ![holmesjohnnyh](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@holmesjohnnyh](https://discourse.nodered.org/u/holmesjohnnyh)\
**Post date:** [22 August 2023 17:12 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/5 "2023-08-22T17:12:05Z")

</div>

Sorry Colin I have been trying different things to see if I could get it to work.

changed it and its now working so thanks for the help.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [22 August 2023 17:41 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/6 "2023-08-22T17:41:36Z")

</div>

It is possible to store your python code within Node-red, which perhaps helps keep your Node-red system less cluttered up with external scripts.  
Here is an [example](https://discourse.nodered.org/t/how-to-mport-a-python-script/76626/4)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [5 September 2023 17:41 UTC](https://discourse.nodered.org/t/amazon-sms-text-message-sending/80717/7 "2023-09-05T17:41:40Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
