InApp (Sistemas Legados)Buscar Pesquisa InApp

Buscar Pesquisa InApp Elegível

Busca se existe uma pesquisa a ser exibida para um cliente no canal InApp (Sistemas Legados). Retorna: 'eligible' (se o cliente é elegível para ver a pesquisa agora); 'complementSurvey' (se ele já respondeu a métrica principal mas pode deixar comentário); 'survey' (estrutura completa da pesquisa com perguntas, cores e automações); 'surveyAnswer' (objeto da sessão — o '_id' dele deve ser usado nos endpoints de Enviar Resposta e Ignorar Pesquisa).

curl -X POST "https://api.amplifique.me/partners/cf/inApp" \
  -H "Content-Type: application/json" \
  -H "Authorization: YOUR_API_KEY" \
  -d '{
  "name": "João da Silva",
  "email": "joao@example.com",
  "company": "Empresa Teste",
  "phone": "+5542999999999",
  "custom_fields": {
    "regiao": "SUL",
    "id": 12345
  }
}'
{
  "message": "OK",
  "eligible": true,
  "complementSurvey": false,
  "survey": {
    "_id": "60e336ef69a03a000e20164d",
    "title": "Pesquisa InApp",
    "anonymous": false,
    "active": true,
    "draft": false,
    "archived": false,
    "primary_color": "#ffca00",
    "button_text_color": "#ffffff",
    "smartTagsEnabled": true,
    "survey_logo": "https://cdn.filestackcontent.com/SPQDJyczSjGTbxYbjgeV",
    "channels": [
      "inapp",
      "link-qrcode"
    ],
    "questions": [
      {
        "_id": "example_string",
        "type": "nps",
        "internal_name": "nps_1",
        "pre_text": "Gostaríamos de saber a sua opinião!",
        "unlikely_text": "Pouco provável",
        "likely_text": "Muito provável",
        "accept_others": false,
        "isTextArea": false,
        "options": "null",
        "required": false,
        "variations": [
          {
            "_id": "example_string",
            "condition": null,
            "question": "Em uma escala de 0 a 10, qual a probabilidade de recomendar nossa empresa?",
            "placeholder": null,
            "show": false
          }
        ]
      }
    ],
    "thankyou_page": {
      "skip": false,
      "url_to_skip": "",
      "variations": [
        {
          "_id": "example_string",
          "condition": null,
          "message": "Obrigado por responder nossa pesquisa!"
        }
      ]
    },
    "inapp_params": {
      "first_survey": 40,
      "dismiss_resurvey_throttle": null,
      "observation_resurvey_limit": 7,
      "time_delay": null
    },
    "automations": [
      {
        "_id": "example_string",
        "condition": "nps_1,maior,8",
        "action": "referral_on_screen",
        "type": "true",
        "params": {
          "referralCampaign": "5f888e037e4ec0000e91f12b"
        }
      }
    ],
    "_business": {
      "_id": "5b5765bec9498b0014883c0b",
      "_empresa": "59c94ff5e5b20500126eadde"
    },
    "created_at": "2024-12-25T10:00:00Z",
    "updated_at": "2024-12-25T10:00:00Z"
  },
  "surveyAnswer": {
    "_id": "61ddbce5b038c4c87c78b9b4",
    "_survey": "60e336ef69a03a000e20164d",
    "channel": 4,
    "sent_at": "2022-01-11T17:22:45.150Z",
    "opened_at": "2022-01-11T17:22:45.150Z",
    "origin": "API",
    "anonymized": false,
    "_customer": "616ef4659ce878549d16c718",
    "_business": "5b5765bec9498b0014883c0b",
    "_smartTags": [
      "example_string"
    ],
    "billing_restriction": true,
    "answers": [
      {}
    ],
    "created_at": "2022-01-11T17:22:45.154Z"
  }
}
POST
/partners/cf/inApp
POST
API Key (header: Authorization)
Authorizationstring
Required

API key (sent in header)

Content-Typestring
Required

The media type of the request body

Options: application/json
namestring
Required

Nome do cliente

emailstring
Required

E-mail do cliente

companystring

Empresa do cliente

phonestring

Telefone no padrão E.164

custom_fieldsobject

Campos customizados do cliente

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

API Key for authentication. Provide your API key in the header.

Body

application/json
namestring
Required

Nome do cliente

emailstring
Required

E-mail do cliente

companystring

Empresa do cliente

phonestring

Telefone no padrão E.164

custom_fieldsobject

Campos customizados do cliente

Responses

messagestring
eligibleboolean

Se o cliente é elegível para ver e responder a pesquisa agora

complementSurveyboolean

Se o cliente já respondeu a métrica principal mas pode ainda complementar com comentário

surveyobject

Estrutura completa da pesquisa configurada

surveyAnswerobject

Objeto da pesquisa-resposta criado para esta sessão. O _id deste objeto deve ser passado nos endpoints de Enviar Resposta (PUT /partners/cf/inApp/(id)) e Ignorar Pesquisa (PATCH /partners/cf/inApp/(id)/decline).