Flock Connect Contact API


APIs to create campaigns with individual WhatsApp users. Each API is used to create a campaing for different message types (Image, text, video, URL and documents).

Overview

Parameters 'token','message','title' and 'number_details' are mandatory parameters.

- token: Unique access token provided to the user at sign-up.
- message: Raw text intended to send.
- title: Title of the Flock Connect campaign.
- number_details: List of numbers with the user’s name to send the campaign to.

Optional parameters

- file: text/link/image/video/any file type to be sent.
- metadata content: image and title with URLs.

Response Status Code

- 200: Success
- 400: Failure. (Missing parameters/wrong file formats/Plugin not connected)
POST Image
https://api.flocksend.com/api/connect/contact/image

An API to send images to users in a particular campaign.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 {"name":"Nishant","phone":"918892043629"}]',
"image": "ImageFile.jpg"
}
POST Text Message
https://api.flocksend.com/api/connect/contact/text

An API to send text message to users in a particular campaign.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]'
}
POST Video
https://api.flocksend.com/api/connect/contact/video

An API to send videos to users in a particular campaign

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
"video": "VideoFile.mp4"
}
POST Document
https://api.flocksend.com/api/connect/contact/file

An API to send files to users in a particular campaign.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample Text Message",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
"file": "File.pdf"
}
Example Request
Default

Example Response
200
{
  "status": "success",
   "message": "Successfully created and sending messages"
}


Example Request
Default
curl --request POST \
  --url https://api.flocksend.com/api/connect/contact/text \
  --data '{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]'
}
'

Example Response
200
{
  "status": "success",
   "message": "Successfully created and sending messages"
}


Example Request
Default
curl --request POST \
  --url https://api.flocksend.com/api/connect/contact/link \
  --data '{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
"image": "ImageFile.jpg"
            "link": "www.someurllink.com"
"link_title": "Sample Website"

}
'

Example Response
200
{
  "status": "success",
   "message": "Successfully created and sending messages"
}


Example Request
Default

Example Response
200
{
  "success": 1
}


Example Request
Default
curl --request POST \
  --url https://api.flocksend.com/api/connect/contact/file \
  --data '{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample Text Message",
	"title": "Sample Campaign Title"
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
"file": "File.pdf"
}
'

Example Response
200
{
  "status": "success",
   "message": "Successfully created and sending messages"
}


Flock Connect SMS API


APIs to send messages to Contacts.

Overview

Parameters 'token', 'sender_id', 'message', 'number_details' are mandatory parameters.

- token: Unique access token provided to the user.
- sender_id:
- message: Message to be sent
- number_details: List of numbers with the user’s name to send the campaign to.

Response Status Code

- 200: Success (Your message has been sent successfully)
- 400: Failure. (Missing parameters/wrong file formats/Plugin not connected)
POST Text Message
https://flocksend.com/api/connect/official/sms

An API to send text message to users.

BODY

{
	"token": "c0****91-1**e-4**d-8**2-*******2a",
        "sender_id": "FLK******",
	"message": "Sample text message.",
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
        "type": "message type (specifies url toggle).",
        "sms_language": "language (en).",
}
RESPONSE

{
	"code": "200",
        "message": "Your SMS has been sent successfully.",
        “data”:[{"sms_id":"2*8**7","number":"919534785974","response_desc":"DELIVERED","response_status":"delivered","response_date":"2020-06-02 16:20:38"},
 	{"sms_id":"2*8**8","number":"918892043629","response_desc":"DELIVERED","response_status":"delivered","response_date":"2020-06-02 16:20:38"}]
}
POST Text Message (Link Tracking)
https://flocksend.com/api/connect/official/sms

An API to send text message to users with link tracking.

BODY

{
	"token": "c0****91-1**e-4**d-8**2-*******2a",
        "sender_id": "FLK******",
	"message": "Sample text message. Click here {url}",
“number_details”:
'[{"name":"Arjun","phone":"919534785974"},
 	{"name":"Nishant","phone":"918892043629"}]',
        "type": "message type (specifies url toggle).",
        "sms_language": "language (en).",
        "redirect_url": "https://www.facebook.com/"
}
RESPONSE

