Sending WhatsApp Contact Cards via Haptik Bot

Overview

In this section, we will see how to enable the feature of sending WhatsApp contact cards via your Haptik bot and then, how to verify if the enablement for this feature has worked or not.

Prerequisites

We only require a Haptik Bot configured on WhatsApp channel.

Info

This message can only be sent in response to an incoming message from your customer.

Step 1: Define the JSON

Use the below JSON format as bot response on your bot to add WhatsApp Contact Cards on your bot. Use raw JSON HSL on the bot builder. Click here to learn more about it.

One can edit the required fields.

{
  "type": "WHATSAPP_CONTACT",
  "contacts": [
    {
      "addresses": [
        {
          "city": "Mumbai",
          "country": "India",
          "country_code": "IN",
          "state": "Maharashtra",
          "street": "Andheri",
          "type": "Home",
          "zip": "400099"
        }
      ],
      "birthday": "birthday",
      "emails": [
        {
          "email": "johndoe@personal.com",
          "type": "HOME"
        },
        {
          "email": "johndoe@work.com",
          "type": "WORK"
        }
      ],
      "name": {
        "first_name": "John",
        "formatted_name": "John Doe",
        "last_name": "Doe",
        "suffix": "Mr."
      },
      "org": {
        "company": "ABC Corp",
        "department": "Marketing",
        "title": "Director"
      },
      "phones": [
        {
          "phone": "9766094223",
          "wa_id": "9766094223",
          "type": "MAIN"
        },
        {
          "phone": "+34534",
          "type": "HOME"
        },
        {
          "phone": "+1121332",
          "type": "WORK"
        }
      ],
      "urls": [
        {
          "url": "https://someurl.com",
          "type": "WORK"
        }
      ]
    }
  ],
  "to": "919699579052",
  "recipient_type": "individual"
}

Parameters

Inside contacts, you can nest the following objects: addresses, emails, name, org, phone, and URLs. Pluralized objects are to be wrapped in an array as shown in the example below.

Name

Description

addresses

object

Optional.

Full contact address(es) formatted as an addresses object. The object can contain the following fields:

street string – Optional. Street number and name.

city string – Optional. City name.

state string – Optional. State abbreviation.

zip string – Optional. ZIP code.

country string – Optional. Full country name.

country_code string – Optional. Two-letter country abbreviation.

type string – Optional. Standard values are HOME and WORK.

birthday

Optional.

YYYY-MM-DD formatted string.

emails

object

Optional.

Contact email address(es) formatted as an emails object. The object can contain the following fields:

email string – Optional. Email address.

type string – Optional. Standard values are HOME and WORK.

name

object

Required.

Full contact name formatted as a name object. The object can contain the following fields:

formatted_name string – Required. Full name, as it normally appears.

first_name string – Optional*. First name.

last_name string – Optional*. Last name.

middle_name string – Optional*. Middle name.

suffix string – Optional*. Name suffix.

prefix string – Optional*. Name prefix.

*At least one of the optional parameters needs to be included along with the formatted_name parameter.

org

object

Optional.

Contact organization information formatted as an org object. The object can contain the following fields:

company string – Optional. Name of the contact's company.

department string – Optional. Name of the contact's department.

title string – Optional. Contact's business title.

phones

object

Optional.

Contact phone number(s) formatted as a phone object. The object can contain the following fields:

phone string – Optional. Automatically populated with the `wa_id` value as a formatted phone number.

type string – Optional. Standard Values are CELL, MAIN, IPHONE, HOME, and WORK.

wa_id string – Optional. WhatsApp ID.

urls

object

Optional.

Contact URL(s) formatted as URL object. The object can contain the following fields:

URL string – Optional. URL.

type string – Optional. Standard values are HOME and WORK.

Step 2: Check Your Response

Perform the operations as below on the linked WhatsApp number to check the response.


Can’t find what you’re looking for? Email us at support@haptik.ai.