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
}
}'
import requests
import json
url = "https://api.amplifique.me/partners/cf/inApp"
headers = {
"Content-Type": "application/json",
"Authorization": "YOUR_API_KEY"
}
data = {
"name": "João da Silva",
"email": "joao@example.com",
"company": "Empresa Teste",
"phone": "+5542999999999",
"custom_fields": {
"regiao": "SUL",
"id": 12345
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.amplifique.me/partners/cf/inApp", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "YOUR_API_KEY"
},
body: JSON.stringify({
"name": "João da Silva",
"email": "joao@example.com",
"company": "Empresa Teste",
"phone": "+5542999999999",
"custom_fields": {
"regiao": "SUL",
"id": 12345
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "João da Silva",
"email": "joao@example.com",
"company": "Empresa Teste",
"phone": "+5542999999999",
"custom_fields": {
"regiao": "SUL",
"id": 12345
}
}`)
req, err := http.NewRequest("POST", "https://api.amplifique.me/partners/cf/inApp", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.amplifique.me/partners/cf/inApp')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'YOUR_API_KEY'
request.body = '{
"name": "João da Silva",
"email": "joao@example.com",
"company": "Empresa Teste",
"phone": "+5542999999999",
"custom_fields": {
"regiao": "SUL",
"id": 12345
}
}'
response = http.request(request)
puts response.body
{
"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"
}
}
/partners/cf/inApp
Target server for requests. Edit to use your own host.
API key (sent in header)
The media type of the request body
Nome do cliente
E-mail do cliente
Empresa do cliente
Telefone no padrão E.164
Campos customizados do cliente
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Body
Nome do cliente
E-mail do cliente
Empresa do cliente
Telefone no padrão E.164
Campos customizados do cliente
Responses
Se o cliente é elegível para ver e responder a pesquisa agora
Se o cliente já respondeu a métrica principal mas pode ainda complementar com comentário
Estrutura completa da pesquisa configurada
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).