{
	"code": "200",
        "message": "Your SMS has been sent successfully.",
        “data”:[{"sms_id":"2*8**7","number":"919534785974","ip_address":"157.45.185.188","country_code":"IN","state_name":"Karnataka","location":"Bengaluru","latitude":"12.9719","longitude":"77.5937","device_type":"Web (Windows 10)","browser_type":"Chrome"}]
}

Flock Connect Email API


APIs to send emails to Users.

Overview

Parameters 'token', 'message', 'subject', 'email_details' are mandatory parameters.

- token: Unique access token provided to the user.
- message: Message to be sent
- subject: Subject for email
- email_details: List of emails with the user’s name to send the campaign to.

Response Status Code

- 200: Success (Your email has been sent successfully)
- 400: Failure. (Missing parameters/wrong file formats/Plugin not connected)
POST Text Message
https://flocksend.com/api/connect/official/email

An API to send email to users.

BODY

{
	"token": "c0****91-1**e-4**d-8**2-*******2a",
        "subject": "Subject for email",
	"message": "Sample email body.",
“email_details”:
'[{"name":"Arjun","email":"arjun@aiyolabs.com"},
 	{"name":"Nishant","email":"nishant@aiyolabs.com"}]',
}
RESPONSE

{
	"code": "200",
        "message": "Your email has been sent successfully.",
“data”:[{"email_id":"4**0","email":"arjun@aiyolabs.com"},
 	{"email_id":"4**1","email":"nishant@aiyolabs.com"}],
}
POST Attachment
https://flocksend.com/api/connect/official/email

An API to send email with attachment to users.

BODY

{
	"token": "c0****91-1**e-4**d-8**2-*******2a",
        "subject": "Subject for email",
	"message": "Sample email body.",
“email_details”:
'[{"name":"Arjun","email":"arjun@aiyolabs.com"},
 	{"name":"Nishant","email":"nishant@aiyolabs.com"}]',
        "attachment_url": "https://flocksend.com/chat-bot/assets/images/flocksend-dark.png",
}
RESPONSE

{
	"code": "200",
        "message": "Your email has been sent successfully.",
“data”:[{"email_id":"4**0","email":"arjun@aiyolabs.com"},
 	{"email_id":"4**1","email":"nishant@aiyolabs.com"}],
}
POST Attachment (Link Tracking with notification on open)
https://flocksend.com/api/connect/official/email

An API to send email with attachment and url tracking to users.

BODY

{
	"token": "c0****91-1**e-4**d-8**2-*******2a",
        "subject": "Subject for email",
	"message": "Sample email body.",
“email_details”:
'[{"name":"Arjun","email":"arjun@aiyolabs.com"},
 	{"name":"Nishant","email":"nishant@aiyolabs.com"}]',
        "attachment_url": "https://flocksend.com/chat-bot/assets/images/flocksend-dark.png",
        "notify_me_on_open": "1",
        "redirect_url": "https://www.facebook.com/",
        "url_name": "Click Here",
}
RESPONSE

{
	"code": "200",
        "message": "Your email has been sent successfully.",
“data”:[{"email_id":"4**0","email":"arjun@aiyolabs.com","ip_address":"157.45.185.188","country_code":"IN","state_name":"Karnataka","location":"Bengaluru","latitude":"12.9719","longitude":"77.5937","device_type":"Web (Windows 10)","browser_type":"Chrome"}]
}

Flock Listen Webhook


Our webhook helps you integrate WhatsApp messages to your product. Here's what you need to get started on it.

HOW?

We redirect the information of received WhatsApp message to a URL you provide. Simply paste your URL in your 'Webhook Settings' and turn on the Webhook status. For every record read in Flock Listen, one API hit is made to your URL.

FALLBACK

In case you have an incorrect/damaged URL, we won't be able to hit it. Five retries are made after which in case of failure, your Webhook URL will be deactivated and you will receive an E-mail regarding this.

User can modify and re-activate the URL.

PARAMETERS

Your webhook URL will be hit with the following JSON parameters:

