Built and tested. The public service opens with the platform launch; until then API keys are not issued to customers.
WordPress forms
There is no WordPress plugin yet (see the Roadmap). These form plugins expose standard hooks, so a small snippet connects them today. Put the key in wp-config.php: define('EASYTAWASUL_API_KEY', 'ez_live_...');.
add_action('gform_after_submission', function ($entry, $form) {
easytawasul_send_template(rgar($entry, '3'), rgar($entry, '1'), 'gf-' . $entry['id']); // field IDs 3 = phone, 1 = name
}, 10, 2);
Elementor Pro forms
add_action('elementor_pro/forms/new_record', function ($record) {
$f = array_map(fn ($x) => $x['value'], $record->get('fields'));
easytawasul_send_template($f['phone'] ?? '', $f['name'] ?? '', 'el-' . time()); // use your form field IDs
});
Test each form with your own number. Check the API answer's code in the log if a message does not arrive (Errors and limits).
# WordPress forms
There is no WordPress plugin yet (see the [Roadmap](../roadmap)). These form plugins expose standard hooks, so a small snippet connects them today. Put the key in `wp-config.php`: `define('EASYTAWASUL_API_KEY', 'ez_live_...');`.
## A reusable sender
```php
function easytawasul_send_template($phone, $name, $ref) {
return wp_remote_post('https://app.easytawasul.com/api/v1/messages', [
'timeout' => 10,
'headers' => ['Authorization' => 'Bearer ' . EASYTAWASUL_API_KEY, 'Content-Type' => 'application/json', 'Idempotency-Key' => 'form-' . $ref],
'body' => wp_json_encode(['to' => $phone, 'type' => 'template',
'template' => ['name' => 'form_received', 'language' => 'ar', 'variables' => [$name]], 'client_reference' => $ref]),
]);
}
```
Create and get the `form_received` template approved first (**Templates** page). Phone numbers must include the country code.
## Contact Form 7
```php
add_action('wpcf7_mail_sent', function ($form) {
$d = WPCF7_Submission::get_instance()->get_posted_data();
easytawasul_send_template($d['your-phone'] ?? '', $d['your-name'] ?? '', 'cf7-' . $form->id() . '-' . time());
});
```
## Gravity Forms
```php
add_action('gform_after_submission', function ($entry, $form) {
easytawasul_send_template(rgar($entry, '3'), rgar($entry, '1'), 'gf-' . $entry['id']); // field IDs 3 = phone, 1 = name
}, 10, 2);
```
## Elementor Pro forms
```php
add_action('elementor_pro/forms/new_record', function ($record) {
$f = array_map(fn ($x) => $x['value'], $record->get('fields'));
easytawasul_send_template($f['phone'] ?? '', $f['name'] ?? '', 'el-' . time()); // use your form field IDs
});
```
Test each form with your own number. Check the API answer's `code` in the log if a message does not arrive ([Errors and limits](../errors-and-limits)).