Attentive’s APIs allow you as a developer to integrate with the Attentive platform and build custom applications. Use our numerous endpoints to manage user subscriptions, trigger messages related to user actions, save subscriber attributes, and send personalized text messages.
npm add @attentive/sdk
yarn add @attentive/sdk
Authentication To keep data on Attentive’s platform safe and secure, all apps connecting with Attentive’s APIs must authenticate when making API requests. This article describes the different methods of authenticating and authorizing apps with Attentive’s platform.
Types of authentication Different types of apps require different authentication or authorization methods:
Private apps use basic HTTP authentication. Public apps use OAuth 2.0.
HTTP authentication Private applications can authenticate through basic HTTP authentication by using their API key as the Bearer Token when making calls to Attentive’s APIs. To generate a unique API key, you must create an app in the Attentive platform. You should treat your API key as a password. If it is accidentally shared, other users may be able to send messages to customers on your behalf. Use the /me endpoint to verify that you are authenticating correctly.
For a GraphQL API example:
curl --location --request POST 'https://api.attentivemobile.com/v1/graphql' \
--header 'Authorization: Bearer <Unique API Key>' \
--header 'Content-Type: application/json' \
--data-raw '{"query":"\nquery {\n viewer {\n installedApplication {\n installerCompany {\n id\n name\n }\n }\n }\n}\n\n","variables":{}}'
For a REST API example:
curl 'https://api.attentivemobile.com/v1/me' \
-X GET \
-H 'Authorization: Bearer <Unique API Key>' \
-H 'Content-Type: application/json' \
Note: If you are unable to access the Attentive platform, please send an email to api-tokens@attentivemobile.com for access.
import { SDK, withSecurity} from "@attentive/sdk";
import { CreateTokenViaAuthorizationCodeRequest, CreateTokenViaAuthorizationCodeResponse } from "@attentive/sdk/src/sdk/models/operations";
import { AxiosError } from "axios";
const sdk = new SDK(withSecurity(
security: {
oAuthFlow: {
authorization: "Bearer YOUR_ACCESS_TOKEN_HERE",
},
}
));
const req: CreateTokenViaAuthorizationCodeRequest = {
request: {
clientId: "sit",
clientSecret: "voluptas",
code: "culpa",
grantType: "expedita",
redirectUri: "consequuntur",
},
};
sdk.accessToken.createTokenViaAuthorizationCode(req).then((res: CreateTokenViaAuthorizationCodeResponse | AxiosError) => {
// handle response
});
createTokenViaAuthorizationCode
- Access Token
postCustomAttributes
- Custom Attributes
postCustomEvents
- Custom Events
identify
- Add a client user identifier or custom identifier(s) to a user
addDeleteRequest
- Sending a request to this endpoint will delete a subscriber in accordance with CCPA regulations within thirty days provided the call was successful.getDeleteRequest
- Get a CCPA delete request by Id
getUploads
- View Recent Catalog UploadslookupUpload
- Lookup Product Catalog IngestionpostUpload
- Upload Product Catalog
addSubscriptions
- Subscribe usergetSubscriptions
- Get subscription eligibility for a userunsubscribeSubscriptions
- Unsubscribe subscriptions for a user
getMe
- Me
createWebhook
- Create webhookdeleteWebhook
- Delete webhookgetWebhooks
- List webhooksupdateWebhook
- Update webhook
postAddToCartEvents
- Add to cartpostProductViewEvents
- Product viewpostPurchaseEvents
- Purchase