How to send an SMS with custom sender ID with Amazon SNS and Python and boto32019 Community Moderator ElectionMultiple Environment Support in AWS SNS SMSHow do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How to get the number of elements in a list in Python?How to concatenate two lists in Python?How to read a file line-by-line into a list?How to lowercase a string in Python?ERROR sending a SMS with Amazon SNS and Python and boto3

How do we create new idioms and use them in a novel?

Playing a 7-string guitar song on a 6-string guitar

Traveling to heavily polluted city, what practical measures can I take to minimize impact?

PTIJ: Who was the sixth set of priestly clothes for?

Converting from "matrix" data into "coordinate" data

School performs periodic password audits. Is my password compromised?

Why is there an extra space when I type "ls" on the Desktop?

Trocar background-image com delay via jQuery

Professor forcing me to attend a conference, I can't afford even with 50% funding

Can one live in the U.S. and not use a credit card?

Short scifi story where reproductive organs are converted to produce "materials", pregnant protagonist is "found fit" to be a mother

Is this Paypal Github SDK reference really a dangerous site?

How is it possible to drive VGA displays at such high pixel clock frequencies?

I can't die. Who am I?

Do Cubics always have one real root?

Is it possible to clone a polymorphic object without manually adding overridden clone method into each derived class in C++?

If nine coins are tossed, what is the probability that the number of heads is even?

How can I portion out frozen cookie dough?

How do spaceships determine each other's mass in space?

"If + would" conditional in present perfect tense

Use Mercury as quenching liquid for swords?

Can the Witch Sight warlock invocation see through the Mirror Image spell?

If sound is a longitudinal wave, why can we hear it if our ears aren't aligned with the propagation direction?

Giving a career talk in my old university, how prominently should I tell students my salary?



How to send an SMS with custom sender ID with Amazon SNS and Python and boto3



2019 Community Moderator ElectionMultiple Environment Support in AWS SNS SMSHow do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How to get the number of elements in a list in Python?How to concatenate two lists in Python?How to read a file line-by-line into a list?How to lowercase a string in Python?ERROR sending a SMS with Amazon SNS and Python and boto3










20















The documentation suggests to use message attributes for that but I can't seem to figure out what attribute name to use.



This works so far:



sns = boto3.client('sns', region_name='eu-west-1')

sns.publish(
PhoneNumber='+491701234567',
Message='hi there',
MessageAttributes=
'AWS.SNS.SMS.SenderID':
'DataType': 'String',
'StringValue': 'MySenderID'


)


The SMS is delivered but with some (random?) value in the sender id field. So it seems my setting of message attributes is silently ignored. What is the correct way to set a custom sender id?










share|improve this question






















  • What country is that phone number?

    – error2007s
    Jul 13 '16 at 15:30











  • @error2007s Germany

    – tgal
    Jul 14 '16 at 16:34











  • I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

    – Diligent Key Presser
    Nov 11 '16 at 8:09











  • As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

    – tuxar
    Nov 30 '16 at 19:27
















20















The documentation suggests to use message attributes for that but I can't seem to figure out what attribute name to use.



This works so far:



sns = boto3.client('sns', region_name='eu-west-1')

sns.publish(
PhoneNumber='+491701234567',
Message='hi there',
MessageAttributes=
'AWS.SNS.SMS.SenderID':
'DataType': 'String',
'StringValue': 'MySenderID'


)


The SMS is delivered but with some (random?) value in the sender id field. So it seems my setting of message attributes is silently ignored. What is the correct way to set a custom sender id?










share|improve this question






















  • What country is that phone number?

    – error2007s
    Jul 13 '16 at 15:30











  • @error2007s Germany

    – tgal
    Jul 14 '16 at 16:34











  • I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

    – Diligent Key Presser
    Nov 11 '16 at 8:09











  • As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

    – tuxar
    Nov 30 '16 at 19:27














20












20








20


5






The documentation suggests to use message attributes for that but I can't seem to figure out what attribute name to use.



This works so far:



sns = boto3.client('sns', region_name='eu-west-1')

sns.publish(
PhoneNumber='+491701234567',
Message='hi there',
MessageAttributes=
'AWS.SNS.SMS.SenderID':
'DataType': 'String',
'StringValue': 'MySenderID'


)


The SMS is delivered but with some (random?) value in the sender id field. So it seems my setting of message attributes is silently ignored. What is the correct way to set a custom sender id?










share|improve this question














The documentation suggests to use message attributes for that but I can't seem to figure out what attribute name to use.



This works so far:



sns = boto3.client('sns', region_name='eu-west-1')

sns.publish(
PhoneNumber='+491701234567',
Message='hi there',
MessageAttributes=
'AWS.SNS.SMS.SenderID':
'DataType': 'String',
'StringValue': 'MySenderID'


)


