(API) How to send features to specific Recipient(s)

This tutorial is in order to restrict the Recipients of the Container that can see this specific Feature. If none is selected, this Feature will be shown to all Recipient(s) of this Container.

1 - Create a Container:

Botdoc P2 Container is a session with multiple secure Features inside of it, with P2 you can make a Flow automation or just a simple file "push", "pull", “DocuSign” or “External URL”.

Endpoint: https://api.botdoc.io/v1/module_container/container/ 
Method: POST.

Example of the body in JSON format:

{ "page_type": "p2", "callback_url": "https://link.to.your.callback.url", "display_chat": true }

Example how to create a Container by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/container/" \ --header "Authorization: JWT <Authorization Token>" \ --header "Content-Type: application/json" \ --data-raw "{ "page_type": "p2", "callback_url": "https://link.to.your.callback.url", "display_chat": true }"

2 - Define Recipients (In this Case 2 or more Recipients):

After the Secure Container is created, you need to create two or more Recipients of your Secure Container.
Endpoint: https://api.botdoc.io/v1/module_container/container/{container_id}/recipient/
Method: POST.

2.1 - Creating the First Receiver

Example of the body in JSON format:

{ "first_name": "First", "last_name": "Receiver" }

Example how to create a Recipient by cURL:

2.1.1 - Creating the First Recipient Item for the First Receiver


Endpoint: https://api.botdoc.io/v1/module_container/recipient/{recipient_id}/recipient_item/
Method: POST.

Example of the body in JSON format:

Example how to create a Recipient Item by cURL:

2.2 - Creating the Second Receiver

Example of the body in JSON format:

Example how to create a Recipient by cURL:

2.2.1 - Creating the Second Recipient Item for the Second Receiver


Endpoint: https://api.botdoc.io/v1/module_container/recipient/{recipient_id}/recipient_item/
Method: POST.

Example of the body in JSON format:

Example how to create a Container by cURL:


3 - Take a look how your Recipients will look after the above actions:


4 - Define Email Message

Now, you must inform the Email Message if in the previewer step the transport method was sent to Email.
Endpoint: https://api.botdoc.io/v1/module_container/container/{container_id}/email/
Method: POST.

Example of the body in JSON format:

Example how to create an Email message by cURL:

5 - Define SMS Message

Now, you must inform the SMS Message if in the previewer step, the transport method was sent to SMS.
Endpoint: https://api.botdoc.io/v1/module_container/container/{container_id}/sms/
Method: POST.

Example of the body in JSON format:

Example how to create an SMS message by cURL:

6 - Add Features

Now, you must add a feature, can be Pull, Push, DocuSign or External URL, this example is a Pull:

6.1 - Pull Feature

If you want to request file(s) FROM your receiver, you must send a Pull Feature:
Endpoint: https://api.botdoc.io/v1/module_container_pull/pull/
Method: POST.

Example of the body in JSON format:

Example how to create a Pull Feature by cURL:


6.2 - Take a look how your Feature will look after the above actions:

7 - Add a Permission to the Recipient see the Feature created Above:

To add a permission for the Recipient to see this Feature created, you need to Post the information below:

Endpoint: https://api.botdoc.io/v1/module_container/featurerecipientpermission/
Method: POST.

Example of the body in JSON format:

Example how to Create a Permission to a Feature and Recipient by cURL:

7 - Remove a Permission to the Recipient see the Feature created Above:

To remove a permission for the Recipient to see this Feature created, you need to Delete the information below:

Endpoint: https://api.botdoc.io/v1/module_container/featurerecipientpermission/{id}/
Method: POST.

Example how to Delete a Permission to a Feature and Recipient by cURL:

8 - Send the Notification to the Receiver(s)

Now, send the Notification to the Receiver(s).
Endpoint: https://api.botdoc.io/v1/module_container/container/{container_id}/send_notification/
Method: POST.

Example how to send a notification by cURL:

 

For more details about creating a requests you can take a look at our Botdoc API Reference on api.botdoc.io/documentation/#create-request

Related articles