V1 Webhook Response for Session and HSM messages

                            
        { id: "********", status: "accepted", date: "2020-06-12T07:23:29.749655Z"}
        { id: "********", status: "delivered", date: "2020-06-12T07:23:30Z"}
        { id: "********", status: "seen", date: "2020-06-12T07:24:34Z"}
                            
                        
V2 Webhook Response for Session messages

                            
        { id: "********", status: "delivered", date: "2020-06-15T05:14:02Z"}
        { id: "********", status: "seen", date: "2020-06-15T05:14:51Z"}
                            
                        
V2 Webhook Response for HSM messages

                            
        { id: "********", status: "accepted", date: "2020-06-15T05:22:13.657027Z"}
        { id: "********", status: "delivered", date: "2020-06-15T05:22:14Z"}
        { id: "********", status: "seen", date: "2020-06-15T05:22:23Z"}
                            
                        
SMS Delivery Response

                            
        { "sms_id": "********", number: "919534785974", response_desc: "DELIVERED", response_status: "delivered", date: "2020-06-02 16:20:38"}
                            
                        
SMS Click Tracking Response

                            
        { "sms_id": "********", number: "919534785974", ip_addresses: "157.45.185.188", country_code: "IN", state_name: "Karnataka", location: "Bengaluru", latitude: "12.9719", longitude: "77.5937", device_type: "Web (Windows 10)", browser_type: "Chrome"}
                            
                        
Email Click Tracking Response

                            
        { "email_id": "********", email: "arjun@aiyolabs.com", ip_addresses: "157.45.185.188", country_code: "IN", state_name: "Karnataka", location: "Bengaluru", latitude: "12.9719", longitude: "77.5937", device_type: "Web (Windows 10)", browser_type: "Chrome"}
                            
                        
Listen Webhook (Text Message)

                            
        { "message_id": "****************", message: "Hi, How are you?", phone_number: "91**********", media_type: "text", date: "2020-06-17", time: "17:18:19", user_id: "***************"}
                            
                        
Listen Webhook (Media Message)

                            
        { "message_id": "*************", message: "Hi, How are you?", phone_number: "91**********", media_type: "image", media_link: "\/assets\/OfficialMedia\/Images\/159239457411036100065eea034e6cbae.jpg", date: "2020-06-17", time: "17:19:34", user_id: "****************"}
                            
                        

Flock Connect Group API


Set of APIs to add campaign with different message inputs - text, file, video, image and URL links.

Every API authenticates and validates user by their access token.

Response Status Codes

- 200: Success
- 400: Failure (Missing parameters or incorrect file format)
POST Image
https://api.flocksend.com/api/connect/group/image

An API to send images to WhatsApp group chats.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
            "group_id": "["group1","group2","group3"]"
"image": "ImageFile.jpg"
}
POST Text Message
https://api.flocksend.com/api/connect/group/text

An API to send text to WhatsApp group chats.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
            "group_id": "["group1","group2","group3"]"
}
POST Video
https://api.flocksend.com/api/connect/group/video

An API to send videos to WhatsApp group chats.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
            "group_id": "["group1","group2","group3"]"
"video": "VideoFile.mp4"
}
POST Document
https://api.flocksend.com/api/connect/group/file

An API to send a file to WhatsApp group chats.

BODY

{
	"token": "5bebaee99cf858690b41dc74",
	"file_name": "Name of File",
	"title": "Sample Campaign Title"
            "group_details": "["group1","group2","group3"]"
"file": "File.pdf"
}
Example Request
Default

Example Response
200
{
  "success": 1
}


Example Request
Default
curl --request POST \
  --url https://aiyolabs.com/api/create-campaign/group/text \
  --data '{
	"token": "5bebaee99cf858690b41dc74",
	"message": "Sample text message.",
	"title": "Sample Campaign Title"
            "group_id": "["group1","group2","group3"]"
}
'

Example Response
200
{
  "success": 1
}


Example Request
Default

Example Response
200
{
  "success": 1
}


Example Request
Default

Example Response
200
{
  "success": 1
}


Example Request
Default
Example Response
200
{
  "success": 1
}