Send Agentless Whatsapp API doesn't work

Hi,

I have developed an api in .Net to send an agentless whatsapp based on the sdk code provided in the Genesys cloud documentation, but I have an error message
whereas normally we have already validated the "auto_replay" template at Genesys below is my .Net code

public string Get(int id)
{

        string basePath = "/api/v2/conversations/messages/agentless";
                    PureCloudRegionHosts region = PureCloudRegionHosts.eu_west_1; // Genesys Cloud region
                                                                      

        PureCloudPlatform.Client.V2.Client.Configuration.Default.ApiClient.setBasePath(region);
        var accessTokenInfo = PureCloudPlatform.Client.V2.Client.Configuration.Default.ApiClient.PostToken("692cf986-2a7d-4df6-9dc7-6bd7a95fff4f", "Eom0X83pVROeFQ9DB1UhZlTPXol7BfIVSVa_ycbTcwY", "https://apps.mypurecloud.ie");
        string accessToken = accessTokenInfo.AccessToken;
        PureCloudPlatform.Client.V2.Client.Configuration.Default.AccessToken = accessToken;
        try
        {

            // Instantiate APIs
            ConversationsApi conversationsApi = new ConversationsApi();

            // Build request body
            SendAgentlessOutboundMessageRequest request = new SendAgentlessOutboundMessageRequest();
            request.FromAddress = "81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0";
            request.ToAddress = "212XXXXXXXXXX";
            request.MessagingTemplate = new MessagingTemplateRequest();
            MessagingTemplateRequest req = new MessagingTemplateRequest();
            req.ResponseId = "auto_replay";
            request.MessagingTemplate.ResponseId = req.ResponseId.ToString();

            request.ToAddressMessengerType = SendAgentlessOutboundMessageRequest.ToAddressMessengerTypeEnum.Whatsapp;                
            request.UseExistingActiveConversation = false;

            // Call to PostConversationsMessagesAgentless function of Conversations API
            SendAgentlessOutboundMessageResponse response = conversationsApi.PostConversationsMessagesAgentless(request);

            // Final Output
            //Console.WriteLine(response.ToString());
            return response.ToString();
        }
        catch (Exception e)
        {
            // Debug.Print("Exception when calling Conversations.PostConversationsMessagesAgentless: " + e.Message);

            return "exception" + e.Message;
        }
    }

Below the error message :

exceptionError calling PostConversationsMessagesAgentless: {"message":"No Response could be found with an id of auto_replay","code":"not.found","status":404,"messageWithParams":"No {type} could be found with an id of {id}","messageParams":{"id":"auto_replay","type":"Response"},"contextId":"2ed9d520-0c42-4af2-9c5d-31a0a7b637ed","details":[],"errors":[]}

the "auto_replay" template validated by Genesys and created in the predefined responses section

Can you bring me a solution on what can be a problem?
Regards

Hi,
Any update please?
Regards

The response ID requires the ID of a response, not its name. You can retrieve responses using GET /api/v2/responsemanagement/responses.

@tim.smith,
thank you for your update,
I replaced the name with the id but I still have the same error (instead of the name it shows me the id
can we make a zoom point please, to explain my need? because I can't find a solution since 1 month I try and it doesn't work
my need is send an agentless whatsapp message, I followed the documentation and I took the SDK .net code that I tried to develop in Visual studio but each time I have an error

Regards

Yes, Genesys offers consultation services! Direct 1 on 1 consultation can be hired from Genesys Cloud Professional Services. If you need assistance getting in touch with your sales rep to kick off an engagement, let me know and I can have someone reach out to you.

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