Chative logo

What is API Key?

An API Key is a unique identifier used to authenticate a user or developer when requesting to Chative's API, for example, to retrieve a list of contacts or update a contact's information.

Use the following steps to create a API Key.

  1. Go to Chative app
  2. On the sidebar, click to icon "Settings".
  3. On the dropdown menu, click to "developer".
  4. Click on Create API-Key.

How to use Chative.IO API?

  1. Go to API section in Chative to create an API Key.
  2. After creating the API Key, copy the secret key. Make sure that the API Key's status is currently active.
  3. Go back to this page, and click on the "Authorize". Paste the secret key to input
  4. Click on whichever API you want to use, and click on "Try it out"

How to find contact ID?

Contact ID
Go to Chative app. In the Contacts section, click on a contact. The contact ID will be shown under basic information as ID. “.

How to update contact information?

When working with the 'update contact' endpoint:
Please note that updates are only supported for specific fields, including:
  • firstName (e.g. Peter).
  • lastName (e.g. Parker).
  • email (e.g. 'user@example.com').
  • gender (e.g 'male').
  • birthday (e.g. 1028221200).
  • phone (e.g. 0123456789).
  • custom fields: (e.g: VIP - Very important person)

    custom-fields

Working with data type:
When working with the 'update contact' endpoint, only four data types are supported: text, number, date, and boolean (yes/no):
  • Text (e.g. 'VIP').
  • Number (e.g. 123).
  • Boolean (e.g. 'true' or 'false').
  • Date (we support both timestamp in milliseconds and ISO 8601 format, e.g. '2023-05-02T00:00:00+00:00').

What is webhook and how to use it?

Overview:
What is webhook?

Chative webhook is a method for observing changes that occur within your Chative application. When a new contact is created or when a field of a contact is updated, for example, if you have registered a webhook to listen, your registered URL will receive notifications of these changes.

Create a webhook:
Use the following steps to create a webhook.
  1. Go to Chative app
  2. On the sidebar, click to icon "Settings"
  3. On the dropdown menu, click to "developer"
  4. Click on Create webhook
  5. Add your webhook endpoint's HTTPS URL in Payload URL.
  6. Click Create
How do webhooks work:
When an event occurs in your app, Chative will send a message to every active Webhook:
  • The message is sent as a HTTP POST request to your webhook.
  • The request will be encoded as UTF-8.
  • The content type will be application/json.
  • The body of the request will therefore be a JSON object with the following properties:
    • _id: The unique identifier of the webhook payload.
    • event: The event that the webhook is sent for.
    • createdAt: The date and time the payload was created as a UNIX Timestamp.
    • deliveryAttempts: The number of times the payload has been sent.
    • firstSentAt: The date and time the payload was first sent as a UNIX Timestamp.
    • items: The 'items' field contains information about what the webhook payload does. If the webhook relates to a contact, the 'items' field will contain the contact object.
      Example: When you receive a webhook indicating that a contact has been updated, the 'items' field in the webhook payload will appear as shown below:
      • _id: The unique identifier of the contact.
      • object: The type of object, in this case, contact.
      • createdAt: The date and time this webhook payload was created as a UNIX Timestamp.
      • data : The field of the contact that have been updated.
    • infoWebhook: An object that contains the verifyToken property. Please refer to the "What is verify token?" section below for more information on this property.
Webhook requirement: Your webhook must meet the following requirements:
  • The webhook must be HTTPS (TLS).
  • The server should respond with HTTP 200 status code.
  • The server should accept any unexpected event type without returning an error.
What is verify token?
  • This is your secret key, which is usually optional when creating your webhook.
  • It is best to protect the endpoints which your webhooks invoke. This prevents unauthorized actions on your server, and better protects your users from any suspicious activity.
  • You should set a shared secret key on your webhook, which can be used to validate the request came from Chative.
Retries:
Chative will automatically attempt to resend a webhook if it does not receive a 200 status code as a response. Chative will retry the request up to five times, with a pause of 5 seconds between each retry. The webhook will continue to be retried until one of the following happens:
  • The webhook responds with a 200 status code, indicating a successful response.
  • The maximum number of retry attempts (5) is reached.
If the webhook fails to succeed after five attempts, it will be considered a failure, will not be retried again, and will be deactivated.
List of webhook deactivation reasons:
  1. The webhook was deactivated because we couldn't reach the webhook URL.
  2. The webhook was deactivated because the organization's plan was downgrade from business.
To reactivate a webhook, you can reactivate the webhook manually in the Chative app.