Skip to content

Commit

Permalink
📝 Update docs quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
rflihxyz committed Aug 31, 2024
1 parent 59a781a commit 74aaf48
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 79 deletions.
Binary file added docs/images/connections_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 32 additions & 79 deletions docs/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,127 +36,80 @@ Let's now create our first magic link!
it.
</Step>
<Step>Click `Generate`</Step>
</Steps>


Once the user successfully completes the granting auth flow, the connection will have a `status` value of `valid`.
<Step>Now, for the purpose of this tutorial, open the magic link you just created and login using the Hubspot account you previously created</Step>
</Steps>

## Step 2: Grab the connection token

Connection tokens are the way Panora represents a third party's account, whatever the underlying identification mechanism is.
There are two ways to get these tokens: catchting them with a webhook, or just finding them in your dashboard. For now, we'll stick to the dashboard,.

Let's find the `connection token` in the dashboard.

ADD SCREEN HERE
To find the `connection token` in the dashboard, visit the `connections` section. Copy the connection token from its column and save it.
![title](/images/connections_screen.png)

## **Step 3: Make your first API requests**

Let's Create a contact in our Hubspot acccount, using Panora's API.
Let's list the contacts that are in the Hubspot acccount, using Panora's API.

This will require you to have:
- The `connection token` from the previous step
- An API key (guide [here](/core-concepts/auth#learn-how-to-generate-your-api-keys))
- You don't need to create contacts, since Hubspot accounts come with mockup contacts included.

The API key identifies _YOU_ as a user of Panora, while the connection token identifies which user's account you behalf you want to. In the future, you will have one connection token per user account connected on the Panora platform, while keeping one API key.

You can copy past the Curl example below, and copy-paste it in your terminal. Don't forget to replace the API key and the connection token.

In this example, we will create a contact in a CRM. Visit other sections of the [documentation](/api-reference/introduction) to find category-specific examples.
<CodeGroup>
```javascript TypeScript
```shell curl
curl --location 'http://localhost:3000/crm/contacts' \
--header 'x-connection-token: 7e6b9454-f616-477a-a71a-0f23eb74a72c' \
--header 'x-api-key: sk_dev_30a78556-6a83-425x-b461-a87f007a09e1'
```

```javascript TypeScript SDK (alpha)
import { Panora } from "@panora/sdk";

const panora = new Panora({
apiKey: process.env.API_KEY,
});

const input = {
first_name: 'tom',
last_name: 'jedusor',
email_addresses: [
{
'email_address': '[email protected]',
'email_address_type': 'PERSONAL'
}
],
phone_numbers: [
{
'phone_number': '+33650438278',
'phone_type': 'MOBILE'
}
],
};

const result = await panora.crm.contacts.create({
xConnectionToken: "YOUR_USER_CONNECTION_TOKEN",
unifiedCrmContactInput: input,
const result = await panora.crm.contacts.list({
xConnectionToken: "YOUR_USER_CONNECTION_TOKEN"
});

console.log(result);
for await (const page of result) {
// handle page
}
```

```python Python
```python Python SDK (alpha)
import os
from panora_sdk import Panora

panora = Panora(
api_key=os.getenv("API_KEY", ""),
)

body = {
'first_name': 'tom',
'last_name': 'jedusor',
'email_addresses': [
{
'email_address': '[email protected]',
'email_address_type': 'PERSONAL'
}
],
'phone_numbers': [
{
'phone_number': '+33650438278',
'phone_type': 'MOBILE'
}
]
}
res = panora.crm.contacts.list(x_connection_token="YOUR_USER_CONNECTION_TOKEN")

res = panora.crm.contacts.create(x_connection_token="YOUR_USER_CONNECTION_TOKEN", unified_crm_contact_input=body)
if res is not None:
while True:
# handle items

print(res)
```

```shell curl
curl --request POST \
--url https://api.panora.dev/crm/contacts \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-connection-token: <MY_USER_CONNECTION_TOKEN>' \
--data '{
"first_name": "tom",
"last_name": "jedusor",
"email_addresses": [
{
"email_address": "[email protected]",
"email_address_type": "PERSONAL"
}
],
"phone_numbers": [
{
"phone_number": "+33650438278",
"phone_type": "MOBILE"
}
]
}'
res = res.Next()
if res is None:
break
```
</CodeGroup>

Let’s break down what’s happening here:
Let’s break down what we did in this tutorial:


- We import the `Panora` sdk, which provides a convenient way to interact with the Panora Unified API.
- We create an instance of the `Panora` client, passing in our API key.
- We call the `panora.crm.contacts.create` method to add a contact inside a 3rd party. We specify the input we want to use (see [here](/crm/contacts/overview) for reference).
- We pass the connection token catched during step 1 ([More info here](/core-concepts/auth#catch-connection-tokens))
- Finally, we print the response.
- We created a Magic Link to let a user grant us access to its account
- After he connected its account, Panora synced data with Hubspot
- We used a `connection token` and our Panora API key to make our first request to the Panora API

## Suggested Next Steps

Expand Down

0 comments on commit 74aaf48

Please sign in to comment.