# API - Criando Lead e Oportunidade ao mesmo tempo

O exemplo do vídeo está utilizando uma planilha do Google enviando dados para a API da SprintHub via método HTTP utilizando a plataforma [https://Make.com](https://make.com/?ref=docs.sprinthub.com), no entanto, o mesmo procedimento pode ser feito usando outras plataformas similares como Zapier ou N8N. Basta adaptar a cada plataforma.

Assista ao vídeo e depois utilize as informações abaixo para configurar o seu.

<mark style="color:red;">**ATENÇÃO**</mark>: Este é um procedimento para usuários avançados que possuam conhecimentos mínimos em métodos HTTP, webservices, e configurações de API.

{% embed url="<https://www.youtube.com/watch?v=xh3MWSBZXYE>" %}

Exemplo de URL para adicionar ao Make.com ou Zapier ou similares:

<https://sprinthub-api-master.sprinthub.app/api/queue?i=SUAINSTANCIA>

Altere os dados abaixo conforme sua preferência.

```json
{
    "endpoints": [
        {
          "url": "https://sprinthub-api-master.sprinthub.app/leads",
          "method": "POST",
          "body": {
            "firstname": "VARIAVEL 1",
            "lastname": "VARIAVEL 2",
            "email": "VARIAVEL 3",
            "whatsapp": "VARIAVEL 4" 
          }
        },
        {
          "url": "https://sprinthub-api-master.sprinthub.app/crmopportunity?id=33",
          "method": "POST",
          "body": {
            "crm_column": 39,
            "lead_id": "{result0.id}",
            "status": "open",
            "sequence": 0,
            "title": "FormGoogle {result0.firstname} {result0.lastname}",
            "value": 1500,
            "user": 140,
            "sprint_permission": "all",
            "sprint_permission_user": "",
            "sprint_permission_users": [],
            "sprint_permission_departments": []
          }
        }
    ]
}
```

Lembrando que dentro do objeto "endpoints" você terá duas chamadas, uma para LEADS e outra para OPORTUNIDADE.

**IMPORTANTE**: Em alguns casos, você terá que minificar o JSON, caso contrário, ao COLAR o texto no Make, ele pode ir com "sujeiras".

Utilize o site: <https://codebeautify.org/jsonminifier>

O JSON acima, minificado, ficaria assim:

```json
{"endpoints":[{"url":"https://sprinthub-api-master.sprinthub.app/leads","method":"POST","body":{"firstname":"VARIAVEL 1","lastname":"VARIAVEL 2","email":"VARIAVEL 3","whatsapp":"VARIAVEL 4"}},{"url":"https://sprinthub-api-master.sprinthub.app/crmopportunity?id=33","method":"POST","body":{"crm_column":39,"lead_id":"{result0.id}","status":"open","sequence":0,"title":"FormGoogle {result0.firstname} {result0.lastname}","value":1500,"user":140,"sprint_permission":"all","sprint_permission_user":"","sprint_permission_users":[],"sprint_permission_departments":[]}}]}
```

Abaixo, um **exemplo** de como ficou usando o Make.com

<figure><img src="/files/4oAynd9isTpEBxnCsGWy" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.sprinthub.com/content/images/2023/07/Captura-de-Tela-2023-07-11-a-s-18.44.44.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sprinthub.com/topicos/api/api-criando-lead-e-oportunidade-ao-mesmo-tempo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
