Automate your lead generation process by integrating your external forms into MHub CRM.
Create a submission
Allows you to add a submission.
POST https://api.lead.mhub.my/submissions
Headers
Name |
Value |
Content-Type |
Either application/json or application/x-www-form-urlencoded |
x-api-key |
Required. A valid API key to make an API call |
Parameters
Name |
Type |
Description |
form_id |
string |
Required. The form ID generated when creating website channel in MHub CRM |
form_url |
string |
Required. The URL where the form is used to accept submissions. You can utilise this field to derive UTM data. |
form_name |
string |
Required. Recommend to be the same as the form Name generated when creating website channel in MHub CRM, unless there are two forms in the same URL |
name |
string |
Required. Name of the lead |
|
string |
Required. Email address of the lead (eg. sample@email.com) |
mobile_country_code |
string |
Required. Mobile country code of the lead (eg. MY). See here for all supported country code |
mobile |
string |
Required. Mobile number of the lead (eg. 126668888) |
source |
string |
Optional. The source where the form is submitted (eg. Website) |
project_ids |
array |
Optional. Project(s) selected by lead (eg. [xxxxx,xxxxx]) |
any |
integer or string |
Custom field. You can provide any additional fields that are already created in MHub CRM |
* See here for more standard fields
Example
{
"form_id": "2ab51d01-91c4-4b81-92a1-7f63a2071588",
"form_url": "https://example.com/forms/123",
"form_name": "Form XYZ",
"name": "John Smith",
"email": "john@example.com",
"mobile_country_code": "MY",
"mobile": "123456789",
"project_ids": ["bvc37ftrgnu4js2bhn10","cc34so701ic2itgbnfng"],
"gender": "male",
"age": 24
}
Response (Header)
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 0
Connection: close
Date: Wed, 28 Aug 2019 09:54:05 GMT
x-amzn-RequestId: c54e2776-c979-11e9-9649-dffe6781d0e3
x-amz-apigw-id: fIFRhFcOyQ0Fl1w=
x-Amzn-Trace-Id: Root=1-5d664f3c-78ec27eef5347a2a8a93834c;Sampled=0
X-Cache: Miss from cloudfront
Via: 1.1 ef90f11542c3d3e8c19ae090ce770731.cloudfront.net (CloudFront)
X-Amz-Cf-Pop: KUL50-C1
X-Amz-Cf-Id: xsw2X0hD2z9rJP9q1xh6tyLcDdrUQ3fkUCjQ0xyH5ahE9nZUuWbAqg==
Response (Body)
{
"id": "51bb5712-59c9-423d-9030-e4307740c968",
"form_url": "https://example.com/forms/123",
"form_name": "Form XYZ",
"name": "John Smith",
"email": "john@example.com",
"mobile_country_code": "MY",
"mobile": "123456789",
"project_ids": ["bvc37ftrgnu4js2bhn10","cc34so701ic2itgbnfng"],
"gender": "male",
"age": 24,
"status": "processing"
}
Test a submission
Other than logging in MHub CRM to validate your test submission, you may also send a GET request with a valid API key to check if your test submission was successful.
GET https://api.lead.mhub.my/submissions?id={SUBMISSION_ID_HERE}
* Replace {SUBMISSION_ID_HERE} with the return value of “ id ” in the API response.
Example
{
"campaign_id": "3d78e61f-b846-4cb7-a6d8-327c2580b6c0",
"company_branch_id": "a96dd434-2298-4ebf-ba6c-00a2ba6bb87d",
"company_id": "ffc07f3a-e0f9-5629-88f7-19bbad3a432c",
"created_at": "2022-12-14T07:33:33.316943727Z",
"id": "dd4e538f-8eb9-4cc5-904a-5b31ab5ecfad",
"error_message": "Submission has invalid email format",
"form_id": "2ab51d01-91c4-4b81-92a1-7f63a2071588",
"form_url": "https://example.com/forms/123",
"form_name": "Form XYZ",
"name": "John Smith",
"email": "john@example",
"mobile": "123456789",
"project_ids": ["bvc37ftrgnu4js2bhn10","cc34so701ic2itgbnfng"],
"gender": "male",
"age": 24
}
If you encounter an “ error_message ” in the response, refer to the recommended resolutions below:
Error messages |
Recommended resolutions |
Submission has invalid email format |
Make sure your email field has basic email validation |
Submission has invalid mobile format |
Mobile should be within 7 to 15 digits |
Submission has invalid project_ids format |
Make sure your project_ids data is in an array format |
Submission has invalid bumi format |
Check here for accepted values of “bumi” field |
Submission has invalid form_url format |
Make sure your form_url has basic URL validation |
Submission has missing field {field_name} (eg. mobile) |
Make sure to pass in value to the required fields |
Missing date_of_birth format mapping |
Make sure date_of_birth field is mapped in your website channel in MHub CRM |
Unmatched date_of_birth format by corresponding field format mapping |
Make sure the date_of_birth format passed in matches the format set in your website channel in MHub CRM |