Genesys Cloud - Main

 View Only

Sign Up

Expand all | Collapse all

Send an SMS using the API

  Thread closed by the administrator, not accepting new replies.
  • 1.  Send an SMS using the API

    Posted 12-12-2019 04:40
    No replies, thread closed.
    Hi everyone,

      I am asked by a customer if it is possible to send an SMS by pressing a dedicated button in a script. The only part that I am still stuck with is how to send an SMS using PureCloud's API. I have found the function POST /api/v2/conversations/messages to create a message of type "sms" but it results in one "id", I thought I could then use the function POST /api/v2/conversations/messages/{conversationId}/communications/{communicationId}/messages but I am requested a conversationId and communicationId. I do not know how to retrieve them, I must have missed a step somewhere.
      Can someone explain me how to do that ?

    Kind regards,

      Bastien


    #Implementation
    #Outbound

    ------------------------------
    Bastien PUYGRANIER
    Orange Business Services S.A.
    ------------------------------


  • 2.  RE: Send an SMS using the API

    Posted 12-12-2019 09:31
    No replies, thread closed.
    You will need to create the SMS on behalf of the user as the API does not allow system generated SMS at this time.  I have been successful in sending out through a queue on behalf of the user with the normal POST URI.

    ------------------------------
    Robert Wakefield-Carl
    Avtex Solutions, LLC
    Contact Center Innovation Architect
    robertwc@avtex.com
    https://www.Avtex.com
    https://RobertWC.Blogspot.com
    ------------------------------



  • 3.  RE: Send an SMS using the API

    Posted 12-15-2019 03:53
    No replies, thread closed.
    Thank you Robert, however I am not quite sure I understood: did you use the API to send an SMS on behalf of a defined user ? If you could send me an example, that would be great.

    ------------------------------
    Bastien PUYGRANIER
    Orange Business Services S.A.
    ------------------------------



  • 4.  RE: Send an SMS using the API
    Best Answer

    Posted 12-16-2019 07:58
    No replies, thread closed.
    Bastien,
    This would be possible today with outbound sms on behalf of queue, but it will likely be awkward to implement for you. For a much better implementation, please keep an eye on the release notes as we are nearing release of an Agentless Outbound SMS feature (doesn't require user context, as Robert eluded in his post) that should make this a much cleaner/easier for you.

    To answer your existing question the response to your original POST /api/v2/conversations/messages is going to contain the conversationId. You could then take this conversationId and do a GET /api/v2/conversations/{conversationId} . This response would contain the whole conversation, which you could then look for a message communicationId on (likely on the agent participant purpose) and then do your POST /api/v2/conversations/messages/{conversationId}/communications/{communicationId}/messages sending the outbound sms to the customer.


    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 5.  RE: Send an SMS using the API

    Posted 12-16-2019 08:47
    No replies, thread closed.
    Hi Greg,

    Thank you ! I have tested it and this is exactly what I needed ! This proves an SMS can be sent automatically as long as this is done on behalf of an agent, which is fine by me.

    Kind regards,

      Bastien

    ------------------------------
    Bastien PUYGRANIER
    Orange Business Services S.A.
    ------------------------------



  • 6.  RE: Send an SMS using the API

    Posted 03-31-2020 09:43
    No replies, thread closed.
    Hi guys,

    How were you able to get the communicationId?
    I can't find it for any channel!

    Thanks in advance!

    Best,
    Vasco


    ------------------------------
    Vasco Taveira
    HelloFresh
    ------------------------------



  • 7.  RE: Send an SMS using the API

    Posted 03-31-2020 10:17
    No replies, thread closed.
    Vasco,
    Use your `GET /api/v2/conversations/{conversationId}` in that response you will likely see several Participants. so you would need to look for the participant you want. In that participant there could be multiple messages (aka communications), so find the one you want there in the list and use it's Id. So participant.messages.id should be the communicationId you want

    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 8.  RE: Send an SMS using the API

    Posted 04-03-2020 09:13
    No replies, thread closed.
    Thank you Greg for the help!!
    Best,
    Vasco

    ------------------------------
    Vasco Taveira
    HelloFresh
    ------------------------------



  • 9.  RE: Send an SMS using the API

    Posted 02-26-2021 12:07
    No replies, thread closed.
    Hi Greg - 

    Do you have any update if there is any new API being introduced which we can use to send Agentless SMS. 

    Our requirement is to send the SMS to the customer during an ongoing call without routing it to Agent. (One Way SMS from the Architect)

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------



  • 10.  RE: Send an SMS using the API

    Posted 02-26-2021 12:37
    No replies, thread closed.
    Hi Anurag,
    Agentless sms api has been available for a while now. You should be able to use an Architect Data Action to invoke this API from your call flow. See https://help.mypurecloud.com/articles/agentless-sms-notifications/ for more info on the agentless sms notification api documentation. I think this would service your use case nicely.

    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 11.  RE: Send an SMS using the API

    Posted 03-01-2021 12:11
    No replies, thread closed.
    Greg - Thanks for your response.

    This works but then number getting displayed at the customer end is in short codes although we are passing complete number in the from address in API.

    How can we use the same SMS number which we have procured as display number on Customer phone when receiving SMS ?

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------



  • 12.  RE: Send an SMS using the API

    Posted 03-01-2021 12:41
    No replies, thread closed.

    Anurag,
    I'm not sure i understand what you are saying exactly. The number you specified in the fromAddress to the Agentless API is the number that would show on the customer's cell phone as the number the message is coming from. If you used a short code there, then that's what should be displayed.

    fromAddress(string required) The messaging address of the sender of the message. For an SMS messenger type, this must be a currently provisioned sms phone number.

    If you feel like there is some error in the way it works please open a support ticket to investigate more.



    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 13.  RE: Send an SMS using the API

    Posted 03-01-2021 12:54
    No replies, thread closed.
    Greg - That was what my understand is that the number which you will give in fromAddress, is the one going to show on the customer's cell phone.

    When we tested, we used number as "+151290xxxxx" but on the customer's cell phone it is getting displayed as "5757xxxx" which is no where close to what number we have procured for SMS.

    Do you want us to open a support case for this or are we missing any configuration ?

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------



  • 14.  RE: Send an SMS using the API

    Posted 03-01-2021 13:00
    No replies, thread closed.
    Anurag, 
    Yes i would open a support case for that. That way support can gather all the info needed and figure out what is causing the issue.

    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 15.  RE: Send an SMS using the API

    Posted 03-01-2021 13:20
    No replies, thread closed.
    Thanks Greg for all your help. Will open a Genesys Case !

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------



  • 16.  RE: Send an SMS using the API

    Posted 03-01-2021 15:23
    No replies, thread closed.

    Anurag,
    No problem. Just wanted to followup on one possible cause for this. This is a statement from our provider

    Sender ID change may occur when you send messages from a number that is not local to your recipients, for example using a US number to send SMS to Polish mobile users. This is often done to comply with local regulations, or to ensure the highest possible delivery rate for your messages.
    
    Sender ID change will not occur when you send messages using a number from the same country as the recipient, for example using a Polish number to send SMS to a Polish mobile user.

    you should be able to validate if this could be your issue by inspecting the countries of the number you are sending from and to.



    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 17.  RE: Send an SMS using the API

    Posted 03-02-2021 00:03
    No replies, thread closed.
    Thanks Greg - This worked, I used US number to send SMS and could able to see correct number getting displayed on Customer Cell Phone which proves your theory :)

    Also is there a way we can use the same number to get displayed on the Customer cell phone outside US ?

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------



  • 18.  RE: Send an SMS using the API

    Posted 03-02-2021 07:08
    No replies, thread closed.
    Anurag,
    The way to do it there would be to use a number you purchased in GC that was within that same country you are sending the message to. That is really the only way to be sure.

    ------------------------------
    Greg Boston
    Genesys - Employees
    ------------------------------



  • 19.  RE: Send an SMS using the API

    Posted 03-02-2021 10:05
    No replies, thread closed.
    Thanks Greg for your response, it was helpful.. Really appreciate !

    ------------------------------
    Thanks,
    Anurag Gusain
    ------------------------------