@simpleview/crm-client

Client for communicating with sv-crm

Usage no npm install needed!

<script type="module">
  import simpleviewCrmClient from 'https://cdn.skypack.dev/@simpleview/crm-client';
</script>

README

sv-crm-client

Client and tools for communicating with sv-graphql and crm-graphql-server.

installation

npm install @simpleview/sv-crm-client

crm_query

For all queries, a bearer token must be proved in Authorization header. To acquire your token, you must login first to get the token:

{
    auth {
        login(email: String!, password: String!) {
            success
            token
        }
    }
}
```

For all queries, acct_id must be passed at the root.
```
{
    crm(acct_id: String!) {
        ...
    }
}
```

- **get_contact**
- Returns an array of contacts, which can be filtered by recId.
- See schema browser for all fields.
```
query getContact {
    crm(acct_id: String!) {
        get_contact(filter: {
            recId: Int
        }) {
            recId
            FirstName
            LastName
            Email {
                EmailAddress
            }
        }
    }
}
```

## crm_mutation

For all mutations, a bearer token must be proved in Authorization header. To acquire your token, you must login first to get the token:
```
{
    auth {
        login(email: String!, password: String!) {
            success
            token
        }
    }
}
```

For all mutations, acct_id must be passed at the root.
```
{
    crm(acct_id: String!) {
        ...
    }
}
```

- **set_contact**
- Sets a contact, and returns the ID
- See schema browser for all possible inputs.
```
mutation setContact {
    crm(acct_id: String!) {
        set_contact(input: {
            FirstName: "test",
            LastName: "user",
            Email: [
                {
                    type: "contact",
                    EmailAddress: "test@test.com"
                }
            ]
        })
    }
}
```