# How to include Device Name (Not just Device ID) in SMS when using Messaging Cloud API (Twilio)

**URL:** <https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038>\
**Category:** Cloud\
**Created:** [September 15, 2017, 5:21am UTC](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038 "2017-09-15T05:21:05Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![oraclerouter](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/oraclerouter/32/30494_2.png) [@oraclerouter](https://community.particle.io/u/oraclerouter)\
**Post date:** [April 13, 2020, 1:27pm UTC](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038/21 "2020-04-13T13:27:06Z")

</div>

Sorry, I should have explained.  
I’m saving anything to EPROM. Here is the where that is used

```auto
char dev_name[32];
String deviceName;

```

```auto
void loop{
alertPowerSms = String::format("{\"Name\": \"%s\", \"To\": \"%s\"}", deviceName.c_str(), setPhoneString.c_str());
}

```

I did try 10 seconds the most but I will try to extend that even further. Its just odd that it will work right away if I do a hard shutdown.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [April 13, 2020, 5:12pm UTC](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038/22 "2020-04-13T17:12:07Z")

</div>

How would you try to write a `String` to EEPROM?  
You cannot use `EEPROM.put()` with `String`.

And instead of having an intermediate `deviceName` why not directly use `dev_name`?

Like this

```cpp
char dev_name[32];
char phone_str[32];
char alertPowerSms[128];
...
  snprintf(alertPowerSms, sizeof(alertPowerSms)
          , "{\"Name\": \"%s\", \"To\": \"%s\"}"
          , dev_name
          , phone_str
          );

```

---

<div class="post-metadata">

**Author:** ![oraclerouter](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/oraclerouter/32/30494_2.png) [@oraclerouter](https://community.particle.io/u/oraclerouter)\
**Post date:** [April 13, 2020, 5:33pm UTC](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038/23 "2020-04-13T17:33:05Z")

</div>

I wasn’t planning on saving as a String.

I’ll remove the intermediate deviceName. Did you think that us the issue?

---

<div class="post-metadata">

**Author:** ![oraclerouter](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/oraclerouter/32/30494_2.png) [@oraclerouter](https://community.particle.io/u/oraclerouter)\
**Post date:** [April 13, 2020, 8:23pm UTC](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038/24 "2020-04-13T20:23:14Z")

</div>

> [@ScruffR](#):
>
> char dev\_name[32];

No dice ... same results.

[Previous page](https://community.particle.io/t/how-to-include-device-name-not-just-device-id-in-sms-when-using-messaging-cloud-api-twilio/36038.md?page=1)
