Legacy Dev Forum Posts

 View Only

Sign Up

API Whatsapp Agentless outbound message, message error status 404

  • 1.  API Whatsapp Agentless outbound message, message error status 404

    Posted 06-05-2025 18:06

    Riko80 | 2023-01-02 11:28:58 UTC | #1

    Hi, I need your assistance please because I want to create whatsapp outbound messages I have implemented the whatsapp agentless source code which is in developper tools of Genesys. but when I debug it I get the following error message but I don't know the problem if you can assist me please

    My code source: string basePath = "/api/v2/conversations/messaging/integrations/whatsapp/81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0";

    PureCloudRegionHosts region = PureCloudRegionHosts.euwest1; // 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; // var apiInstance = new ConversationsApi(); // var body = new SendAgentlessOutboundMessageRequest(); // SendAgentlessOutboundMessageRequest | Create agentless outbound messaging request

    try {

    // Instantiate APIs ConversationsApi conversationsApi = new ConversationsApi(); //var body = new SendAgentlessOutboundMessageRequest(); // SendAgentlessOutboundMessageRequest | Create agentless outbound messaging request

    // Build request body SendAgentlessOutboundMessageRequest request = new SendAgentlessOutboundMessageRequest(); request.FromAddress = "212XXXXXXXXXX"; request.ToAddress = "212XXXXXXXXXX"; request.ToAddressMessengerType = SendAgentlessOutboundMessageRequest.ToAddressMessengerTypeEnum.Whatsapp; request.TextBody = "Hello, this is a test notification"; request.UseExistingActiveConversation = true;

    // 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; }

    when the method SendAgentlessOutboundMessageResponse response = conversationsApi.PostConversationsMessagesAgentless(request); is called the following error message is displayed

    <string> exceptionError calling PostConversationsMessagesAgentless: {"message":"No WhatsAppIntegration could be found with an id of {id}","code":"not.found","status":404,"messageWithParams":"No {type} could be found with an id of {id}","messageParams":{"id":"","type":"WhatsAppIntegration"},"contextId":"cece967f-cef6-414f-8ca7-d2fcfe099978","details":[],"errors":[]} </string>

    Regards


    tim.smith | 2023-01-03 18:54:15 UTC | #2

    Riko80, post:1, topic:17807
    ,"messageWithParams":"No {type} could be found with an id of {id}","messageParams":{"id":"","type":"WhatsAppIntegration"},

    This seems to be indicating that there isn't a whatsapp integration for a blank ID, which makes sense by itself. However, there is no way for you to specify an ID in that request so this error is nonsensical in context. Please open a case with Genesys Cloud Care to investigate as this appears to be a bug.


    Riko80 | 2023-01-09 07:15:17 UTC | #3

    Thank you Tim for your help, as suggested I checked with Genesys Cloud Care , who asked me to set integration id in fromaddress, which I did but I got another error message

    My Code source :slight_smile: string basePath = "/api/v2/conversations/messaging/integrations/whatsapp/81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0";

    PureCloudRegionHosts region = PureCloudRegionHosts.euwest1; // Genesys Cloud region // apiClientPost.setBasePath(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(); //var body = new SendAgentlessOutboundMessageRequest(); // SendAgentlessOutboundMessageRequest | Create agentless outbound messaging request

    // Build request body SendAgentlessOutboundMessageRequest request = new SendAgentlessOutboundMessageRequest(); request.FromAddress = "81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0"; request.ToAddress = "212XXXXXXXXXX"; request.ToAddressMessengerType = SendAgentlessOutboundMessageRequest.ToAddressMessengerTypeEnum.Whatsapp; request.TextBody = "Hello, this is a test notification"; 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; }

    Error Message :

    exceptionError calling PostConversationsMessagesAgentless: {"message":"Bad request: Message text cannot be sent with messengerType <whatsapp>","code":"bad.request","status":400,"messageWithParams":"Bad request: {details}","messageParams":{"details":"Message text cannot be sent with messengerType <whatsapp>"},"contextId":"76d868ee-5ddd-4bc7-847f-0e9f03cb6ed8","details":[],"errors":[]}


    tim.smith | 2023-01-09 15:23:49 UTC | #4

    Riko80, post:3, topic:17807
    {"details":"Message text cannot be sent with messengerType "},

    Have you tried making the request without setting me messenger type?


    Riko80 | 2023-01-10 06:36:36 UTC | #5

    tim.smith, post:4, topic:17807
    Have you tried making the request without setting me messenger type?

    Hi Tim Thank you for your update, Yes i tried it , I removed this line from the code : request.ToAddressMessengerType = SendAgentlessOutboundMessageRequest.ToAddressMessengerTypeEnum.Whatsapp;

    but I had this error message :

    exceptionError calling PostConversationsMessagesAgentless: {"message":"Bad request: Missing messengerType","code":"bad.request","status":400,"messageWithParams":"Bad request: {details}","messageParams":{"details":"Missing messengerType"},"contextId":"458cc233-b60e-4f4b-80ab-d67dc37bef1c","details":[],"errors":[]}

    Regards


    Greg_Boston | 2023-01-10 13:23:12 UTC | #6

    @Riko80 Please have a look at the documentation and make sure you understand what is needed in the request. https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-messages-agentless

    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. For a WhatsApp messenger type use the provisioned WhatsApp integration’s ID.
    toAddress
    (string required) The messaging address of the recipient of the message. For an SMS messenger type, the phone number address must be in E.164 format. E.g. +13175555555 or +34234234234.
    toAddressMessengerType
    (string required) The recipient messaging address messenger type.Valid values: sms, whatsapp, open.
    messagingTemplate
    (MessagingTemplateRequest) The messaging template to use in the case of WhatsApp messenger type. This field is required when using WhatsApp messenger type.

    So you need the required fields. and in the case of Whatsapp you would need a messagingTemplate as well. See https://help.mypurecloud.com/articles/agentless-whatsapp-notifications/ for more help here. Pay special attention to the Prerequisites section


    Riko80 | 2023-01-11 11:28:42 UTC | #7

    Hi @Greg_Boston Thank you for your answer, how can I create a messagingTemplate please? can you send me a link to the documentation or an example to follow on the messagingTemplate creation part please?

    Regards


    Greg_Boston | 2023-01-11 12:21:34 UTC | #8

    Please see the second link I posted in the above response. The 5th bullet point under Prerequisites section talks about how to do it exactly. https://help.mypurecloud.com/articles/agentless-whatsapp-notifications/


    Riko80 | 2023-01-16 18:37:56 UTC | #9

    Hi @Greg_Boston Thank you for your help,

    I created a predefined message of type "message template" I filled in the fields as follows: id namespace = TESTTEMPLATE Name of the template = TESTTEMPLATE

    and i changed my code source like below:

    string basePath = "/api/v2/conversations/messaging/integrations/whatsapp/81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0"; // var apiClientPost = new ApiClient(basePath); PureCloudRegionHosts region = PureCloudRegionHosts.euwest1; // Genesys Cloud region // apiClientPost.setBasePath(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 = "TESTTEMPLATE"; request.MessagingTemplate.ResponseId = req.ResponseId.ToString();

    request.ToAddressMessengerType = SendAgentlessOutboundMessageRequest.ToAddressMessengerTypeEnum.Whatsapp; request.TextBody = "Hello, this is a test notification"; 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; }

    This message error is displayed:

    exceptionError calling PostConversationsMessagesAgentless: {"message":"Bad request: Message text cannot be sent with messengerType <whatsapp>","code":"bad.request","status":400,"messageWithParams":"Bad request: {details}","messageParams":{"details":"Message text cannot be sent with messengerType <whatsapp>"},"contextId":"aaf04559-28df-42fb-bcc4-58432fab5d37","details":[],"errors":[]}

    Regards


    Greg_Boston | 2023-01-17 12:34:53 UTC | #10

    @Riko80 What that error is trying to explain, is that the messagingTemplate is the message you are sending to the WA user here. There should be no request.TextBody = in your code. Because you can't send agentless outbound text for WA, due to the 24 hour rule described on the resource center documentation pages. You can only send the messagingTemplate with the message you want in it for the agentless endpoint. That is the only supported way.


    Riko80 | 2023-01-17 13:23:23 UTC | #11

    Hi @Greg_Boston Thank you for your help, I removed the request.textBody line from my source code I created a new template and named it test24h

    I filled in the fields as follows:

    id namespace = test24h Name of the template = test24h

    Below my code source : string basePath = "/api/v2/conversations/messaging/integrations/whatsapp/81ff9d2a-a865-48b2-bb3e-7c4fbe0a14b0";

    PureCloudRegionHosts region = PureCloudRegionHosts.euwest1;

    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 = "test24h"; 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

    return response.ToString(); } catch (Exception e) {

    return "exception" + e.Message; } This new message error is displayed : exceptionError calling PostConversationsMessagesAgentless: {"message":"No Response could be found with an id of test24h","code":"not.found","status":404,"messageWithParams":"No {type} could be found with an id of {id}","messageParams":{"id":"test24h","type":"Response"},"contextId":"c17de394-b9e5-432f-b420-473deb0b2c33","details":[],"errors":[]} Regards


    Greg_Boston | 2023-01-17 15:25:50 UTC | #12

    @Riko80 it appears you didn't use a ResponseManagement Id in the request. Please look at the documentation and adjust your code to supply the correct values for your use case. You can use GET api/v2/responsemanagement/libraries?messagingTemplateFilter=whatsapp api to help you there likely

    messagingTemplate
    (MessagingTemplateRequest) The messaging template to use in the case of WhatsApp messenger type. This field is required when using WhatsApp messenger type.
    responseId
    (string) A Response Management response identifier for a messaging template defined response.
    parameters
    (TemplateParameter[]) A list of Response Management response substitutions for the response's messaging template.
    id
    (string) Response substitution identifier.
    value
    (string) Response substitution value.

    Riko80 | 2023-01-18 07:27:10 UTC | #13

    Hi @Greg_Boston, Thank you for your update, I can't access to api/v2/responsemanagement/libraries?messagingTemplateFilter=whatsapp Can you provide me documentation please for ResponseManagement Id Thank you very much, Regards


    Greg_Boston | 2023-01-18 12:46:58 UTC | #14

    @Riko80 that api is here https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-responsemanagement-libraries


    system | 2023-02-18 12:47:51 UTC | #15

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


    This post was migrated from the old Developer Forum.

    ref: 17807