POST
Authorization: ACCESS TOKEN Content-Type: application/json
Body
{ "customerData" : { "PROPERTY_TITLE" : "VALUE" }, "accountId": "ACCOUNT_ID", "templateId": "TEMPLATE_ID", "postSessionParams" : ["PARAMETERS"] }
curl -X POST \ https://open-api.morph.ai/v1/customer/wa/create \ -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImlkIjoiNWNhYzc3ZmNlMWE3NTQ2ZWQwZGIyMmMzIn0.eyJzY29wZSI6ImFwaSJ9.9q2QpFpzOepSf4KQmUDVvHUo07BxFzYdsxL_cn8Wm3w' \ -H 'Content-Type: application/json' \" -d '{ "accountId": "5cee6ca1c551ecb1d9df4e05", "templateId": "5cfdf714930d64f74e365823", "postSessionParams" : ["Test Name", "Test Email", "Temp Id"]
}'
{ "status" : "success" }
{
"userId": "USER_ID",
"widgetId": "WIDGET_ID",
"messages": [
{
"type": "statement",
"text": "Here is a sample response to user"
}
]
}
Property | Description | Required |
---|---|---|
widgetId | The widget id representing the id of the deployed webhook integration. | Y |
userId | Customer ID or user's phone number | Y |
URL: https://open-api.morph.ai/v1/message/send
Method: POST
Header
Authorization: ACCESS TOKEN Content-Type: application/json
{
"userId": "USER_ID",
"widgetId": "WIDGET_ID_HERE",
"messages": [
{
"type": "statement",
"text": "Here is a sample response to user"
}
]
}
Property | Description | Required |
---|---|---|
userId | The user id of the user to whom you want to send the message to. This is also received along with the message to the webhook. | Y |
widgetId | The widget id representing the id of the deployed webhook integration. Received along with the message to the webhook | Y |
messages | An array containing message object | Y |
Authorization: ACCESS TOKEN Content-Type: application/json
{ "customerData" : { "PROPERTY_TITLE" : "VALUE" }, "accountId" : "ACCOUNT_ID", "postSessionParams" : ["PARAMETERS"] }
Property | Description | Required |
---|---|---|
accountId | This is the ID of your ‘WhatsApp Account’.Request this id by sending an email on support@morph.ai | Y |
customerData | This is a key value pair of properties you want to update in the customer. The customer data will be updated as per the given new values of the property. The post-session message is then sent out, intrinsically using the new value of the properties. Note: The properties used in customerData should already exist on the system. You can check or create a new property here. | Optional |
postSessionParams | This is an ordered list of all the param values, appearing in the order in which the params appear in the Message Template. This has higher priority then customerData, hence these values will be used if both customerData and postSessionParams are included in the body. However, the customer object will be updated with the values in customerData. | Optional |
curl -X POST \ https://open-api.morph.ai/v1/customer/wa/create \ -H 'Authorization: <ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "customerData": { "Phone Number": "+919876543210" }, "accountId":"<ACCOUNT_ID>", "postSessionParams": ["Test Name", "Test Email", "Temp Id"] }'
{ "status": "success", "customer": { "createdTime": 1568113903575, "updatedTime": 1568113903575, "isDeleted": false, "bI": "morphaig84mnprv", "id": "5d7784ee278858527cbae2f9", "iOnbrdngDn": false, "interfaceAccounts": [ { "isDeleted": false, "id": "656f0bda4dde6c2c949c3292", "iOnbrdngDn": false, "channel": "smooch_whatsapp", "key": "smooch_whatsapp___656f0bda4dde6c2c949c3292", "lstPSTm": 0 } ], "iVPV": { "bl___isBlckd": false, "tx___lN": "", "cltx___bIAK": { "vs": [ "smooch_whatsapp___5ced1f6a44c59900103a6ced" ], "t": "Set" }, "tx___nm": "User - g1FQW0", "pn___pN": "+919876543210", "bl___isRU": false, "tx___fN": "User - g1FQW0", "tm___lMT": 1568113903291, "bl___iAs": false } } }
PUT
Authorization: ACCESS TOKEN Content-Type: application/json
{ "customerData" : { "PROPERTY_TITLE" : "VALUE" }, "accountId": "ACCOUNT_ID" }
Property | Description | Required |
---|---|---|
accountId | This is the ID of your ‘WhatsApp Account’.Request this id by sending an email on support@morph.ai | Y |
customerData | This is a key value pair of properties you want to update in the customer. The customer data will be updated as per the given new values of the property. The post-session message is then sent out, intrinsically using the new value of the properties. Note: The properties used in customerData should already exist on the system. You can check or create a new property here. | Optional |
curl -X PUT \ https://open-api.morph.ai/v1/customer/wa/create \ -H 'Authorization: <ACCESS_TOKEN>' \ -H 'Content-Type: application/json' \ -d '{ "customerData" : { "First Name" : "Vipul Test" }, "accountId":"<ACCOUNT_ID>" }'
{ "status": "success", "customer": { "createdTime": 1568113903575, "updatedTime": 1568114021072, "isDeleted": false, "bI": "morphaig84mnprv", "id": "5d7784ee278858527cbae2f9", "iOnbrdngDn": false, "interfaceAccounts": [ { "isDeleted": false, "id": "656f0bda4dde6c2c949c3292", "iOnbrdngDn": false, "channel": "smooch_whatsapp", "key": "smooch_whatsapp___656f0bda4dde6c2c949c3292", "lstPSTm": 0 } ], "iVPV": { "bl___isBlckd": false, "tx___lN": "", "cltx___bIAK": { "vs": [ "smooch_whatsapp___5ced1f6a44c59900103a6ced" ], "t": "Set" }, "tx___nm": "User - g1FQW0", "pn___pN": "+919876543210", "bl___isRU": false, "tx___fN": "Vipul Test", "tm___lMT": 1568113903291, "bl___iAs": false } } }