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:

curl -i --request POST "https://api.botdoc.io/v1/module_container/container/{container_id}/recipient/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
   "first_name": "First",
   "last_name": "Receiver"
}
"

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:

{
   "interface_class": "email", //can be "email" or "sms"
   "value": "first_receiver@botdoc.io"
}

Example how to create a Recipient Item by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/recipient/{recipient_id}/recipient_item/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
   "interface_class": "email",
   "value": "first_receiver@botdoc.io"
}
"

2.2 - Creating the Second Receiver

Example of the body in JSON format:

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

Example how to create a Recipient by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/container/{container_id}/recipient/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
   "first_name": "Second",
   "last_name": "Receiver"
}
"

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:

{
   "interface_class": "sms", //can be "email" or "sms"
   "value": "000000000000"
}

Example how to create a Container by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/recipient/{recipient_id}/recipient_item/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
   "interface_class": "sms",
   "value": "000000000000"
}
"


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:

{
    "subject": "nice subject",
    "body": "a nice message here"
}

Example how to create an Email message by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/container/{container_id}/email/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
    "subject": "nice subject",
    "body": "a nice message here"
}"

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:

{
    "body": "a nice body here"
}

Example how to create an SMS message by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container/container/{container_id}/sms/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
    "body": "a nice body here"
}"

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:

{
    "container": {container_id},
    "title": "Nice Pull Title",
    "description": "Nice Pull Desc."
}

Example how to create a Pull Feature by cURL:

curl -i --request POST "https://api.botdoc.io/v1/module_container_pull/pull/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
    "container": {container_id},
    "title": "Nice Pull Title",
    "description": "Nice Pull Desc."
}"


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:

{
    "feature":{feature_id},
    "recipient":{recipient_id}
}

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

curl -i --request POST "https://api.botdoc.io/v1/module_container/featurerecipientpermission/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw "{
    "feature":{feature_id},
    "recipient":{recipient_id}
}"

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:

curl -i \
--request DELETE "https://api.botdoc.io/v1/module_container/featurerecipientpermission/{id}"\
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json"

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:

curl -i \
--request POST "https://api.botdoc.io/v1/module_container/container/{container_id}/send_notification/" \
--header "Authorization: JWT <Authorization Token>" \
--header "Content-Type: application/json" \
--data-raw ""

 

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

The content by label feature displays related articles automatically, based on labels you choose. To edit options for this feature, select the placeholder below and tap the pencil icon.