Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  API Agentless Email

    Posted 06-05-2025 18:24

    Rob_Graham | 2022-11-16 04:01:42 UTC | #1

    Hi all,

    We have been attempting to test /api/v2/conversations/emails/agentless via the developer API. We were unable to test this as it requires authentication therefore created a data action.

    With creating the data action, can someone provide insight on the following:

    Under the Action Contracts:

    • What Output Contracts are required?

    Under the Action Configuration:

    • Does it require Headers?
    • What the Request Body Template required is?

    Intention is to create an in-queue flow that contains a data action that replies to in-queue email conversations.

    Any info would be much appreciated.

    Thanks, Rob


    78692638d4a24645fbf5 | 2022-11-16 23:10:52 UTC | #2

    Hi Rob,

    I would recommend starting from this page. https://help.mypurecloud.com/articles/set-up-a-domain-for-outbound-email-campaigns/

    You first need an email subdomain to send outbound agentless emails or campaign emails. This is required because of how Genesys built everything in the backend using sparkpost. It helps with the email delivery success.

    Once you have that, then you can set up a Genesys Cloud Data integration and configure a Data Action. MY data action looks like the following: VERB: POST URL: /api/v2/conversations/emails/agentless BODY: { "senderType": "Outbound", "fromAddress": { "email": "${input.fromAddressEmail}", "name": "${input.fromAddressName}" }, "toAddresses": [ { "email": "${input.toAddressEmail}", "name": "${input.toAddressName}" } ], "replyToAddress": { "email": "${input.replyToAddressEmail}", "name": "${input.replyToAddressName}" }, "subject": "${input.subject}", "htmlBody": "${input.htmlBody}" }

    Where all the input values are configured in my input contract. Does this help?


    Rob_Graham | 2022-11-17 00:02:38 UTC | #3

    That is very helpful. Thanks for that.

    Just to confirm, are you configuring anything in here?

    If I understand you have just configured it within here:

    The only reason I ask, if the action contracts are not added - you cannot test the action through the UI prior to publishing it?

    Thanks, Rob


    78692638d4a24645fbf5 | 2022-11-17 00:25:48 UTC | #4

    I have the following values in my input contract:

    { "type": "object", "properties": { "fromAddressEmail": { "type": "string" }, "fromAddressName": { "type": "string" }, "toAddressEmail": { "type": "string" }, "toAddressName": { "type": "string" }, "replyToAddressEmail": { "type": "string" }, "replyToAddressName": { "type": "string" }, "subject": { "type": "string" }, "htmlBody": { "type": "string" } }, "additionalProperties": true }

    And yes, the piece I posted in my first answer is in the Request Body.


    Rob_Graham | 2022-11-17 00:55:24 UTC | #5

    Great! This helps - I can see what I missed in the config.

    I think I just need to configure the correct email domain for this now.

    Thank you for your help! I will let you know if I require any further help


    jacobshaw | 2022-11-18 15:11:52 UTC | #6

    Hi @Rob_Graham I was able to get this data action working myself so I will go ahead and add my two cents.

    When creating data actions, you can use use the API explorer to get the contracts. You can find the resource you need and enable "reading mode" for a more concise view of the request/ response fields. Responses will be under API response --> 200 https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-emails-agentless

    As you can probably tell, the input contract is not the request body itself, rather it's the input parameters for the request. It does not allow nested objects or arrays. For example the "fromAddress" object is split into "fromAddressEmail" and "fromAddressName". The output contract on the other hand does allow arrays and nested objects.

    My input contract looks like this:

    {
      "title": "Object1",
      "type": "object",
      "required": [
        "senderType"
      ],
      "properties": {
        "senderType": {
          "type": "string"
        },
        "conversationId": {
          "type": "string"
        },
        "fromAddressEmail": {
          "type": "string"
        },
        "fromAddressName": {
          "type": "string"
        },
        "toAddressEmail": {
          "type": "string"
        },
        "toAddressName": {
          "type": "string"
        },
        "replyToAddressEmail": {
          "type": "string"
        },
        "replyToAddressName": {
          "type": "string"
        },
        "subject": {
          "type": "string"
        },
        "textBody": {
          "type": "string"
        },
        "htmlBody": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }

    And my output contract looks like this:

    {
      "title": "ResponseObject",
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "conversationId": {
          "type": "string"
        },
        "senderType": {
          "type": "string"
        },
        "fromAddress": {
          "type": "object",
          "properties": {
            "email": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "additionalProperties": true
        },
        "toAddresses": {
          "type": "array",
          "items": {
            "title": "Item 1",
            "type": "object",
            "properties": {
              "email": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        },
        "replyToAddress": {
          "type": "object",
          "properties": {
            "email": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "additionalProperties": true
        },
        "subject": {
          "type": "string"
        },
        "dateCreated": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }

    And a default response config of

    {
      "translationMap": {},
      "translationMapDefaults": {},
      "successTemplate": "${rawResult}"
    }

    is sufficient for a passing test with response of

    {
      "toAddresses.email": [
        "jacob@example.com"
      ],
      "replyToAddress.name": "Jacob",
      "fromAddress.name": "agentlesscampaign",
      "toAddresses.name": [
        "Jacob"
      ],
      "dateCreated": "2022-11-17T02:07:27.982Z",
      "fromAddress.email": "jacob@agentlesscampaign.example.com",
      "conversationId": "57ce510a-6f16-4924-a286-8d0934d16ebd",
      "subject": "test",
      "replyToAddress.email": "jacob@example.com",
      "selfUri": "/api/v2/conversations/emails/57ce510a-6f16-4924-a286-8d0934d16ebd/messages/e6bcd462-1715-4850-84b7-31cfd2f13a46",
      "id": "e6bcd462-1715-4850-84b7-31cfd2f13a46"
    }

    Rob_Graham | 2022-11-17 21:30:34 UTC | #7

    Thanks for your info Jacob. Very helpful. Will come back to the forum if we have any further questions.


    system | 2022-12-18 21:30:58 UTC | #8

    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: 17238