The SMS is delivered but with some (random?) value in the sender id field. So it seems my setting of message attributes is silently ignored. What is the correct way to set a custom sender id?







python amazon-web-services sms amazon-sns boto3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 13 '16 at 14:54









tgaltgal

20123




20123












  • What country is that phone number?

    – error2007s
    Jul 13 '16 at 15:30











  • @error2007s Germany

    – tgal
    Jul 14 '16 at 16:34











  • I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

    – Diligent Key Presser
    Nov 11 '16 at 8:09











  • As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

    – tuxar
    Nov 30 '16 at 19:27


















  • What country is that phone number?

    – error2007s
    Jul 13 '16 at 15:30











  • @error2007s Germany

    – tgal
    Jul 14 '16 at 16:34











  • I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

    – Diligent Key Presser
    Nov 11 '16 at 8:09











  • As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

    – tuxar
    Nov 30 '16 at 19:27

















What country is that phone number?

– error2007s
Jul 13 '16 at 15:30





What country is that phone number?

– error2007s
Jul 13 '16 at 15:30













@error2007s Germany

– tgal
Jul 14 '16 at 16:34





@error2007s Germany

– tgal
Jul 14 '16 at 16:34













I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

– Diligent Key Presser
Nov 11 '16 at 8:09





I have the same trouble trying to send message from the console. No matter what i write in Sender ID field i got NEXMO_SMS instead. Is it a bug?

– Diligent Key Presser
Nov 11 '16 at 8:09













As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

– tuxar
Nov 30 '16 at 19:27






As workaround you can set 'DefaultSenderID' <!-- language: python --> #!/usr/bin/env python import boto3 s = boto3.Session(profile_name='Godzilla') sns = s.client('sns') sns.set_sms_attributes( attributes= 'DefaultSenderID': 'Godzilla', ) response = sns.get_sms_attributes( attributes=[ 'DefaultSenderID', ] ) print(response)

– tuxar
Nov 30 '16 at 19:27













2 Answers
2






active

oldest

votes


















1














Check if your destination country supports sender IDs



http://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html






share|improve this answer






























    1














    As noted by Adam Owczarczyk, some countries don't allow you to transmit a sender ID in a text message. The API will take your number and replace it with a string in this case to allow your message to get delivered. Attempting to work around it usually just gets the number blacklisted. You can test this by entering a short descriptive string for your tester ID, and seeing if that gets through.






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function ()
      StackExchange.using("externalEditor", function ()
      StackExchange.using("snippets", function ()
      StackExchange.snippets.init();
      );
      );
      , "code-snippets");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "1"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38355151%2fhow-to-send-an-sms-with-custom-sender-id-with-amazon-sns-and-python-and-boto3%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Check if your destination country supports sender IDs



      http://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html






      share|improve this answer



























        1














        Check if your destination country supports sender IDs



        http://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html






        share|improve this answer

























          1












          1








          1







          Check if your destination country supports sender IDs



          http://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html






          share|improve this answer













          Check if your destination country supports sender IDs



          http://docs.aws.amazon.com/sns/latest/dg/sms_supported-countries.html







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 26 '17 at 10:48









          Adam OwczarczykAdam Owczarczyk

          1,337717




          1,337717























              1














              As noted by Adam Owczarczyk, some countries don't allow you to transmit a sender ID in a text message. The API will take your number and replace it with a string in this case to allow your message to get delivered. Attempting to work around it usually just gets the number blacklisted. You can test this by entering a short descriptive string for your tester ID, and seeing if that gets through.






              share|improve this answer





























                1














                As noted by Adam Owczarczyk, some countries don't allow you to transmit a sender ID in a text message. The API will take your number and replace it with a string in this case to allow your message to get delivered. Attempting to work around it usually just gets the number blacklisted. You can test this by entering a short descriptive string for your tester ID, and seeing if that gets through.






                share|improve this answer



























                  1












                  1








                  1







                  As noted by Adam Owczarczyk, some countries don't allow you to transmit a sender ID in a text message. The API will take your number and replace it with a string in this case to allow your message to get delivered. Attempting to work around it usually just gets the number blacklisted. You can test this by entering a short descriptive string for your tester ID, and seeing if that gets through.






                  share|improve this answer















                  As noted by Adam Owczarczyk, some countries don't allow you to transmit a sender ID in a text message. The API will take your number and replace it with a string in this case to allow your message to get delivered. Attempting to work around it usually just gets the number blacklisted. You can test this by entering a short descriptive string for your tester ID, and seeing if that gets through.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 6 at 23:54









                  Cody Gray

                  194k35380468




                  194k35380468










                  answered Mar 6 at 23:01









                  JaminaBeeJaminaBee

                  135




                  135



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f38355151%2fhow-to-send-an-sms-with-custom-sender-id-with-amazon-sns-and-python-and-boto3%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

                      Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

                      2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived