Anonymize a conversation or visitor data

iAdvize provides two GraphQL mutations to allow you to anonymize a conversation or a visitor. These will be used when you need to delete personal data at the request of the visitor.

In this article, we will describe:

  • How to identify conversations and visitors to anonymize

  • How to use GraphQL mutations to start the anonymization process

First of all, it's important to recall what these two mutations do

Description of mutations

What does ClosedConversationAnonymize do?

  • It deletes the messages exchanged during the conversation (including all messages, system messages, and attachments).

  • It also deletes the custom data linked to the conversation.

  • It does not delete the conversation object itself or the statistics associated with it.

What does VisitorAnonymize do?

  • It deletes all the information attached to the visitor, such as name, first name, email, phone number, etc. This could include information provided through custom data, information manually entered by agents from the iAdvize interface, or information provided through our APIs.

How to retrieve the list of conversations/visitors to be anonymized?

If you don't have development skills, that's not a problem. We invite you to use the Apollo interface to design and execute your queries. In this article, you'll find examples of ready-to-use queries and links to load them from Apollo. Don't forget to log in to your iAdvize administrator space beforehand, so that you have the necessary rights to execute graphQL queries.

Search for conversations containing a specific character string

To begin, you will likely need to identify the conversations and the associated visitors in order to request their anonymization. Generally, the need for anonymization follows a visitor’s request, who will provide his name, first name, email to perform a search, but rarely the conversation ID he participated in.

From GraphQL, you can search for the list of conversation IDs that contains a specific string over a given period. From the same query, you can also retrieve the visitor profile ID associated with each conversation. Here is an example of a query:

You can also load this query directly from your Apollo interface (make sure you are properly connected to your iAdvize administration to be authorized to execute the query).

Operation

query ClosedConversations($interval: Interval!, $filters: ClosedConversationFilters) {
 closedConversations(interval: $interval, filters: $filters) {
   edges {
     node {
       conversation {
         id
         visitor {
           id
         }
       }
     }
   }
 }
}

Variables

{
 "interval": {
   "from": "2021-08-14T00:00:00Z",
   "to": "2024-08-14T00:00:00Z"
 },
 "filters": {
   "messagesSearches": "<your_character_string>"
 }
}

iAdvize keeps conversation data (messages and custom data) for 3 years by default. The retention period may be shorter if requested by the customer. To ensure that your search is exhaustive, we recommend that you carry out your search over the last 3 years from today's date.

Response (example)

{
 "data": {
   "closedConversations": {
     "edges": [
       {
         "node": {
           "conversation": {
             "id": "83b04089-90be-41ad-a0f2-998710170212",
             "visitor": {
               "id": "8a91e839-15f3-48dd-85c7-a7991685baa7"
             }
           }
         }
       },
       {
         "node": {
           "conversation": {
             "id": "711944bd-cb87-49a7-91b0-c2c3a2668f5g",
             "visitor": {
               "id": "f41323c0-e76f-4835-b4e0-572e85d8fe2a"
             }
           }
         }
       }
     ]
   }
 }
}

Retrieve the IDs of the conversations and visitors you want to anonymize this way.

Search for a visitor by email or phone number

If searching the content of conversations doesn't produce any results, you can also search visitor data using an email or phone number.

In this case, you'll need to use the following Query graphQL to retrieve the id of one or more visitors, which you'll then need to anonymize:

Operation

query Visitors($projectId: Int!, $email: String) {
  visitors(projectId: $projectId, email: $email) {
    edges {
      node {
        id
      }
    }
  }
}

Variables

{
  "projectId": 6949,
  "email": "test@iadvize.com",
  "phoneNumber": "+33010120304"
}

Response

{
 "data": {
   "visitors": {
     "edges": [
       {
         "node": {
           "id": "2183b42d-464d-4824-abb1-504619724ea9"
         }
       }
     ]
   }
 }
}

How to anonymize the content of a conversation?

You need to execute the following GraphQL mutation to anonymize a conversation. Here is an example of a GraphQL request accessible from your Apollo interface.

Operation

mutation ClosedConversationAnonymize($input: ClosedConversationAnonymizeInputType!) {
 closedConversationAnonymize(input: $input) {
   conversation {
     id
   }
   succeeded
 }
}

Variables

{
 "input": {
   "conversationId": "<your_conversation_id>"
 }
}

Response

{
 "data": {
   "closedConversationAnonymize": {
     "conversation": {
       "id": "83b04089-90be-41ad-a0f2-998710170212"
     },
     "succeeded": true
   }
 }
}

Error

for example, when you try to anonymize a conversation a second time.

{
 "data": {
   "closedConversationAnonymize": null
 },
 "errors": [
   {
     "message": "Conversation 83b04089-90be-41ad-a0f2-998710170212 has been not found during anonymization: it has either been dropped or anonymized",
     "path": [
       "closedConversationAnonymize"
     ],
     "locations": [
       {
         "line": 2,
         "column": 3
       }
     ],
     "extensions": {
       "code": "NOT_FOUND",
       "name": "NOT_FOUND",
       "retryPolicy": "NO_RETRY"
     }
   }
 ]
}

You can use the "succeeded" field to know if the operation was successful. If successful, it will be present with a value of "true." In case of an error, this field is absent, and a JSON "errors" array is returned.

How to anonymize the data of a visitor?

When you anonymize a conversation, we also recommend anonymizing the visitor associated with it. This way, you will delete the personal data contained in both the conversation and the visitor who initiated it. Here is an example of graphQL request accessible from your Apollo interface.

Operation

mutation VisitorAnonymize($visitorAnonymizeInput: VisitorAnonymizeInput!) {
 visitorAnonymize(visitorAnonymizeInput: $visitorAnonymizeInput) {
   visitor {
     id
   }
 }
}

Variables

{
 "visitorAnonymizeInput": {
   "id": "<your_visitor_id>"
 }
}

Response

{
 "data": {
   "visitorAnonymize": {
     "visitor": {
       "id": "74d51373-f091-4d5e-8826-009eeff9e4b3"
     }
   }
 }
}

Error

For example, when you try to anonymize a wrong Visitor ID.

{
 "errors": [
   {
     "extensions": {
       "name": "INVALID_ARGUMENT",
       "retryPolicy": "NO_RETRY"
     },
     "message": "Variable '$visitorAnonymizeInput' expected value of type 'VisitorAnonymizeInput!' but got: {\"id\":\"74d51373-f091-4d5e-8826-009eeff9e4bddfdsfdsf\"}. Reason: 'id' UUID expected (line 1, column 27):\nmutation VisitorAnonymize($visitorAnonymizeInput: VisitorAnonymizeInput!) {\n                          ^",
     "locations": [
       {
         "line": 1,
         "column": 27
       }
     ]
   }
 ]
}

The visitor ID present in GraphQL is not the same as the visitor ID displayed in the iAdvize administration (conversation log). It is therefore necessary to systematically use GraphQL to retrieve the visitor ID to be anonymized starting from the conversation and its ID (query `closedConversations`).

Last updated