# Errors When Using Twilio Sub-Account

**URL:** <https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185>\
**Category:** Ignition\
**Created:** [October 13, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185 "2022-10-13T16:07:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 13, 2022, 4:07pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/1 "2022-10-13T16:07:22Z")

</div>

I change the configuration from using my main Twilio account SID and authentication tokens to a newly created Twilio sub-account SID and authentication token. I get these errors in the log. The phone number I'm using is valid, it works when I use the main account credentials.

This sounds similar to something that was fixed in an earlier version.

> _## Data Model_
> 
> _ **2288: Twilio: Connections to multiple sub accounts causes all but one to have an authentication error** _  
> _Fixed a regression which caused account credentials of the last loaded Twilio account to be used for all Twilio accounts. Multiple Twilio accounts can now be used without authentication errors_  
> [https://forum.inductiveautomation.com/t/nightly-8-1-changelogs-2021/42410/85](https://forum.inductiveautomation.com/t/nightly-8-1-changelogs-2021/42410/85)

BTW, I'm running version 8.1.18.

**First Error**

```auto
com.twilio.exception.ApiException: The From phone number +XXX is not a valid, SMS-capable inbound phone number or short code for your account.
at com.twilio.rest.api.v2010.account.MessageCreator.create(MessageCreator.java:505)
at com.digitalpetri.ignition.twilio.accounts.TwilioAccount$ConnectedTwilioAccount.lambda$sendSms$6(TwilioAccount.java:346)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

```

**Second Error**

```auto
java.util.concurrent.ExecutionException: com.digitalpetri.ignition.twilio.accounts.TwilioAccount$TwilioAccountException: The From phone number +XXX is not a valid, SMS-capable inbound phone number or short code for your account.
at java.base/java.util.concurrent.FutureTask.report(Unknown Source)
at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
at com.digitalpetri.ignition.twilio.accounts.TwilioAccount$ConnectedTwilioAccount.sendSms(TwilioAccount.java:358)
at com.digitalpetri.ignition.twilio.alarming.TwilioNotificationProfile.lambda$sendNotification$2(TwilioNotificationProfile.java:125)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(Unknown Source)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEach(Unknown Source)
at com.digitalpetri.ignition.twilio.alarming.TwilioNotificationProfile.sendNotification(TwilioNotificationProfile.java:120)
at com.inductiveautomation.ignition.alarming.pipelines.blocks.NotificationBlock$NotificationContextImpl.run(NotificationBlock.java:521)
at com.inductiveautomation.ignition.common.execution.impl.BasicExecutionEngine$ThrowableCatchingRunnable.run(BasicExecutionEngine.java:539)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.digitalpetri.ignition.twilio.accounts.TwilioAccount$TwilioAccountException: The From phone number +XXX is not a valid, SMS-capable inbound phone number or short code for your account.
at com.digitalpetri.ignition.twilio.accounts.TwilioAccount$ConnectedTwilioAccount.lambda$sendSms$6(TwilioAccount.java:354)
... 5 common frames omitted

```

Thank you.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 13, 2022, 4:29pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/2 "2022-10-13T16:29:48Z")

</div>

In an abundance of caution I wiped your actual number from the stacktraces.

I'm not really sure what to say about the error beyond that. It's coming from Twilio directly, apparently:

> <https://github.com/twilio/twilio-java/blob/main/src/main/java/com/twilio/rest/api/v2010/account/MessageCreator.java#L225>

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [October 13, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/3 "2022-10-13T16:32:44Z")

</div>

> [@paul-griffith](#):
>
> In an abundance of caution I wiped your actual number from the stacktraces.

You missed one. Top of the second stack trace.

Are you also able to clear the edit history, because we can still go in and see what it was before your edit(s)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 13, 2022, 4:38pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/4 "2022-10-13T16:38:50Z")

</div>

AFAIK you need to either move this number to the sub account or provision a new number for the sub account.

Sub accounts exist to act as "containers" that separate resources. You can't share resources between them, and I don't _think_ you can share resources between parent/sub either, but I'm not 100% sure.

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 13, 2022, 6:32pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/5 "2022-10-13T18:32:51Z")

</div>

Thank you for scrubbing my stack traces...I'll remember that for the future.  
Twilio can be tricky. AFAIK when you use the API you have to send the main account SID & auth token as well as the sub-account SID & auth token. I'm not entirely sure. I sent their tech support a trouble ticket. We I figure it out I'll post the solution. Thanks for the help!

---

<div class="post-metadata">

**Author:** ![edward.fowler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/edward.fowler/32/24179_2.png) [@edward.fowler](https://forum.inductiveautomation.com/u/edward.fowler)\
**Post date:** [October 15, 2022, 4:51pm UTC](https://forum.inductiveautomation.com/t/errors-when-using-twilio-sub-account/65185/6 "2022-10-15T16:51:25Z")

</div>

Solved.

Sub-accounts need their own phone number when using the Ignition Twilio module. Twilio documentation is not vary concise, it leads you to believe a sub-account can us the main accounts phone number...but only if you transfer to the number from main to sub when using their API which isn't the use case when using Ignition and the Twilio module.

Thanks for the input everyone!

Regards,  
Ted.
