HTTP Integration

In order to setup automation of Gorgias tickets using DigitalGenius Flows you need to setup an integration in your Gorgias account.

This integration will be setup at the beginning to be used also for conversational flows.

Create Integration

Go to Settings > Integrations > HTTP Integration > New Integration

Add a name and description to this integration so it can be easily identified in the future.
Name: DigitalGenius Integration - for Email
Description: Send ticket messages to DG.

In the Triggers section:

  • Select Ticket message created option

For the URL add: https://flow-server.us.dgdeepai.com/v2/execution or https://flow-server.eu.dgdeepai.com/v2/execution for US or EU regions respectively.

For HTTP Method choose POST.

Leave the Request content type and Response content type set to application/json.

By now your configuration should look like this:

Add Authentication Header

Click Add Header.

For the Key add: Authorization

For the Value we need to generate a basic token based on the DigitalGenius API Key/Secret. Once you have the API Key and Secret from the tools you need to generate a basic token from them. You can run a DigitalGenius action called: Create Basic Token for this. Use the Token output for the basic token.

Add the token to the Value field.

Your headers sections should look like this:

Add Request Body (JSON)

Now add the following JSON body field but replace the {REPLACE_ACTION_ID} with the ID of master flow:

{
    "inputs": {
        "email": "{{ticket.customer.email}}",
        "channel": "{{ticket.channel}}",
        "subject": "{{ticket.subject}}",
        "ticket_id": "{{ticket.id}}"
    },
    "origin": {
        "type": "gorgias",
        "subdomain": "replace with the subdomain"
    },
    "action_id": "replace with flow id",
    "external_id": "{{ticket.id}}",
    "conversation": {
        "name": "{{ticket.customer.name}}",
        "email": "{{ticket.customer.email}}",
        "title": "{{ticket.subject}}",
        "messages": [
            {
                "from": "author",
                "author": {
                    "email": "{{message.sender.email}}",
                    "from_agent": "{{message.from_agent}}"
                },
                "content": "{{message.body_text}}",
                "timestamp": "{{message.created_datetime}}",
                "external_id": "{{message.id}}",
                "sender_name": "{{message.sender.name}}",
                "sender_email": "{{message.sender.email}}"
            }
        ],
        "external_id": "{{ticket.id}}"
    }
}

For a full list of available fields check here.

Now click Add Integration and you should be all set!

Updates in DigitalGenius flow builder

In the DG flow builder, find [Gorgias] MASTER FLOW and link the flow to an external account as follows:

  1. Select External Key
  1. Add the JSON object in the External Integration Text field and null in the External Account Key field
{
  "dgAiEmail": "[email protected]",
  "name": "gorgias"
}
  1. Click Submit